---
title: Conditional Fare Networks (CFNs)
url: https://www.emergentmind.com/topics/conditional-fare-networks-cfns
type: topic
---

# Conditional Fare Networks (CFNs)

Conditional Fare Networks (CFNs) are a unifying, automaton-inspired framework for representing arbitrarily complex public-transport fare rules and integrating them into earliest-arrival routing algorithms. They were introduced in the study of the price-optimal earliest arrival problem (POEAP), where the objective is to calculate the Pareto-set of journeys with respect to ticket price and arrival time in a public transportation network. The framework is motivated by the observation that public transit fare structures are often a combination of various fare strategies such as distance-based fares, zone-based fares, or flat fares, and that the rules determining the actual ticket price are often very complex; accordingly, fare structures are notoriously difficult to model, because it is in general not sufficient to simply assign costs to arcs in a routing graph [2204.01326].

## 1. Problem setting and rationale

The POEAP asks, for given $s,t \in V$ and departure $t_0$, for all $s \to t$ journeys $p$ that are Pareto-optimal with respect to arrival time $c_t(p)$ and total price $\pi(\operatorname{ticket}(f(p)))$ [2204.01326]. In the underlying formulation, the transportation network is represented as a directed graph of stops and arcs, where arcs include vehicle legs, footpaths, and transfers.

The central modeling difficulty is that fare accumulation in public transportation is not generally arc-additive. Zone transitions, transfer entitlements, ticket upgrades, and threshold effects can depend on the history of a journey rather than on any single arc in isolation. This is why the framework does not treat fare as an ordinary scalar edge weight. Instead, it treats fare computation as state evolution over a structured fare space. This suggests that CFNs were designed to bridge the gap between realistic fare semantics and the algorithmic requirements of multi-objective public-transit routing.

The paper characterizes research into POEAP as scarce and notes that prior work usually either relies on heuristics or only considers restrictive fare models that are too limited to cover the full scope of most real-world applications [2204.01326]. Within that context, CFNs are presented as the first framework for representing a large number of real-world fare structures.

## 2. Formal structure of a Conditional Fare Network

A CFN is defined over several interacting components. The routing graph is $G=(V,A)$, the usual directed graph of stops $V$ and arcs $A$. Each arc $a \in A$ has a travel-time $c_t(a)$, described as a FIFO function $I \to I$, together with fare annotations [2204.01326].

The fare-accumulation component is a positive partially ordered monoid $(H,+,\le)$ that collects all “numeric” fare parameters. The examples given include distance, number of stops, and set-union of visited fare zones. In parallel, there is a finite set $S$ of discrete fare events, such as boarding a special train, leaving a city zone, or making a transfer. Ticket logic is encoded by a DAG $T=(T,E)$ whose nodes are tickets or ticket classes and whose arcs indicate feasible upgrades or downgrades of ticket along a journey [2204.01326].

Initial conditions are specified by a function $\phi:V \to F$ labeling each origin stop with its initial fare state, where $F := T \times H$. Any fare state $f \in F$ is written as $f=(\tau,h)$ with $\operatorname{ticket}(f)=\tau \in T$ and $h(f)=h \in H$. Ticket prices are given by a non-decreasing price function $\pi:T \to \mathbb{R}_+$ [2204.01326].

Fare-state evolution is governed by a state transition and an incremental-cost function:
$$
\tau: F \times A \to F,\quad \operatorname{Up}(f,a),
$$
with
$$
h(\operatorname{Up}(f,a)) := h(f)+w(a),
$$
and
$$
\operatorname{ticket}(\operatorname{Up}(f,a)) := \Gamma(\operatorname{ticket}(f), h(\operatorname{Up}(f,a)), \operatorname{event}(a)),
$$
where each arc $a$ carries a monoid weight $w(a)\in H$ and an event $\operatorname{event}(a)\in S$, and $\Gamma:T \times H \times S \to T$ chooses the next ticket among the current ticket’s out-neighbors [2204.01326].

The incremental cost of traversing arc $a$ from fare state $f$ is
$$
c_{\operatorname{cost}}(a,f) := \pi(\operatorname{ticket}(\operatorname{Up}(f,a))) - \pi(\operatorname{ticket}(f)) \in \mathbb{R}_{\ge 0}.
$$
The formulation also allows one to define $c(a,f)$ directly in terms of ticket upgrades or distance-based steps [2204.01326].

A notable feature of this definition is the separation between accumulated fare-relevant information $h$, discrete events $S$, and ticket-state evolution in the ticket graph. A plausible implication is that this decomposition is what enables CFNs to represent heterogeneous fare systems within a single formalism rather than through fare-model-specific routing encodings.

## 3. Modeling common fare strategies

The framework explicitly shows how several standard fare strategies fit into the same formal apparatus.

For zone-based fares, the zone set is $Z=\{z_1,\dots,z_m\}$, and the monoid is chosen as $H_z=2^Z$ with $+ := \cup$ and $\le := \subseteq$. Arc annotations take the form $h(a)=\{\operatorname{zone}(a)\}$, and the event set is $S=\{s_0\}$. The update rule is described as $\tau_Z((\tau_{Zi}),h,s_0)=Z_i \cup h(a)$. There is no incremental cost, $c(a,(\tau,h))=0$, and at journey end one buys the $k$-zone ticket with $\pi(\operatorname{ticket})=\operatorname{price}(|h_{\text{visited}}|)$ [2204.01326].

For distance-based fares, the monoid is $H_d=\mathbb{R}_{\ge 0}$ with ordinary addition and the natural order, and $w(a)=\operatorname{length}(a)$. Again $S=\{s_0\}$. The transition function $\tau_d$ keeps the same distance ticket until a threshold is exceeded; the example given is
$$
\Gamma(D,h,s_0)=D \text{ if } h \le d_{\max} \text{ else upgrade to “full-fare” ticket } F.
$$
Again $c(a,(\tau,h))=0$, while final cost $\pi(\operatorname{ticket}(D))$ depends on $h$ via $\pi_D(h)$ [2204.01326].

For flat-fare and unlimited-transfer tickets, the ticket graph is defined on $T=\{\text{Flat}, \text{Pay-per-leg}\}$ with trivial $H$. On the first boarding event, $\Gamma(\text{Flat},\cdot,\text{board})=\text{Flat}$, and otherwise the state remains in Flat. Then $c(a,(\text{Flat},0))=0$ for all arcs, while the initial price $\pi(\text{Flat})$ is a fixed fare. The same formalism can also encode transfers within a time window as events that keep the traveler in the same Flat ticket [2204.01326].

The examples are significant because they cover zones, distance, flat fares, transfer tickets, and threshold-triggered upgrades within a single state-transition language. This suggests that the ticket graph and monoid jointly serve as the abstraction layer through which otherwise disparate fare systems are rendered algorithmically comparable.

## 4. Computational complexity and limits

The paper states that optimizing over CFNs is NP-hard by the nature of their extensive modeling capabilities [2204.01326]. It also gives a sharper hardness result for a restricted case: the single-criterion version of POEAP, with zero travel-time and minimizing only $\pi$, is NP-hard.

The specific theorem is that finding an $s$–$t$ path $p$ minimizing $\pi(\operatorname{ticket}(f(p)))$ in a CFN with only zone-monoid $H=2^Z$ is NP-hard [2204.01326]. The proof sketch is by reduction from the path-with-forbidden-pairs problem. Each forbidden pair $(a_i,b_i)$ becomes a zone $i$; traversing $a_i$ or $b_i$ increments $h_i$ by $1$; if both are visited, then $\Gamma$ upgrades the ticket to an expensive one. Under that encoding, ensuring that no forbidden pair is fully visited is equivalent to keeping the cheap ticket.

This hardness result is methodologically important because it shows that computational difficulty is not an artifact of the most expressive versions of the framework. Even a restricted zone-monoid instantiation already inherits NP-hardness. A common misconception would be to treat fare optimization as a routine extension of earliest-arrival routing with an added scalar weight; the NP-hardness statement, together with the non-arc-additive fare semantics, directly contradicts that view.

## 5. Integration into multi-objective routing algorithms

A direct label-setting approach is obstructed by the fact that $\pi$ alone violates subpath optimality: detours through extra zones may pay off later [2204.01326]. To address this, the framework refines dominance using CFN structure.

The ticket set $T$ is partitioned into three classes:
- $C_F$, tickets whose reachable subgraph in $T$ is “no-overtaking” and has a Hamiltonian trace;
- $C_P$, tickets comparable only by equality;
- $C_N$, all others, described as non-comparable [2204.01326].

Comparability of fare states is then defined as follows. For $f_1=(\tau_1,h_1)$ and $f_2=(\tau_2,h_2)$,
$$
f_1 \preceq_C f_2
$$
iff $\tau_1 \notin C_N$, $h_1 \le h_2$, and:
- if $\tau_1 \in C_P$ then $\tau_1=\tau_2$;
- if $\tau_1 \in C_F$ then $\tau_1 \rightsquigarrow \tau_2$ in $T$ [2204.01326].

The strict order $f_1 <_C f_2$ holds if $f_1 \preceq_C f_2$ and either $h_1 < h_2$ or $\tau_1 \ne \tau_2$. The monotonicity condition
$$
\operatorname{Up}(f_1,a)\preceq_C \operatorname{Up}(f_2,a)
$$
ensures a weak subpath-optimality [2204.01326].

Labels are defined as $\ell=(v,t,f)$, with stop $v$, arrival time $t$, and fare state $f$. For an arc $a=(u,v)$ and label $\ell_u=(u,t,f)$, the relaxation computes
$$
f'=\operatorname{Up}(f,a), \qquad t'=t+c_t(a), \qquad \Delta \pi = c_{\operatorname{cost}}(a,f),
$$
yielding $\ell'=(v,t',f')$. If no existing label at $v$ dominates $\ell'$ under $\le_{\text{time}}$ and $\preceq_C$, the new label is inserted and all labels it dominates are removed [2204.01326].

The corresponding Multi-Criteria RAPTOR, denoted McRAP in the paper’s detailed description, proceeds in rounds $k=0,1,\dots,K$ limiting the number of transfers. It maintains bags $B_k(p)$ of undominated labels at stop $p$ after $k$ boardings, initializes with $B_0(s)=\{(s,t_0,\phi(s))\}$, and alternates route scanning, footpath relaxation, and termination when no new labels are produced [2204.01326]. The simplified pseudo-code in the source captures the label propagation rule:
```text
for k=0…K:
  for each ℓ=(u,t,f)∈Bₖ₋₁(u) and each a=(u,v):
    t'=t+cₜ(a), f'=Up(f,a)
    if ∄ℓ'∈B_k(v) with ℓ' ≤_time ℓ and f' ≼_C f(ℓ') then
      remove dominated labels from B_k(v)
      insert ℓ'=(v,t',f')
```
Dominance between labels is defined by common stop, non-worse arrival time, and fare-state comparability, with at least one strict inequality [2204.01326].

## 6. Empirical evaluation and practical implications

The reported case study uses the MDV (Leipzig–Halle) network with 56 zones, 17 city-fares, approximately 49k trips, and 7.8k routes. The query set contains 4 964 random origin–destination pairs with departure time 8 am, and the implementation is in C++17 [2204.01326].

The paper reports three main configurations:

| Configuration | Main characteristics | Reported performance |
|---|---|---|
| Full McRAP with CFN | Optimizing $\{\text{time}, \#\text{trips}, \text{fare-state}\}$ | Average run-time $\simeq 4675$ ms; average Pareto labels per query: 3 total, 2.62 truly price-optimal |
| Price-Based Target Pruning + Fare-Specific Speed-ups | Adds pruning of labels already more expensive than best known at destination; ignores irrelevant monoid dimensions per ticket type | Run-time down to $\simeq 243$ ms |
| Restricted Pareto-Sets: Tight-BMRAP | Slack $\text{arr} \in \{15,30,60\}$ min, trip-slack $\in \{1,2\}$; initial earliest-arrival RAPTOR, backward bounds, then pruned McRAP | Average run-times $<12$ ms; standard deviation $<7$ ms; Pareto-set size $\simeq 1.7$–$1.9$ journeys |

For the unrestricted configuration, the paper notes high variance, and also reports a zone-only figure of approximately $4.67$ s [2204.01326]. The tighter variants rely on two mechanisms named in the source: Price-Based Target Pruning (PTP), which prunes labels already more expensive than the best known at the destination, and Fare-Specific Speed-ups (FSS), which ignore irrelevant monoid dimensions per ticket type. The restricted Pareto-set method, Tight-BMRAP, additionally performs an initial earliest-arrival RAPTOR, computes backward bounds, and then runs a pruned McRAP.

The practical significance lies in the contrast between worst-case hardness and observed query times. The source summarizes that CFNs make it possible to model real-world fare complexity compactly, integrate fare computations into multi-criteria routing via a refined domination relation, and still achieve sub-100 ms queries or better when restricting Pareto sizes, which is described as fast enough for interactive trip-planning applications [2204.01326].

## 7. Position within public-transit routing

Within the problem domain of public-transit journey planning, CFNs are introduced as a building block for label-setting multi-objective shortest path algorithms and, specifically, as an adaptation target for a multi-criteria RAPTOR-style search [2204.01326]. Their role is not to replace timetable routing machinery, but to extend it with a fare semantics that is expressive enough to cover combinations of zone-based, distance-based, flat-fare, surcharge, and transfer rules.

The central conceptual contribution is the replacement of naïve fare additivity by structured fare-state evolution. In that sense, the framework addresses a long-standing mismatch between realistic tariff systems and shortest-path formulations. The paper’s refined dominance relation is equally central: because ordinary subpath-optimality fails when future fare interactions matter, comparability is weakened and made ticket-structure dependent rather than purely scalar [2204.01326].

A plausible implication is that CFNs are best understood as a modeling and algorithm-integration layer rather than as a single fare model. Their importance follows from the combination of three properties established in the source: they can represent a large number of real-world fare structures, they induce NP-hard optimization in general, and yet they admit practically effective query algorithms on a real-world data set [2204.01326].

Source: https://www.emergentmind.com/topics/conditional-fare-networks-cfns