{'fraction_non_alphanumeric': 0.03571989734457655, 'fraction_numerical': 0.011679673178651862, 'mean_word_length': 4.277863777089784, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Online Traffic Routing: Deterministic Limits and Data-driven Enhancements

Over the past decade, GPS enabled traffic applications, such as Google Maps and Waze, have become ubiquitous and have had a significant influence on billions of daily commuters' travel patterns. A consequence of the online route suggestions of such applications, e.g., via greedy routing, has often been an increase in traffic congestion since the induced travel patterns may be far from the system optimum. Spurred by the widespread impact of traffic applications on travel patterns, this work studies online traffic routing in the context of capacity-constrained parallel road networks and analyzes this problem from two perspectives. First, we perform a worst-case analysis to identify the limits of deterministic online routing and show that the ratio between the total travel cost of the online solution of any deterministic algorithm and that of the optimal offline solution is unbounded, even in simple settings. This result motivates us to move beyond worst-case analysis. Here, we consider algorithms that exploit knowledge of past problem instances and show how to design data-driven algorithms whose performance can be quantified and formally generalized to unseen future instances. We present numerical experiments based on an application case for the San Francisco Bay Area to evaluate the performance of our approach. Our results show that the data-driven algorithms we develop outperform commonly used greedy online-routing algorithms.


Introduction
The emergence of traffic navigational applications in the past decade has had a transformational impact on billions of people's daily commutes. Particularly, mobile applications that instantaneously suggest routes to user queries have become increasingly popular as they enable free access to real-time traffic information. In the US alone, over 200 million people used Google Maps, Apple Maps, or Waze in 2018 [1]. While the ubiquity of such GPS-enabled routing applications has made travel more convenient, reliable, and accessible, it has also resulted in an ever-growing influence on the traffic patterns of cities, and has often been associated with increasing traffic congestion [2]. For instance, greedy routing [3], wherein route suggestions aim to minimize a user's travel time, often results in a traffic pattern far from the system optimum [cf. 4,5].
In parallel, the advent of big data analytics has led to a new paradigm in traffic routing, namely anticipatory route guidance [6,7]. In this context, the availability of prior traffic information enables the prediction of future demands and traffic conditions, which can then be incorporated in the routing recommendations. In related applications, e.g., online resource allocation, it has been shown that as more prior information on arriving input becomes available the loss due to online decision making decreases [8].
The impact of traffic navigational applications on travel patterns coupled with the value of prior information in improving the quality of online decisions motivates us to study online traffic routing for parallel road networks from two perspectives. First, we identify the limits of conventional deterministic algorithms, e.g., a greedy algorithm, from a competitiveness analysis lens. We then move beyond worst-case analysis, and introduce data-driven algorithms with probabilistic generalization guarantees. Further, we evaluate the performance of these algorithms through numerical studies. While the focus on parallel road networks may appear restrictive, such networks are of theoretical and practical significance. For instance, Pigou's network [9], a two-arc parallel network, has been used extensively in the selfish routing literature to study price of anarchy bounds [10] and more general parallel networks have been used to study Stackelberg routing strategies [11]. More broadly, analogues of parallel networks have been considered in several online resource allocation problems, including online knapsack [12] and job scheduling [13]. From a practical perspective, transportation networks are rarely parallel but can often be sufficiently approximated by a parallel network for specific use cases [14], e.g., when multiple highways connect two populated areas, such as the highways connecting San Francisco and San Jose in California.

Model
We consider a graph with M ≥ 2 parallel arcs and two vertices representing an origin and a destination. Travelling through arc a requires t a time units, and each arc a has a capacity c a . We collect these parameters in S := {{c a } a∈ [M ] , {t a } a∈[M ] }, where [N ] = {1, 2, . . . , N } for any N ∈ N, and order the arcs, without loss of generality, so that t 1 ≤ t 2 ≤ ... ≤ t M . We denote an input sequence of n users by I := {{θ i } i∈ [n] , {τ i } i∈[n] }, stating for each user i its time of appearance τ i ∈ R ≥0 and its value-of-time θ i ∈ Θ, where Θ is finite. We assume without loss of generality that τ 1 = 0 < τ 2 < ... < τ n , i.e., no two users arrive in the system at the same point in time. With this notation, the Online Traffic Routing (OTR) problem is as follows.
Problem 1. (Online Traffic Routing (OTR)) Let the parameter set S and an input sequence I be given and define a problem instance. Users arrive sequentially in the system and must be irrevocably assigned to an arc at their time of appearance τ i . The number of users concurrently traversing an arc is limited to the capacity c a of the arc, and each user traverses an arc a for t a time units. The OTR problem is to construct an assignment of users to arcs such that the total travel cost, i.e., the sum of the value-of-time weighted travel time of all users, is minimal.
If all users are identical, i.e., θ i = θ i for each i, i ∈ [n], we refer to this problem variant as OTR-I. We evaluate the efficacy of an algorithm A that solves Problem 1 via its competitive ratio where OP T (I) denotes the optimal offline travel cost for the OTR problem and ALG(I, A) denotes the travel cost of the online solution achieved by algorithm A on input sequence I. We say that an algorithm is α-competitive if CR(A) ≤ α. The input sequence I belongs to a set Ω, which corresponds to user arrivals such that the value-of-time θ i > 0 and the arrival time τ i ≥ 0 for all users i, with the first user arriving at time zero. We compute OP T (I) by solving the following optimization problem where we introduced binary variables x ia to denote whether user i is assigned to arc a (x ia = 1) or not (x ia = 0). Here, (1b) are assignment constraints, (1c) are binary constraints and (1d) are capacity constraints. Throughout the manuscript, we assume that Problem (1a)-(1d) is feasible, i.e., the capacity constraints can be satisfied. We conclude this section highlighting that our model mirrors the operation of commonly used traffic navigational applications such as Google Maps or Waze that suggest routes to users. Furthermore, our model can be used to describe the online operation of a centrally controlled smart mobility system, e.g., a fleet of autonomous taxis. Here, the traffic application or the fleet operator takes centralized routing decisions and it is assumed that users are not strategic, i.e., the users' values of time are known by the traffic navigational application or the fleet operator. While, in general, user's values of time may not be known, it can often be estimated [15]. Accordingly, most literature on traffic routing with heterogeneous users [16,17] make this assumption. Furthermore, in the context of heterogeneous user traffic routing, minimizing the weighted travel time of all users is also standard in the literature [18].

Contribution
In this work, we develop algorithms for the OTR problem in two settings. We first focus on an adversarial setting and perform a worst-case competitive analysis of deterministic algorithms. We then focus on a stochastic user arrival setting and design a data-driven algorithm whose performance can be provably generalized to unseen instances.
In the adversarial setting, we first consider the OTR-I problem for a two-arc parallel network and show that a greedy algorithm, which allocates users to the least cost arc that is below capacity, is optimal, i.e., achieves a competitive ratio of one. We then consider other problem variants within OTR, including the settings of M ≥ 3 arcs and non-identical users, and show that the ratio of the total travel cost of the online solution of any deterministic algorithm to that of the optimal offline solution is unbounded. We extend this worst-case analysis to general (non-parallel) road networks and general arc cost functions.
The unbounded competitive ratios encountered for the variants of the two-arc OTR-I problem motivate us to leverage the ever-increasing availability of traffic data, e.g., origin-destination travel information, to devise improved data-driven routing algorithms. In particular, given the availability of such prior travel information, we study the setting of stochastic arrivals, wherein users arrive according to some unknown probability distribution. In this setting, we develop both time-independent and time-dependent data-driven algorithms that learn an optimal parametrization for traffic routing from past training input sequences and utilize this learned information to make online decisions on unseen test sequences. In this context, we obtain probabilistic generalization guarantees for our data-driven algorithms to unseen input sequences drawn from the same probability distribution.
Finally, we present numerical experiments to evaluate the performance of the data-driven and greedy algorithms for a range of problem settings, including an application case to the San Francisco Bay Area.
The results indicate that both the data-driven algorithms achieve lower ratios between the travel costs of the online and optimal offline solutions as compared to that of the greedy algorithm. That is, both the time-independent and time-dependent data-driven algorithms outperform the greedy algorithm, thus highlighting the value of prior information in online algorithm design. Furthermore, the time-dependent algorithm achieves a better performance compared to its time-independent counterpart, although the latter has a superior probabilistic generalization guarantee. This observation points towards the importance of adjusting allocations based on changes in user arrival rates.

Organization:
The remainder of this paper is as follows. Section 2 reviews related literature. In Section 3, we study the limits of deterministic algorithms for variants of the OTR-I problem from a competitive-analysis perspective when user arrivals are adversarial. We then move to the setting wherein prior stochastic information on user arrivals is known and develop data-driven algorithms with generalization guarantees (Section 4). Finally, we evaluate the performance of the data-driven algorithms as compared to the greedy algorithm through numerical experiments in Section 5 and conclude the paper in Section 6.

Literature Review
This paper is closely related to online resource allocation problems and to beyond worst-case online algorithm design. We begin with a review of two dynamic resource allocation applications, namely the online knapsack and job scheduling problems, that are closely related to the model studied in this paper. We then survey results on competitive analysis of online algorithms and beyond worst-case methodologies, and discuss how they relate to this work.
In online knapsack problems, the goal is to maximize the total value of items irrevocably assigned to knapsacks with fixed capacities, without knowledge of the values of items that will arrive in the future [19,12]. While similar to the model we consider, when an item is assigned to a knapsack, the item stays in the knapsack indefinitely, i.e., until no item remains or until no remaining item can fit in any knapsack. In this regard, the online knapsack setting differs from the OTR problem since users allocated to arcs (or equivalently knapsacks) also depart from the arcs when they complete their trip.
In job scheduling problems, n jobs need to be scheduled on m machines to optimize a system objective, such as the total time spent by all jobs in the system. In the online setting, jobs are either assumed to arrive over time (online-time job scheduling), or they may be scheduled in a sequence (online-list job scheduling), cf. [20]. Online-time job scheduling parallels the OTR problem in the user (or job) arrival process since users arrive at different points in time into the network. On the other hand, the allocation of users to arcs instantaneously upon arrival mirrors online-list job scheduling, wherein each job must be scheduled on a machine at the instant that it arrives. Thus, the online traffic routing setting we study combines different elements of the two commonly used online job scheduling models.
Online resource allocation algorithms have traditionally been designed to perform well under worstcase assumptions, i.e., under the assumption that inputs are adversarially chosen. For instance, Jaillet and Wagner [21] develop algorithms for the online traveling salesman problem (TSP) with worst-case performance guarantees, while Mehta et al. [22] and Buchbinder and Naor [23] obtain worst-case competitive ratios for online bipartite matching in the context of internet advertising. Since worst-case competitive analysis can be exceedingly pessimistic, Hwang et al. [8] demonstrated the value of prior information in online decision making. More specifically, the authors show that the loss due to online decision making decreases with an increase in the proportion of available prior information on arriving input. In line with these works, we first study the OTR problem from a worst-case perspective. To improve the resulting worst-case guarantees, we additionally analyze a setting wherein prior information on the arriving input is known, which is a common informational assumption used in many online resource allocation applications [24,25].
One approach used to perform beyond worst-case analysis [26,27] is that of stochastic arrivals, wherein the input arrives according to some potentially unknown probability distribution. Such stochastic assumptions on future input have been used to aid online algorithm design to improve on worst-case competitive ratios in many applications, including online TSP [28] and online bipartite matching [29]. In particular, one approach has been to use the offline optimum for an expected instance to make online decisions [30]. In this work, we move beyond such techniques through data-driven algorithms that are trained on past input sequences rather than just on an expected sequence, thereby capturing the stochastic variations in the arriving input.
Another beyond worst-case model is the random order model, wherein the sequence of arrivals occurs according to a random permutation of an arbitrary input sequence. In this model, a small fraction of the entire input sequence is observable, which allows for predicting the pattern of future demand. For instance, Devanur and Hayes [31] use a fraction of the input sequence to train their online bipartite matching model and then use the learned parameters to make online decisions for the remaining unseen input. This approach was further extended to a repeated learning setting in the context of revenue management by Agrawal et al. [32]. Our data-driven approach mirrors the two-phase approach of model training and online decision making adopted in these works. However, there is a fundamental difference between our approach and that of Devanur and Hayes [31] and Agrawal et al. [32]. In particular, we use parameters learned from past input sequences to make prescriptive online decisions on unseen input sequences. In contrast, Devanur and Hayes [31] and Agrawal et al. [32] learn model parameters by observing only a fraction of a given input sequence to make decisions for the remaining input sequence. When making online decisions in the transportation context, we need to allocate users instantaneously. Thus, observing the first fraction of arriving users may not be viable. Instead, we can leverage past travel data, e.g., origin-destination and traffic flow data, to learn information on user arrivals and subsequently make online decisions.
This paper contributes to the aforementioned literature in several ways. With respect to online resource allocation literature, we propose a novel model for dynamic resource allocation motivated through online traffic routing applications. With regards to beyond worst-case online algorithm design, we propose datadriven algorithms based on the scenario approach [cf. 33], which we believe is of independent interest and is broadly applicable to online resource allocation problems beyond the one studied in this paper.

Worst-Case Analysis of Online Traffic Routing Algorithms
In this section, we consider the setting of adversarial user arrivals and study worst-case competitive ratios of deterministic algorithms for variants of the OTR problem. To this end, we first consider the OTR-I problem, wherein all users have identical values of time, and show that a greedy algorithm achieves a competitive ratio of one for a two arc parallel network (Section 3.1). We then show that the ratio of the travel cost of any deterministic online algorithm's solution to that of the optimal offline solution can be arbitrarily large for problem settings beyond two arc parallel road networks with identical users (Section 3.2).

Routing Identical Users in a Two-Arc Capacity Constrained Parallel Network
This section focuses on routing identical users in a two-arc parallel road network and presents a greedy algorithm that achieves a competitive ratio of one. In particular, we analyze the greedy algorithm, described in Algorithm 1, which allocates arriving users to the least cost arc that is below capacity. Since users are identical, we normalize θ i to one for all agents i in this section. We now present the main result of this section, which establishes that the greedy algorithm, described in Algorithm 1, is optimal for the two-arc OTR-I problem. We prove Theorem 1 using two intermediary results. We first characterize a sufficient condition for an algorithm to achieve a competitive ratio of one for a general M -arc network and then show that the greedy algorithm satisfies this sufficient condition when M = 2. To characterize the sufficient condition, we focus on the set of feasible algorithms that satisfy Constraints (1b)-(1d). We note that the set of feasible algorithms is non-empty as Algorithm 1 allocates users upon arrival to an arc below capacity and thus satisfies Constraints (1b)-(1d). Let A be one such feasible algorithm and let N I a,A denote the total number of users that are allocated by A to arc a for input sequence I. Then, Lemma 1 provides a sufficient condition for A to achieve a competitive ratio of one. Lemma 1. (Optimality Condition for OTR-I) Suppose that there is a feasible algorithm A, satisfying Constraints (1b)-(1d) for the OTR-I problem, such that for all input sequences I, The above lemma states that an algorithm is optimal for the OTR-I problem if it allocates more users on the lower cost arcs than any other feasible algorithm. We prove Lemma 1 in Appendix A.1 .
Our second intermediary result establishes that Algorithm 1 satisfies the sufficient optimality condition of Lemma 1 for a two-arc parallel network. To establish this claim, we will show that no feasible algorithm can allocate more users to arc one than the greedy algorithm.
Lemma 2. (Sufficiency for Optimality of Greedy for Two-Arc OTR-I) In a two arc parallel road network with identical users, Algorithm 1, denoted as A, satisfies the property that N I 1,A ≥ N I 1,A for all input sequences I and for any algorithm A that satisfies the feasibility Constraints (1b)-(1d).
Proof (Sketch). Denoting arcs one and two by a 1 and a 2 , we proceed by induction on the number of users that Algorithm 1 allocates on a 2 . For the base case, it is easy to see from the feasibility constraints that if Algorithm 1 allocates one user on a 2 then any other feasible algorithm must also allocate at least one user on a 2 as well. We then consider the inductive step and show that if k + 1 users are allocated by Algorithm 1 on a 2 then at least k + 1 users are allocated by any other feasible algorithm on a 2 . This follows since the greedy algorithm always allocates users on a 1 if it is below capacity. Thus, for every user the greedy algorithm allocates on a 2 , any other feasible algorithm must also allocate at least one user on a 2 .
For a detailed proof of Lemma 2, see Appendix A.2 . Finally, noting that algorithms A and A must allocate the same number of users, it follows with equality that 2 a=1 N I a,A ≥ 2 a=1 N I a,A . Thus, Algorithm 1 satisfies the optimality condition of Lemma 1, thereby establishing Theorem 1.

Worst-Case Performance Limitations of Deterministic Algorithms
The optimality of the greedy algorithm for the two-arc OTR-I problem raises the question of whether a similar result holds for more general problem variants. In this section, we first consider OTR problem variants beyond the two-arc OTR-I problem by considering the settings of (i) M ≥ 3 arcs, and (ii) nonidentical users. We then consider the extensions of the OTR problem to the settings of (iii) general road networks and (iv) general cost functions for the arcs. We show that for these problem variants the worst-case ratio between the online and optimal offline solutions is unbounded for any deterministic algorithm.

Worst-Case Ratios for the OTR Problem.
In this section, we show that for any variant of the two-arc OTR-I problem, an adversary can construct instances such that the ratio of the total travel cost of the online solution of any deterministic algorithm to that of the optimal offline solution is unbounded.
Theorem 2. (Unbounded Worst-Case Ratios for OTR) For any feasible deterministic algorithm, there are instances such that the ratio of the total travel cost of the online solution to that of the optimal offline solution is unbounded in each of the following cases: (i) The number of arcs M in the network is at least three, and (ii) the users are non-identical. Only in the case of the two-arc OTR-I problem, i.e., all users have equal values of time, there exists a feasible deterministic algorithm that achieves a finite ratio between the total travel cost of an online solution and that of the optimal offline solution.
This theorem highlights that the assumptions of identical users and a two-arc parallel network are critical to the optimality of Algorithm 1. In fact, this result implies that the two-arc OTR-I problem is the only variant of OTR for which any deterministic algorithm can achieve a finite ratio between the total travel cost of an online solution and that of the optimal offline solution.
To prove Theorem 2, it suffices to focus on two independent problems: (i) M ≥ 3 arc OTR-I, and (ii) two-arc non-identical user OTR.
M ≥ 3 Arcs OTR-I: We first consider the extension of the two-arc OTR-I problem to an M arc parallel network setting where M ≥ 3. Lemma 3 establishes that the worst-case ratio of the total travel costs of the online solution of any deterministic algorithm to that of the optimal offline solution is unbounded in this setting.
Lemma 3. (Unboundedness for M ≥ 3 Arcs) For any M ≥ 3, there exist arc costs t 1 , t 2 , t 3 and arc capacities c 1 , c 2 , and c 3 such that the ratio of the total travel cost of the online solution of any deterministic algorithm to that of the optimal offline solution is at least 1 + t3−t2 2t1+2t2 . The quantity 1 + t3−t2 2t1+2t2 is unbounded since an adversary can pick t 3 to be arbitrarily large.
Proof (Sketch). We fix a three arc parallel network, where the arc capacities are c 1 = 1, c 2 = 1, c 3 = 10 and the arc costs are t 1 = 5, t 2 = 10.01, and t 3 can be chosen by an adversary. In any such three-arc network, a feasible deterministic algorithm A must allocate the first arriving user on one of the three arcs. We analyze each case and show that an adversary can construct input sequences such that any feasible deterministic algorithm will allocate users on arc three, while the optimal allocation assigns users to the first two arcs. The analysis yields a lower bound on the ratio of the total travel cost of the online solution of any deterministic algorithm to that of the optimal offline solution of 1 + t3−t2 2t1+2t2 . Unboundedness follows since t 3 can be chosen to be arbitrarily large for fixed t 1 and t 2 .
We refer to Appendix A.3 for a detailed proof of Lemma 3.
Two-arc Non-Identical User OTR: We now consider the case of non-identical users, i.e., the OTR problem described in Section 1.1, and show that the ratio of the total travel cost of the online solution of any feasible deterministic algorithm to that of the optimal offline solution is not finite. We further show for the two-arc OTR problem that Algorithm 1 achieves the best possible ratio for the total travel cost of the online solution of any deterministic algorithm to that of the optimal offline solution.
Lemma 4. (Unboundedness for Non-Identical Users) Consider a parallel network where M = 2 and let θ and θ be the lowest and highest user values-of-time respectively. Then for the OTR problem there exist arc capacities c 1 , c 2 such that the ratio of the total travel cost of an online solution of any feasible deterministic algorithm to that of the optimal offline solution is at least θ t2+θ t1 θ t1+θ t2 , where t 1 and t 2 are the costs of the two arcs such that t 1 ≤ t 2 . Algorithm 1 achieves this ratio for any two-arc parallel network.
Proof (Sketch). To prove this theorem, we first define the set of network parameters S and provide two input sequences for which the ratio of the solution of any deterministic algorithm to the optimal offline solution is at least θ t2+θ t1 θ t1+θ t2 on one of these input sequences. Next, to establish that the greedy algorithm achieves this ratio for a two-arc parallel network, we use the property of the greedy algorithm established in Lemma 2 and provide a sequence of inequalities, which establish that θ t2+θ t1 θ t1+θ t2 is an upper bound on the ratio of the total travel cost of the online solution of Algorithm 1 to that of the optimal offline solution. Since Algorithm 1 is deterministic, the greedy algorithm achieves the ratio of θ t2+θ t1 θ t1+θ t2 for the OTR problem for a two-arc parallel network.
We refer to Appendix A.4 for a detailed proof of Lemma 4. Note that if we let θ >> θ , then θ t2+θ t1 θ t1+θ t2 ≈ t2 t1 . That is, the ratio of the online and offline solutions is at least the ratio of the travel times of the links.
Since an adversary can choose t 2 to be arbitrarily large the ratio t2 t1 is unbounded. Furthermore, note that if the lowest and highest values of time are equal, i.e., θ = θ , then the competitive ratio of the greedy algorithm obtained in Lemma 4 equals one, which parallels the result of Theorem 1. As the difference in the values of time increases the worst case ratio between the online greedy solution and that of the optimal offline solution also increases. Thus, Lemma 4 provides a parametric representation of the competitive ratio of the greedy algorithm as we move smoothly between OTR-I to OTR for a two-arc parallel network.

Extensions of the OTR Problem.
In this section, we consider extended variants of the OTR problem to the settings of (i) general non-parallel road networks, and (ii) general cost functions. In both settings, we show that even when users are identical, the ratio between the total travel cost of the online solution of any deterministic algorithm to that of the optimal offline solution is unbounded.
General (Non-Parallel) Road Networks: We first consider the extension of the OTR problem to general road networks with identical users and refer to Appendix B.1 for an introduction to this problem setting. Lemma 5 shows that in this setting, the ratio between the total travel cost of the online solution of any deterministic algorithm and that of the the optimal offline solution is again unbounded.
Lemma 5. (Unboundedness for General Road Networks) Consider a series parallel road network with two sets of parallel networks, each consisting of two arcs. Then for some arc capacities and costs, the ratio between the total travel cost of the online solution of any feasible deterministic algorithm to that of the optimal offline solution is unbounded for the generalization of the OTR-I problem to general road networks.
Proof (Sketch). To prove the lemma, we consider a series parallel network with one origin and one destination, separated by one intermediate node. We then consider the possible cases for how a deterministic algorithm could allocate the first arriving user in the series parallel network. In each case, we demonstrate an input sequence for which a deterministic algorithm will allocate at least one user on an arc that the optimal offline allocation will never allocate users to. Since an adversary can choose the cost of this arc to be arbitrarily large, the ratio between the total travel cost of the online solution of any deterministic algorithm and that of the optimal offline solution cannot be bounded.
We refer to Appendix A.5 for a detailed proof of Lemma 5.
General Cost Functions: Thus far, we have considered the setting where the cost of the arcs are constant. We now consider a setting where the travel time (rather than being fixed) on the arcs is modelled by a cost function f a : R ≥0 → R ≥0 . Here we denote the travel time of arc a as f a (y) when y users are on arc a. We introduce the relevant notation and present the OTR problem for general cost functions in Appendix B.2 .
In this setting, we show that the ratio between the total travel cost of any deterministic algorithm's online solution and that of the optimal offline solution is unbounded.
Lemma 6. (Unboundedness for General Cost Functions) Let M = 2, then for some arc capacities c 1 and c 2 , there exist arc cost functions f 1 : R ≥0 → R ≥0 and f 2 : R ≥0 → R ≥0 such that the ratio of the total travel cost of the online solution of any feasible deterministic algorithm to that of the optimal offline solution is unbounded for the OTR-I problem for general cost functions.
Proof (Sketch). We consider a two arc network with arc capacities c 1 = 2, c 2 = 1. We further define the cost function of arc two (a 2 ) to be constant and let the cost of arc one (a 1 ) be defined by a linear function f 1 that satisfies f 1 (1) = 5 and f 1 (2) =d, whered is chosen by an adversary. We then construct input sequences such that any feasible deterministic algorithm will allocate two users simultaneously on arc a 1 to incur the costd, while the optimal allocation is to assign users such that no two users concurrently use a 1 . Sinced can be made arbitrarily large, the ratio of the total travel cost of the online solution of any deterministic algorithm to that of the optimal offline solution is unbounded.
We refer to Appendix A.6 for a detailed proof of Lemma 6.
In this section, we analyzed four problem variants that removed the simplifying assumptions of the twoarc OTR-I problem considered in Section 3.1. In each of these variants, we established that the ratio between the total travel cost of the online solution of any deterministic algorithm to that of the optimal offline solution is unbounded.

Beyond Worst-Case Analysis With Prior Information
The worst-case analysis for the OTR problem motivate us to consider the setting wherein prior information of the user arrivals is known. Assumptions on user arrivals are reasonable in practical traffic routing applications due to the ever-increasing availability of traffic data. For instance, origin-destination travel information enables the capture of regularities in user arrivals, e.g., the similarity in peoples' weekday travel patterns throughout the year. Given the availability of prior information, we consider stochastic assumptions on user arrivals, where the input sequences I are drawn from a (potentially unknown) probability distribution. For this setting, we devise data-driven algorithms that learn an optimal parametrization for traffic routing through past observed input sequences and utilize this learned information to make prescriptive real-time decisions on unseen test sequences. We further obtain probabilistic generalization guarantees of our datadriven algorithms to unseen input sequences drawn from the same probability distribution.
We begin this section by presenting an overview of the scenario optimization paradigm in Section 4.1, which we leverage to devise a time-independent data-driven algorithm for the OTR problem in Sections 4.2 and 4.3. We finally present generalization guarantees for our time-independent algorithm and develop an extension of this algorithm to the time-dependent setting in Section 4.4.

Scenario Approach
The scenario optimization framework provides a methodology to perform optimization in uncertain environments where the instances are represented by an uncertainty vector δ that lies in the probability space (∆, F, P). Here ∆ is the sample or uncertainty set of possible outcomes, F is a σ-algebra, and P is a probability measure on the sets of possible outcomes. The scenario approach is based on the following prototypical convex optimization problem: Here Π ⊆ Rn is a closed and convex set, π ∈ Π is a vector of decision parameters, and c is a constant vector. Further, f (π, δ) is a continuous and convex function in π, while δ i for k ∈ [K] is an independent and identically distributed (i.i.d.) random sample drawn from the uncertainty set ∆. An example of set ∆ and random vector δ in the context of the OTR problem are given in Section 5.1.
In recent years, research on scenario optimization has focused on generalization guarantees for Problem (2) to extend its solution properties to unseen samples in the probability space. To elucidate the generalization guarantee we leverage in this work, we first introduce some key definitions. First, we define the risk of a vector of decision variables π as the probability that constraints of the form f (π, δ) ≤ 0 are violated.
In addition to the objective c T π * for the optimal decision variables π * corresponding to the solution of Problem (2), the risk V (π * ) is a fundamental quantity to evaluate the quality of a vector of decision parameters π * . While the problem of providing bounds on the number of samples K that are necessary to provide a solution with a small risk have been studied extensively [33,34], these bounds are often not tight for problems that are not fully supported, i.e., problems where the removal of some constraints will not change the solution π * to Problem (2). As a result, to obtain bounds on the risk of a vector of optimal decision parameters, we adopt the approach used in [35], which relates the level of risk of the optimal solution π * of Problem (2) to its number of support constraints, formally defined as follows. (2) is a support constraint if its removal changes the optimal solution π * of Problem (2).
Using the above notion of a support constraint, [35] establish the following key result. Proposition 1. (Relation between Number of Support Constraints and Risk, see [35]) Fix a parameter β ∈ (0, 1) and consider the following polynomial equation in t for any k ∈ {0, 1, ...,n} This equation has exactly two solutions t(k),t(k) ∈ [0, ∞) where t(k) ≤t(k). Let π * be the unique solution to Problem (2). Then, when the number of samples is greater than the number of decision variables, i.e., K >n, where s * are the number of support constraints,¯ (s * ) = 1 − t(s * ) and (s * ) = max{0, 1 −t(s * )}.
The guarantee provides upper and lower bounds on the level of risk of the optimal solution π * to Problem (2) with a level of confidence 1 − β. These bounds can be computed by assessing the number of support constraints s * after computing the optimal solution to Problem (2). In general, we can take the parameter β to be arbitrarily close to zero, since the solutions of Equation (3) depend logarithmically on β. We further note that the upper bound on the level of risk typically increases with the number of support constraints. Thus, to provide strong generalization guarantees, we seek decision variables of Problem (2) that simultaneously lead to a small objective c T π * and a relatively small number of support constraints.

Data-Driven Online Traffic Routing
In this and the following sections, we leverage the scenario optimization paradigm to devise a time-independent data-driven algorithm for the OTR problem whose performance can be formally generalized to unseen instances through Theorem 1. The data-driven algorithm has two phases: (i) an offline parameter learning phase and (ii) an online decision-making phase. In this section, we present the general structure of the offline problem that we solve to learn the data-driven algorithm's parameters. Then, we develop a specific parametrization of the data-driven algorithm in Section 4.3 and show that it is a special case of the scenario optimization Problem (2) in Section 4.4.
We aim to devise an algorithm A * for OTR that achieves the minimum possible competitive ratio for all input sequences I ∈ ∆. In other words, the objective is to find A * that satisfies: where α is the competitive ratio. Note that to appropriately define the set ∆, we fix the number of arriving users n in the network. Problem (4a)-(4c) is equivalent to the robust optimization problem: Solving Problem (4a)-(4c) and (5) is typically intractable, since the problem is discrete, due to the binary constraints, and we are optimizing over the universe of all possible algorithms. To obtain a tractable surrogate problem we consider two simplifications. First, we restrict the algorithm A * to lie in a parametric class, which we denote as A. We elaborate on our choice of A in Section 4.3. Second, we allow fractional allocations by relaxing the binary constraints with: We thus compute OP T (I) for each input sequence I as the optimal objective of the problem of minimizing (1a) subject to the constraints (1b), (1d) and (6). Note that the optimal objective value of this fractional problem serves as a lower bound on the objective of the integral Problem (1a)-(1d). Further, note that the fractional problem is a linear program with n + 2nM constraints and nM decision variables. Since the size of this linear program is polynomial in the inputs defined by S and I, it follows that OP T (I) can be computed in polynomial time for any input sequence I. Given the above relaxations, the objective of learning algorithm A * can be summarized as follows: We note that Problem (7a)-(7d) is not equivalent to Problem (4a)-(4c), and so we introduce a rounding procedure to ensure feasibility for Problem (4a)-(4c). Doing so enables us to reason about the properties of the original Problem (4a)-(4c). We further note that even the surrogate problem may be intractable since the probability space could have infinitely many samples resulting in infinite constraints. To efficiently solve the surrogate problem, we use a constraint sampling procedure wherein we learn the optimal parametrization through K i.i.d. input sequences I 1 , ..., I K of the OTR problem. Specifically, we learn algorithm A * through the solution of the following scenario-based problem: The optimal objective α * of the above problem is the maximum ratio between the total travel cost of the online solution of A * and that of the optimal offline solution for K training input sequences.

Offline Parameter Learning for Time-independent Algorithm
In this section, we propose a parametric class A over which we optimize to learn the routing algorithm A * . To develop strong generalization guarantees to unseen sequences using the scenario approach (Theorem 1) we must choose a parametric class A that reduces the offline learning Problem (8a)-(8c) to a special case of the scenario optimization Problem (2). Furthermore, we seek to develop a parametric class A that is sufficiently simple for optimization, i.e., Problem (8a)-(8c) can be computed quickly, by finding a low-dimensional parametrization while also being rich enough to provide good performance on unseen sequences.
The class of algorithms A we consider can be parametrized by a vector p θ ∈ R M for each value-of-time θ. Here p θa for each a ∈ [M ] represents the probability that a user with value-of-time θ is allocated to arc a. We can learn the optimal p θ through the solution of the following problem.
Here, (9b) are competitive ratio constraints ensuring that the total cost of the optimal parametrization is no more than α times the cost of the optimal offline solution, (9c) are non-negativity constraints, (9d) are assignment constraints, and (9e) are capacity constraints. Further, τ . Note that this parametrization only depends on users' value-of-time and is independent of the traffic states or the time at which a given user arrives. The dependency on the value-of-time of the optimal parametrization ensures that the allocation decision is consistent across users belonging to a given value-of-time. The above parametrization can be naturally extended to a time-dependent setting by learning allocation probabilities p j θ for different time intervals j at which users arrive. We explore such a parametrization in more detail in Section 4.4. We note that one could also choose parametrizations that depend on the traffic state, which would give the parametrization more power in catering specific allocation decisions based on the set of possible traffic states. However, since the number of traffic states can typically be large and is a function of user arrival rates, accounting for traffic states would result in a high-dimensional parametrization without giving much more decision making power than the timedependent algorithm (see Section 4.4) that adjusts allocations based on changes in user arrival rates. Our low-dimensional parametrization ensures that Problem (9a)-(9e) is tractable, which may not be possible with more complex parametrizations. Problem (9a)-(9e) is a linear program with |Θ|M decision variables and |Θ|M + |Θ| + K + nM K constraints.
Algorithm 2 sketches our data-driven online algorithm that proceeds in two phases. It first learns the optimal parametrization p θ for each θ ∈ Θ through the solution of the offline Problem (9a)-(9e). These learned parameters are then used to make online decisions for each test sequence as follows: when a user with a value-of-time θ arrives, the user is allocated to arc a with probability p θa . Note that the allocation probabilities we learn in Algorithm 2 serve as a fractional heuristic for the corresponding discrete allocations, which must be made in the context of the OTR problem. That said, we expect that as the number of users increases, the online solution corresponding to the discrete allocations will converge to that of the fractional allocations by the law of large numbers.

Generalization Guarantee for Data-Driven Algorithm
We now present a probabilistic generalization guarantee for Algorithm 2 that learns the optimal parametrization of Problem (9a)-(9e). In particular, Corollary 1 establishes an explicit bound on the level of risk based on the number of support constraints of the offline learning Problem (9a)-(9e). Corollary 1. (Theoretical Bounds on Risk) Fix a parameter β ∈ (0, 1) and suppose that the solution to the Problem (9a)-(9e) is unique for instances I k for k ∈ [K]. Let s * be the number of support constraints of Problem (9a)-(9e) and let (s * ) ,¯ (s * ) be computed through the solutions t(s * ),t(s * ) of as in Theorem 1. Then, it follows that Proof. Proof To prove this claim, we aim to establish that Problem (9a)-(9e) is a special case of Problem 2.
We first note that Constraints (9c) and (9d) are independent of the problem instance and form a closed and convex set, analogous to the closed and convex set Π in the scenario optimization Problem (2). For this problem we have that Π ⊆ R |Θ|M . However, due to the constraint a p θa = 1, the optimal parametrization lies on a hyperplane of dimension |Θ|(M − 1). Next, there is one competitive ratio constraint (9b) and n capacity constraints (9e) for each instance, resulting in a total of n + 1 constraints of the form: f 1 (p, I) ≤ 0, . . . , f n+1 (p, I) ≤ 0. Note that these constraints reduce to a single scalar valued constraint function in the scenario optimization Problem (2) since f (p, I) .
= max l=1,...,n+1 f l (p, I). Since the constraints are convex and the objective function is linear, we have that Problem (9a)-(9e) is a special case of the scenario optimization Problem 2. Thus, the result follows through a direct application of Theorem 1.
This result provides a probabilistic generalization guarantee for the online algorithm that utilizes the solution of the offline learning Problem (9a)-(9e) on unseen test instances. The key to establishing the above result lies in the choice of the parametric class A that yields a problem that is conducive to the application of the scenario approach generalization guarantee (Theorem 1). To ensure that the learning problem is sufficiently simple for optimization, we developed a parametric class with a small number of decision variables.
Finally, we note that the competitive ratio obtained through the solution of Problem (9a)-(9e) provides an upper bound on the best achievable competitive ratio since we have chosen a specific algorithm parametrization in Problem (9a)-(9e).
Extension to Time-Dependent Algorithm. In the following, we elucidate an extension of Algorithm 2 to the time-dependent setting where the probability of allocating users varies with the change in the user arrival rates. The motivation for considering the time-dependent setting stems from the time dependency of the arrival process of users in typical traffic routing applications. Thus, we consider the class of algorithms A parametrized by vectors p j θ ∈ R M for each value-of-time θ ∈ Θ and time interval j ∈ [q] for some q ∈ N. Here p j θa for each arc a ∈ [M ] and time interval j ∈ [q] represents the probability that a user with a valueof-time of θ is allocated to arc a during time interval j. Note that we can write a linear program similar to Problem (9a)-(9e) to compute the optimal allocation probabilities p j θ offline. The learned parameters can then be used to make online allocations in an analogous manner to that of the time-independent data-driven algorithm presented in Algorithm 2. In particular, when a user i with a value-of-time θ i arrives during time interval j, i.e., τ i ∈ [µ j , µ j+1 ) for 0 ≤ µ j < µ j+1 , then the user is allocated to arc a with probability p j θia . Finally, we note the following key observations regarding the time-dependent parametrization that highlight the risk and offline objective value properties in this setting. Remark 1. Following a similar reasoning to that used in the proof of Corollary 1, the linear program used to compute the allocation probabilities p j θ can be shown to be a special case of the scenario optimization Problem (2). As a result, the theoretical bounds on the risk obtained in Corollary 1 extend to this setting as well.
Remark 2. The optimal objective value α * T of the linear program to compute the time-dependent allocation probabilities is at most the optimal objective value α * of the linear Program (9a)-(9e) to compute time-independent allocation probabilities. This follows since a special case of the time-dependent allocation probabilities corresponds to the time-independent setting when the allocation probabilities for the different time intervals are exactly the same, i.e., p j θ = p j θ for all time intervals j, j ∈ [q]. As a result, the timedependent allocation achieves superior performance as compared to the time-independent allocation when comparing the objective value of their corresponding offline linear programs. That is, the empirical competitive ratio on the training instances for the time-dependent allocation probabilities can never be more than that corresponding to the time-independent allocation probabilities, i.e., α * T ≤ α * .
Remark 2 highlights that the time-dependent algorithm is guaranteed to have a superior performance as compared to the time-independent algorithm on the training set. However, the generalization of the insample performance guarantees of both algorithms to unseen sequences depends on the number of support constraints, which we determine through numerical experiments in the next section.

Numerical Comparison of Data Driven and Greedy Algorithms
We now evaluate the performance of the data-driven approach for both the time-independent (Algorithm 2) and time-dependent (see Section 4.4) parameter learning settings through numerical experiments. To this end, we first numerically validate the theoretical bounds on the level of risk obtained in Corollary 1 through an analysis of the number of support constraints corresponding to the offline parameter learning problem. Furthermore, to gauge the efficacy of the data-driven algorithms, we compare their performance to that of the greedy algorithm by analyzing the distribution of the ratio between the algorithm cost to that of the optimum offline solution on unseen input sequences. The interest for comparing the performance of these algorithms to the greedy algorithm is both theoretical and practical. On the theoretical front, the greedy algorithm serves as a benchmark since it has the lowest ratio between the online and offline solutions amongst all deterministic algorithms for a two-arc parallel network. On the applied front, state-of-the-art traffic navigational applications often route users using a greedy algorithm [2].
In the following, we first define the uncertainty set on which we built our input sequences I (Section 5.1). Then, we introduce our experimental design, based on an application case of the San Francisco Bay Area, CA (Section 5.2). Finally, we present numerical results (Section 5.3) for both this application setting and a range of synthetic scenarios to investigate the performance of the data-driven and greedy algorithms for different user arrival profiles that may be encountered in practice.

Definition of the Uncertainty Set and Time-Dependent Data-Driven Algorithm
Given a fixed parallel transportation graph with specified arc capacities and travel times, the sources of uncertainty that completely define an input sequence are the users' arrival times and their values of time. Thus, we represent an input sequence I as an n × 2 dimensional matrix with an arrival time and a valueof-time for each of the n users. To model typical traffic routing applications wherein the user arrival rate varies at different times of the day we create input sequences as follows.
1. When a user arrives into the system, she has a value-of-time θ ∈ Θ with a known probabilityp θ . We further have that θ∈Θp θ = 1.

Experimental Design
The performance of both the data-driven algorithms as well as the greedy algorithm depends on the specific parameters of the underlying problem instance. To design a numerical experiment that reflects a realistic application, we proceed as follows: first, we derive a representative instance based on real-world data. Then, to solve the offline linear programs corresponding to both data-driven algorithms we transform these instances to create a scaled representation of the real-world scenarios. Note that scaling travel times and users' values of time is without loss of generality because the ratio ALG(I,A) OP T (I) will remain unchanged as the objective function of Problem (1a)-(1d) is linear. Next, we reduce the size of the instances to 120 users only for the purposes of the case study so that we can quickly generate solutions for many scenarios with low computational effort. We note that we can also train the algorithm on larger sized instances, e.g., 100 instances with 500 users, within a time span of a few minutes. Furthermore, we note that due to the nature of the algorithm parametrization, the algorithm can readily be applied online to larger test instances without losing its computational efficiency. We further expect by the law of large numbers that our results in the scaled setting will provide good insights for larger problem instances, since user arrivals are stochastic. Finally, we create additional instances by varying the arrival profiles of users to create other meaningful scenarios.

Representative scenarios.
We derive representative instances based on data from the the San Francisco Bay Area for travel on major highways ( Figure 1). In particular, we consider three alternative routes, which we derive based on traffic data from TomTom [36], and select the routes with the minimum (green route), median (blue route), and maximum (red route) travel times between the respective origin-destination pair. Table 2 presents the travel times of these routes. We note here that the parallel network abstraction is generally a good first-order approximation for highway commuting [14], which is considered in the traffic routing application depicted in Figure 1.
To derive user arrival rates, we used data from the Caltrans PeMS database 1 to obtain representative user flow rates at different points along the sections of the routes corresponding to the three highways depicted in Figure 1. The user flow rates presented in Figure 2 are derived for the morning rush on Tuesday, July 6, 2021 for the following sections of the three freeways -(i) South Airport Blvd. for the US-101N freeway (Route 1), (ii) Westborough Blvd. for the I-280N freeway (Route 2), and (iii) Tennyson Rd. for the I-880 freeway (Route 3). We note that the user flow rate data represents a typical pattern of user flows during the morning rush for each of the three freeways.

Parameter transformation.
We now transform both scenarios into a scaled representation by (i) scaling users' values of time and the arc travel times and (ii) adjusting the arc capacity and user arrival rates based on the scaled travel times. Our transformation is as follows.
To derive representative values of time for different users, we use the minimum, median, and maximum income levels in the San Francisco Bay Area [37]. In particular, we consider three user types and normalize each user type's value-of-time as shown in Table 1, such that Note that we take the income of users as a surrogate representation of user's values of time. While a range of other value-of-time representations could have been chosen, we assume a proportionality between the value-of-time and income level of users for simplicity. Doing so enables us to capture a range of user values of time that are likely to be observed in practice since values of time tend to increase with the income level of users [38]. We further assume that the share of the population belonging to each value-of-time is given by specified quantile cutoffs. We set these cutoffs based on the average of the minimum and median incomes and the average of the median and maximum incomes. We round the data in Table 1    For the numerical experiments, we consider a population of 120 users. Accordingly, we set the capacity of the slowest route to 120 (see Table 2) to ensure the system's feasibility and scale the real-world travel times such that the ratio of the costs t j closely matches the ratios of the real-world travel times for each scenario. Finally, we set the user arrival rate and throughput for the first two routes. To do so, we first note that the first two routes are the predominantly used ones, as their travel times are much lower compared to the third route. Since we have two degrees of freedom, arrival rate and vehicle throughput, we fix the vehicle throughput on the first two routes to one vehicle per time unit. Note that setting the same throughput value for the first two routes is reasonable since the highways connecting San Jose and San Francisco have similar capacities [39]. To achieve this throughput, we set capacities as given in Table 2. Next, to set the arrival rates, we consider the period of the morning rush on weekdays wherein the throughput pattern can be modelled as step function with constant user arrival rates during each time period, cf. Figure 2. In particular, we average the vehicle flows depicted in Figure 2 across the three routes for each hour interval and set the flow rate of vehicles between the time interval 5 − 6a.m. as 1.2 vehicles per time unit and scale the width of each time interval to represent fourteen time units, i.e., µ j+1 − µ j = 14 for all j ∈ {1, 2, 3, 4}. Note that this represents an under-congested condition since the arrival rate of users in this time period is lower than the combined throughput of the first two routes. We then scale the remaining flow rates for the other time intervals as: Average Flow rate in time interval j Average Flow rate between 5 − 6a.m. × 1.2

Additional Scenarios.
Since the above scenario only captures a limited set of parameters, we additionally explore a broader range of arrival rates that capture traffic patterns beyond the one considered above. In particular, we model the flow of traffic through the course of an entire day by modelling both the morning and afternoon peaks and consider the following arrival rate scenarios as depicted in Table 3. In particular, the five scenarios represent (i) a constant arrival rate, (ii) a high rush hour arrival rate, (iii) a low rush hour arrival rate, (iv) a higher afternoon peak arrival rate, and (v) a higher morning peak arrival rate. For completeness, we also summarize the arrival rate profile of the above described highway scenario.

Results
Assessment of Theoretical Risk Bounds. We now assess the theoretical bounds on the risk established in Corollary 1 for both the time-dependent and time-independent data-driven algorithms for the scenarios listed in Table 3. To this end, we first determined the number of support constraints corresponding to the offline learning problem, i.e., Problem (9a)-(9e) for the time-independent data-driven algorithm and the analogous problem for the time-dependent data-driven algorithm. We then evaluated the solution of the polynomial Equation (10) for the parameter β = 10 −6 , the number of training instances K = 100 and the above determined number of support constraints. Having derived the theoretical upper and lower bounds on the risk, we then found the percentage of test instances for which either the competitive ratio constraint or the capacity constraints were violated for each of the scenarios in Table 3. A total of 100 test instances were considered for each scenario. Figure 3 depicts for both the time-dependent and time-independent algorithms that the risk, i.e., the probability of constraint violation, on the test instances was within the specified theoretical bounds on the risk as obtained in Corollary 1. We further note from Figure 3 that both the theoretical bounds on the risk as well as the empirically observed proportion of constraint violation are lower for the time-independent data-driven algorithm. This observation implies a trade-off between the optimal offline objective, which is guaranteed to be lower for the time-dependent data-driven algorithm (see Remark 2), and the risk of the optimal parametrization, which is higher for the time-dependent data-driven algorithm.
Performance Comparison between Algorithms. We now investigate the performance of the two datadriven algorithms and that of the greedy algorithm. To provide an equal footing to compare the data-driven and greedy algorithms, we implement discrete allocations corresponding to the learned allocation probabilities from the optimal offline objectives in both the time-dependent and time-independent cases. In particular, for each user we generate a uniform random number between zero and one and assign a quantile range to each arc corresponding to the optimal allocation probabilities based on the value-of-time (and time of arrival) of that user. Then, we implement discrete allocations by assigning each user to the arc for which the uniform random number lies within its quantile range. As an example, suppose we have one user and two arcs, each  Table 3. Here TI and TD represent the results for the time-independent and time-dependent algorithms, respectively. The red and the green bars represent the proportion of instances for which either the competitive ratio constraint or any of the capacity constraints is violated, while the other bars represent the theoretical lower bounds (LB) and upper bounds (UB) on the level of risk as calculated through the number of support constraints for the two algorithms on each of the instances. The dark blue bar representing the theoretical lower bound on the risk for each of the instances and the level of risk on the fifth instance of the time-independent algorithm is infinitesimally close to 0 and so is not visible.
with allocation probability 0.5. Then, we can denote the quantile range for the first arc as [0, 0.5) and that of the second arc as [0. 5,1]. If the uniform random number is 0.6, then the user is assigned to the second arc.
To present the results, we denote the time-independent and time-dependent data-driven algorithms, which are based on the scenario approach as "TI" and "TD" respectively, while we denote the greedy algorithm as "Greedy". Figure 4 depicts histograms that represent the distribution of total travel cost of the online solution and that of the optimal offline solution on the test instances. All experiments presented in this section were trained on 100 instances and their performance was evaluated on 100 test instances. In the following, we provide a detailed analysis of the results in Figure 4.
For each of the six scenarios, Figure 4 depicts that the ratio between the online and optimal offline solutions of the greedy algorithm has a distribution that is to the right of the corresponding distributions of the data-driven algorithms. Accordingly, both data-driven approaches outperform the greedy algorithm for each of the tested scenarios, since the greedy algorithm tends to achieve generally higher costs. The data-driven algorithms achieve lower total costs since they take into account the impact of routing a given user on the total travel cost. On the other hand, the greedy algorithm only takes local information into account and may allocate some users with the highest value-of-time to arc three, i.e., the highest cost arc, when both the optimal offline solution and the data-driven algorithm allocated those users to lower cost arcs.
Next, we compare the performance of the two data-driven algorithms on the test instances. To this end, first note from Figure 4 that the distribution of the ratio between the online and optimal offline solutions of the time-independent data driven algorithm is generally to the right of that of the time-dependent datadriven algorithm. This indicates the superior performance of the time-dependent data-driven algorithm, which can be expected since it allocated users with different probabilities as the user arrival rate changes, which is not the case with the time-independent algorithm. The slightly higher ratio of the right tail of the distribution between the online and optimal offline solutions of the time-dependent algorithm in Scenario 2 (cf. Figure 4) is attributable to the higher level of risk of the time-dependent algorithm, as was observed in the earlier theoretical validation of the risk bounds. However, other than in Scenario 2 even the right tail of the distribution of the ratio between the online and optimal offline solutions of the time-dependent data driven algorithm is lower than that of the time-independent algorithm. The aforementioned observation  holds despite the fact that the generalization guarantee for the time-dependent algorithm is worse than that of the time-independent algorithm, since the risk of the former is lower than that of the latter on the test instances.
To summarize, Figure 4 indicates that the time-dependent algorithm achieves the best performance while the greedy algorithm achieves the highest ratios between the online and optimal offline solutions, thereby highlighting the value of prior information in online algorithm design. Furthermore, the results indicate that despite a superior probabilistic generalization guarantee, i.e., a lower probability of constraint violation on unseen sequences, for the time-independent algorithm, the right tail of the distribution of the ratios between the online and optimal offline solutions of the time-dependent algorithm is either slightly higher or strictly lower than that of the time-independent algorithm. The superior numerical performance of the timedependent algorithm despite the better generalization guarantee of the time-independent one thus points towards the importance of the ability to adjust allocations based on changes in user arrival rates.

Conclusions and Future Work
This paper studied online traffic routing from a competitive analysis as well as a data-driven perspective. We studied both the adversarial and stochastic user arrival settings for the OTR problem. For the adversarial model of user arrivals, we showed that the greedy algorithm achieves a competitive ratio of one for the two-arc OTR-I problem. We then established that in extended variants of the two-arc OTR-I problem, the worst-case ratio between the total travel cost of the online solution of any feasible deterministic algorithm and that of the optimal offline solution is unbounded. In the stochastic setting, we presented both time-independent and time-dependent data-driven algorithms, which leverage the scenario approach, and established bounds on the the probability of constraint violation of the optimal parametrizations computed through these algorithms on unseen test instances. Finally, we presented numerical experiments based on an application case of the San Francisco Bay Area and compared the data-driven and greedy algorithms' performance. In particular, our results indicate that both the time-independent and time-dependent data-driven algorithms outperform the greedy algorithm, highlighting the value of prior information in online algorithm design. Furthermore, we observe that the time-dependent algorithm generally has better performance as compared to the timeindependent one despite a superior probabilistic generalization guarantee of the time-independent algorithm.
There are various directions for future research. First, it would be worthwhile to investigate the tractability and generalizability of the data-driven approach in road networks beyond the parallel network setting considered in this work. Furthermore, it would be interesting to investigate any theoretical underpinnings that explain the superior numerical performance of the time-dependent algorithm despite a superior probabilistic generalization guarantee of the time-independent algorithm. Finally, it would be worthwhile to extend the probabilistic generalization guarantee of the data-driven algorithm that makes fractional allocations to the setting of discrete allocations.
[38] Thomas C Thomas and Gordon I Thompson. The value of time for commuting motorists as a function of their income level and amount of time saved. Highway Research Record, (314), 1970.

A Proofs
For notational convenience, we drop the superscript I in N I a,A , the number of users in instance I that are allocated on arc a by Algorithm A, and note that the proofs presented in this section hold for all instances I ∈ Ω.

A.1 Proof of Lemma 1
We can evaluate the total cost C A of algorithm A as: Note that this is equivalent to the objective function (1a), with θ i = 1 for all agents i. We now consider a feasible algorithm A that satisfies Constraints (1b)-(1d). We first note that the number of people that must be allocated under A and A must be equal: To prove the lemma we first consider a simplified case with two arcs, which we then extend to the more general case with M arcs.
Two arc Case: For algorithm A we denote the total number of people allocated to arc 1 as N 1,A and the number allocated to arc 2 as N 2,A . Then the total number of people in the system is N = N 1,A + N 2,A . The total cost of algorithm A can then be written as: Using the property of algorithm A that N 1,A ≥ N 1,Ā for any feasibleĀ it holds for A that N 1,A −N 1,A ≥ 0, and follows. Since both A and A allocate the same number of users, we have N 1,A + N 2,A = N 1,A + N 2,A , which implies that: Thus, we have established for the two-arc case that C A ≤ C A for all feasible algorithms A .
Multiple arc Case: We now generalize this proof strategy to a parallel road network with M arcs. We first observe from the definition of an algorithm's total cost that: Next, for any feasible algorithm A we can rewrite this expression as: Then, observing that N 1,A ≥ N 1,A , we obtain: Now, we can repeat this process and use that k a=1 N a,A ≥ k a=1 N a,A ∀k ∈ [M ] to get a chain of inequalities, which gives: Finally, observing that M a=1 N a,A = M a=1 N a,A , we observe: This his establishes that for the M -arc case that C A ≤ C A for all feasible algorithms A .

A.2 Proof of Lemma 2
We first note that Algorithm 1, denoted as A, certainly satisfies Constraints (1b)-(1d). This is because Algorithm 1 routes each user on exactly one arc, such that the arc is used below capacity at the time of arrival of each user i. For the remainder of this proof we denote arc one as a 1 and arc two as a 2 , where t 1 < t 2 . Note that if t 1 = t 2 then any feasible algorithm is optimal since all customers incur the same travel time.
To prove our claim, we proceed by induction on the number of users that are allocated by Algorithm 1 on a 2 . Note that if Algorithm 1 allocates all users to a 1 then it is clearly optimal. Thus, for the base case suppose that Algorithm 1 routes one user on the second arc. We will now show that if Algorithm 1 allocates the q'th arriving user on a 2 then any other feasible algorithm A must allocate at least one of the first q users on a 2 . To prove this claim, we proceed by contradiction. In particular, we assume that there is some feasible algorithm A that allocates none of the first q users to a 2 . This implies that the first q − 1 users must be allocated by algorithm A on a 1 . Note that Algorithm 1 also allocates the first q − 1 users on a 1 . Next, since Algorithm 1 allocated the q'th arriving user to a 2 it must hold that a 1 is at capacity at the time user q arrives; otherwise Algorithm 1 would have allocated user q on a 1 . This establishes our claim that algorithm A must allocate at least one of the first q users to a 2 . Finally, as Algorithm 1 only allocates one user on a 2 , it follows that N 1,A ≥ N 1,A , as any other feasible algorithm also allocates at least one user to a 2 . This establishes the base case.
For the inductive step, we assume that if k users are allocated by Algorithm 1 on a 2 , then any other feasible algorithm A must also allocate at least k users on a 2 . As established for the base case, we further assume that for each of the k users q 1 , ..., q k allocated on a 2 by Algorithm 1, there is a corresponding user q l ≤ q l for each l ∈ [k] that is allocated to a 2 by any other feasible algorithm. Now, suppose that Algorithm 1 allocates k + 1 users on a 2 . In this case, we first consider the subset of the users in the system up until the q k 'th user is routed by Algorithm 1 on a 2 . For this subset of users, we observe from the inductive assumption that any feasible algorithm A must route at least k usersq l for l ∈ [k] on a 2 such thatq l ≤ q l for each l ∈ [k].
Given the above observations, we now prove the inductive step by contradiction. In particular, we suppose that there exists a feasible algorithm A that only allocates k users on a 2 . This implies that every user after theq k 'th user is allocated on a 1 by algorithm A . Note that this allocation is exactly the same as the allocation of Algorithm 1 for users between but not including q k and q k+1 on a 1 . Next, since Algorithm 1 allocated the q k+1 'th arriving user to a 2 it must hold that a 1 is at capacity at the time user q k+1 arrives. Finally, sinceq k ≤ q k it follows that A must allocate at least one of the users betweenq k and q k+1 on a 2 to remain feasible, i.e., avoid violating the capacity constraint. Thus, algorithm A allocates at least k + 1 users on a 2 , which establishes that N 1,A ≥ N 1,A when k + 1 users are allocated by Algorithm 1 on a 2 . This establishes the inductive step.

A.3 Proof of Lemma 3
To prove this lemma, we consider a three arc network where the cost of arc three is arbitrary and note that the proof can be generalized to any M arc network for M ≥ 3. We denote the three arcs in the network as a 1 , a 2 , and a 3 respectively.
We will show that an adversary can construct input sequences such that any feasible deterministic algorithm will allocate users on arc a 3 , while the optimal allocation is to assign users to the first two arcs. Since an adversary can choose the cost of a 3 to be arbitrarily large, this establishes that the ratio between the total travel cost of the online solution of any deterministic algorithm and that of the optimal offline solution is unbounded for the M ≥ 3 arc OTR-I problem.
We first fix a three arc parallel network, where the arc capacities are c 1 = 1, c 2 = 1, c 3 = 10, and the arc costs are t 1 = 5, t 2 = 10.01, while t 3 is the cost of arc three that is strictly greater than t 2 . Note that in any such three arc network a feasible deterministic algorithm A must allocate the first arriving user on one of the three arcs. We now analyze each of these cases in turn.
Case (i): Suppose A allocates the first arriving user to a 3 . Then an adversary can construct an input sequence such that only one user arrives in the system. Since the optimal allocation is to assign this user on a 1 , the ratio between the cost of A and that of the optimal allocation is t3 t1 .
Case (ii): Suppose A allocates the first arriving user to a 2 . Then consider the following input sequence, where user one arrives at time 0, user two arrives at time 10, and user three arrives at time 10.001. Note that an optimal allocation for this input sequence is to allocate users one and two on a 1 , and user three on a 2 . That is, the optimal allocation does not allocate a user on a 3 . However, since A allocates user one on a 2 , it must be that either one of users two or three is allocated on a 3 . To see this, we note that at the time both users two and three arrive, user one is still on a 2 since the travel time of a 2 is strictly greater than the arrival time of user three. Since the capacity of both a 1 and a 2 are one, it must be that A allocates at least one of the last two users on a 3 . Thus, we have that the ratio of the cost of A to that of the optimal allocation is at least t1+t2+t3 2t1+t2 .
Case (iii): Suppose A allocates the first arriving user to a 1 . Then consider the following input sequence, where user one arrives at time 0, user two arrives at time 0.15, user three arrives at time 5.2, and user four arrives at time 10.1. Note that an optimal allocation for this input sequence is to allocate user one on a 2 , users two and three on a 1 , and user four on a 2 . That is, the optimal allocation does not allocate a user on a 3 . However, since A allocates user one on a 1 , it must be that at least one of the last three users is allocated on a 3 . To see this, we note that A cannot allocate user two to a 1 since user one occupies a 1 between the time period [0, 5] since the cost of a 1 is 5. Thus, A must either allocate user two to a 2 or a 3 . If A allocates user two to a 3 this will lead to an unbounded ratio of the total travel cost of the online solution to that of the optimal offline solution since an adversary can choose the travel time of a 3 to be arbitrarily large. Thus, we consider the case when A allocates user two to a 2 . Now, we observe that one of the users three or four must be allocated to a 3 since both users' arrival time is before the departure of user two from a 2 . Since the capacity of both a 1 and a 2 are one, A must allocate at least one of the last two users on a 3 . Thus, we have that the ratio of the cost of A to that of the optimal allocation is at least 2t1+t2+t3 2t1+2t2 . Note that since t 1 ≤ t 2 ≤ t 3 , it follows that t3 t1 ≥ t1+t2+t3 2t1+t2 ≥ 2t1+t2+t3 2t1+2t2 . Thus, the ratio of the total travel cost of the online solution of any deterministic algorithm to that of the optimal offline solution is at least 2t1+2t2 . Finally, we note that this ratio is unbounded since an adversary can choose the travel time t 3 to be arbitrarily large for fixed values of t 1 and t 2 .

A.4 Proof of Lemma 4
To prove this theorem, we restrict our attention to a setting with two user values of time and note that the proof can be generalized for more than two values of time of users. This is because the ratio between the online and the optimal offline solution only depends on the largest and smallest user values of time.
Notation: We first introduce the notation to define the cost of routing users in the network. Let N a,A,k and N a,OP T,k be the number of users with a value-of-time k ∈ {θ , θ } that are routed on arc a by algorithm A and the optimal offline solution respectively. Then for a two arc parallel network, the total cost for any feasible algorithm that satisfies Constraints (1b)-(1d) is given by: In this setting, the competitive ratio for any algorithm A on an input sequence I can be denoted as follows: Here it must hold that: N 1,OP T,θ + N 2,OP T,θ = N θ = N 1,A,θ + N 2,A,θ and N 1,OP T,θ + N 2,OP T,θ = N θ = N 1,A,θ + N 2,A,θ , since the number of users with the same value-of-time for the input sequence I is fixed.
Lower Bound on Worst-Case ALG(I,A)

OP T (I)
Ratio of Deterministic Algorithms: To show that no deterministic algorithm can perform better than the ratio of ALG(I,A) OP T (I) = θ t2+θ t1 θ t1+θ t2 , we consider an instance of two parallel arcs, each having a capacity of 1, i.e., c 1 = 1 = c 2 . Suppose an adversary creates an instance where the first arriving user has a value-of-time θ . Then a deterministic algorithm can either allocate this user to arc one (a 1 ) or arc two (a 2 ).
First, suppose that a deterministic algorithm allocates the user on a 1 with a cost t 1 ≤ t 2 . Then an adversary can construct an instance such that the second user has value-of-time θ and arrives at time > 0, where < t 1 . For this instance, a deterministic algorithm must allocate the second user on a 2 with a higher cost of t 2 . For this input the cost of a deterministic algorithm is θ t 2 + θ t 1 ; however the cost of the optimal allocation would have been θ t 1 + θ t 2 , which would result from allocating the user with value-of-time θ on a 1 and the user of type θ on a 2 . Thus, for this instance I, ALG(I,A) OP T (I) = θ t2+θ t1 θ t1+θ t2 . On the other hand, suppose that a deterministic algorithm allocates the first user of type θ on a 2 . Then an adversary can construct an instance of just one user, i.e., no further users arrive into the system. For this instance I, ALG(I,A) OP T (I) = t2 t1 ≥ θ t2+θ t1 θ t1+θ t2 since the optimal algorithm would have allocated the user on a 1 . Thus no deterministic algorithm can obtain a lower ratio of ALG(I,A) OP T (I) than θ t2+θ t1 θ t1+θ t2 .
Greedy Achieves the Lower Bound on the ALG(I,A) OP T (I) Ratio for Deterministic Algorithms: Now, to see that the greedy algorithm A achieves this competitive ratio for any network parameter set S, we will prove that for any instance I that ALG (I,A) OP T (I) ≤ θ t2+θ t1 θ t1+θ t2 . To prove this, we start from the definition of the competitive ratio of the greedy allocation, A, to the optimal allocation, OP T : ALG(I, A) OP T (I) = θ N 1,A,θ t 1 + θ N 1,A,θ t 1 + θ N 2,A,θ t 2 + θ N 2,A,θ t 2 θ N 1,OP T,θ t 1 + θ N 1,OP T,θ t 1 + θ N 2,OP T,θ t 2 + θ N 2,OP T,θ t 2 Note that since the number of users belonging to the two values of time are fixed at N θ and N θ the above expression can be written as: The above equation holds since N 1,A,k + N 2,A,k = N k and N 1,OP T,k + N 2,OP T,k = N k for k ∈ {θ , θ }. We now seek for the maximum possible ratio ALG(I,A) OP T (I) for any instance, subject to the constraint that as the greedy algorithm will allocate at least as many users as OP T does on the first arc, i.e., the arc with a lower cost as t 1 ≤ t 2 . This follows from the result of Lemma 2.
To find an upper bound on the maximum ratio of ALG(I,A) OP T (I) , we first note that the inequality N 1,A,θ + N 1,A,θ ≥ N 1,OP T,θ + N 1,OP T,θ must be met with equality. This is because if then the numerator could be strictly increased or the denominator could be strictly decreased whilst maintaining This also implies that the number of users allocated to arc two are the same. From the above discussion, we have that the number of users allocated on arcs a 1 and a 2 are equal for both the greedy algorithm as well as OP T to maximize the ratio of ALG (I,A) OP T (I) . Thus, the maximum ratio of ALG (I,A) OP T (I) is achieved when the high value-of-time users are allocated on a 2 by the greedy algorithm while the same users are allocated on a 1 by the optimal offline solution. Note that if even one high value-of-time user was allocated on a 1 then the bound for the competitive ratio would only be lower. This is because ALG(I, A) would be smaller. Next, for each high value-of-time user we must have at least one low value-oftime user that is allocated by the greedy algorithm on a 1 . Since the number of users on a 1 and a 2 are the same, we have that: The above ratio is identical to: a+b c+b , where b = θ (N θ − N 1,A,θ )t 2 , and a ≥ c as ALG(I,A) OP T (I) ≥ 1. Taking the derivative of a+b c+b with respect to b, we get c−a (c+b) 2 ≤ 0. Due to the sign of the derivative, the maximum is attained when b = 0, i.e., N θ = N 1,A,θ , which implies that: Now, since we have N θ = N θ + N 1,OP T,θ , we get that: Taking the derivative of the above equation with respect to N θ , we get that the derivative is negative, and, since N θ = N θ + N 1,OP T,θ , the maximum ratio is achieved when N θ = N θ . Thus, we get that: This gives us that: which proves our claim that for any instance I that ALG(I,A) OP T (I) ≤ θ t2+θ t1 θ t1+θ t2 . This establishes that the competitive ratio of greedy is θ t2+θ t1 θ t1+θ t2 , since the competitive ratio of no deterministic algorithm can be lower than this. As a result we have established that the greedy algorithm as presented in Algorithm 1 is the optimal deterministic algorithm, i.e., it achieves the best possible competitive ratio of θ t2+θ t1 θ t1+θ t2 amongst all deterministic algorithms.

A.5 Proof of Lemma 5
To prove the lemma, we consider a series parallel road network as depicted in Figure 5, where the cost t 4 of arc L 4 can be arbitrary and the capacities of L 2 and L 4 can be large, e.g., 10 users can concurrently use each of L 2 and L 4 . We consider a deterministic algorithm that allocates the first arriving user on arcs (i) L 1 , L 4 or L 2 , L 4 , i.e., a route containing arc L 4 , (ii) L 1 , L 3 , and (iii) L 2 , L 3 . We show that in each of these cases, there is an input sequence for which a deterministic algorithm will allocate at least one user on arc L 4 while the optimal offline allocation will not allocate users on arc L 4 . Since the cost of arc L 4 can be made arbitrarily large, the ratio of the cost of any deterministic algorithm to the optimal offline solution is unbounded. Case (i): First, suppose that a deterministic algorithm allocates the user arriving at time 0 on a route containing arc L 4 ; then, an adversary can consider an input of just one user, i.e., no further users enter the system. For this one user, the optimal offline algorithm would have allocated the user on the arcs L 1 , L 3 . Since the user is allocated on a route consisting of arc L 4 , the ratio of the cost between such a deterministic algorithm and the optimal offline solution is unbounded.
Case (ii): Next, suppose that a deterministic algorithm allocates the user arriving at time 0 on arcs L 1 , L 3 . Then an adversary can construct an input sequence where user one arrives at time 0, user two arrives at time and user three arrives at time 1 + , where < < 1 ≤ 0.1. Note that 3 + 1 is the cost of arc L 2 . With this input a deterministic algorithm, having to satisfy the feasibility constraints (16b)-(16d), will have to allocate one of users two or three onto L 4 . On the other hand, the optimal offline solution would allocate the first user to arcs L 2 , L 3 , user two on arcs L 1 , L 3 and user three on arcs L 2 , L 3 , and thus never use arc L 4 . Thus, the ratio of the cost between such a deterministic algorithm and the optimal offline solution is unbounded.
Case (iii): Finally, suppose that a deterministic algorithm allocates the user arriving at time 0 on arcs L 2 , L 3 . An adversary can then construct an input sequence wherein user two arrives at time 1 − for ≤ 0.1. If a deterministic algorithm allocates this user on L 2 , she must be routed on L 2 , L 4 to ensure feasibility because L 3 has a capacity of one. On the other hand, if the second user is allocated on a route containing L 1 , she must be allocated to route L 1 , L 4 . This is because user one uses L 3 for the time period [3 + 1 , 4 + 1 ], which coincides with the time at which user two exits L 1 . Thus, the second user cannot use L 1 , L 3 and will be allocated to L 1 , L 4 . On the other hand, the optimal offline solution would allocate user one on L 1 , L 3 and user two on L 2 , L 3 , thereby never using L 4 . Thus, the ratio of the cost between such a deterministic algorithm and the optimal offline solution is unbounded.

A.6 Proof of Lemma 6
To prove this lemma, we consider a two arc network with arcs a 1 , a 2 that have capacities c 1 = 2 and c 2 = 1. Furthermore, we let the cost of arc two be a constant f 2 (x) = 10.01, and so f 2 (1) = 10.01. Next, we let the cost of arc one be defined by a function such that f 1 (1) = 5 and f 1 (2) =d, whered can be chosen by an adversary. Note that a linear function f 1 that passes through the points (1, 5) and (2,d) will suffice.
We will show that an adversary can construct input sequences such that any feasible deterministic algorithm A will allocate two users simultaneously on arc a 1 to incur a costd, while the optimal allocation is to assign users such that no two users concurrently use arc one. As a result, the ratio of the cost between any deterministic algorithm and the optimal offline solution is unbounded.
Since in any such two arc network a feasible deterministic algorithm A must allocate the first arriving user on one of the two arcs, we consider two cases.
Case (i): Suppose A allocates the first arriving user to a 2 . Then consider the following sequence, where user one arrives at time 0, user two arrives at time 10, and user three arrives at time 10.001. Note that an optimal allocation for this sequence is to allocate user one on a 1 , user two on a 1 , and user three on a 2 . Since user one departs from the system before user two arrives, the optimal allocation does not allocate two users concurrently on a 1 . However, since A allocates user one on a 2 , it must hold that both users two and three are allocated on a 1 . To see this, we note that at the times users two and three arrive, user one is still on a 2 since the travel time of a 2 is strictly greater than the arrival time of user three. Since the capacity of a 2 is one, it must hold that A allocates both users two and three on a 1 . Sinced can be arbitrarily large, we have that the ratio of the cost of such a deterministic algorithm to that of the optimal offline solution is unbounded.
Case (ii): Suppose A allocates the first arriving user to a 1 . Then consider the following input sequence, where user one arrives at time 0, user two arrives at time 0.015, user three arrives at time 5.02, and user four arrives at time 10.01. Note that an optimal allocation for this input sequence is to allocate user one on a 2 , users two and three on a 1 , and user four on a 2 . Again, as with case (i), the optimal allocation does not allocate two users concurrently on a 1 . However, since A allocates user one on a 1 , it must be that at least two of the last three users are concurrently allocated on a 1 . To see this, we note that if A allocates the second arriving user on a 1 , then we have two users concurrently occupying a 1 thereby incurring an arbitrarily large cost. Thus, we consider the case when A allocates user two to a 2 . Now, we observe that both users three and four must be allocated to a 1 since both users' arrival time is before the departure of user two from a 2 . Since the capacity of a 2 is one, it must be that A allocates both of the last two users on a 1 . Thus, again we have that the ratio between the total travel cost of the online solution of A to that of the optimal allocation is unbounded sinced can be arbitrarily large.

B.1 Extending OTR Problem to General (Non-Parallel) Road Networks
In this section, we present a generalization of the OTR problem for parallel networks to the setting of general road networks. To model a general road network, we consider a directed graph G = (V, E), where V is its set of vertices and E is its set of edges. Travelling through arc a ∈ E requires t a time units, and each arc a has a capacity c a . We collect these parameters in S := {{c a } a∈E , {t a } a∈E }. We denote an input sequence of n users by I := {{θ i } i∈[n] , {τ i } i∈[n] , {w i } i∈[n] }, stating for each user i its time of appearance τ i ∈ R ≥0 , its value-of-time θ i ∈ Θ, where Θ is finite, and its origin destination pair w i ∈ W . Each origin destination pair w ∈ W has R w routes and each route r ∈ R w is specified by an ordered sequence of l edges {e r 1 , e r 2 , ..., e r l }. Here edge e r 1 is a directed edge starting at the origin node of w and edge e r l is a directed edge ending at the destination node of w. With this notation, the Online Traffic Routing (OTR) problem for general road networks is as follows.
Problem 2. (Online Traffic Routing (OTR) for General Road Networks) Let the parameter set S and an input sequence I define a problem instance. Users arrive sequentially in the system and must be irrevocably assigned to a route r ∈ R wi at their time of appearance τ i . The number of users concurrently traversing an arc is limited to the capacity c a of the arc, and each user traverses an arc a for t a time units. Then, the OTR problem for general road networks is to construct an assignment of users to routes such that the total cost or time that users spend to traverse their routes is minimal.
If all users are identical, i.e., θ i = θ i for each i, i ∈ [n], we refer to this problem variant as OTR-I for general road networks.
We evaluate the efficacy of an algorithm A that solves Problem 2 via its competitive ratio and say that an algorithm is α-competitive if CR(A) ≤ α. Here OP T (I) denotes the optimal offline solution to the OTR problem for general road networks and ALG(I, A) denotes the online solution achieved by algorithm A on input sequence I. The input instances I belong to a set Ω, which corresponds to user arrivals such that θ i ≥ 0 for all users i and τ i ≥ 0, with the first user arriving at time 0. We further assume without loss of generality that τ 1 = 0 < τ 2 < ... < τ n , i.e., no two users arrive in the system at the same point in time.
We compute OP T (I) by solving the following optimization problem.
|Rw| r=1 x ir = 1 ∀i ∈ [n] (16b) x ir ∈ {0, 1}, ∀r ∈ [|R wi |, ∀i ∈ [n]] (16c) n i=1 r:a∈r 1 τ k ∈[τi+ a ∈r:a <a t a ,τi+ a ∈r:a ≤a t a ] x ir ≤ c a , ∀a ∈ E, ∀τ k ∈ {τ 1 , ..., τ n } (16d) Here we introduce binary variables x ir to denote whether user i is assigned to route r ∈ R wi (x ir = 1) or not (x ir = 0). Further, we assume the constraints of this problem are feasible where, (16b) are assignment constraints, (16c) are binary constraints and (16d) are capacity constraints, and δ a,r is the indicator function stating whether arc a belongs to route r (δ a,r = 1) or not (δ a,r = 0). In the capacity constraints, a ∈r:a <a t a denotes the sum of the travel times on edges preceding edge a on route r, and a ∈r:a ≤a t a is the sum of the travel times on edges preceding as well as including edge a on route r.

B.2 Extending OTR Problem to General Cost Functions
In this section, we present a generalization of the OTR problem to the setting when the travel time of the arcs is modelled by a cost function. As with the OTR problem, we consider a graph with M ≥ 2 parallel arcs and two vertices representing an origin and a destination. Travelling through arc a requires f a (y a ) time units, when y a users use arc a, and each arc a has a capacity c a . Here f a : R ≥0 → R ≥0 is non-decreasing in its argument. We collect these parameters in S := {{c a } a∈ [M ] , {f a } a∈[M ] }. We denote an input sequence of n users by I := {{θ i } i∈[n] , {τ i } i∈[n] }, stating for each user i its time of appearance τ i ∈ R ≥0 and its value-of-time θ i ∈ Θ, where Θ is finite. With this notation, the OTR problem with general cost functions is as follows.
Problem 3. (Online Traffic Routing (OTR) with General Cost Functions) Let the parameter set S and an input sequence I define a problem instance. Users arrive sequentially in the system and must irrevocably be assigned to an arc at their time of appearance τ i . The number of users concurrently traversing an arc is limited to the capacity c a of the arc, and each user traverses an arc a for f a (y a + 1) time units, where y a users are using arc a at time τ i . Then, the OTR problem for general cost functions is to construct an assignment of users to arcs such that the total cost or time that users spend to traverse an arc is minimal.
If all users are identical, i.e., θ i = θ i ∀ i, i ∈ [n], we refer to this problem variant as OTR-I with general cost functions.
We evaluate the efficacy of an algorithm A that solves Problem 3 via its competitive ratio and say that an algorithm is α-competitive if CR(A) ≤ α. Here OP T (I) denotes the optimal offline solution to the OTR problem for general cost functions and ALG(I, A) denotes the online solution achieved by algorithm A on input sequence I. The input instances I belong to a set Ω, which corresponds to user arrivals such that θ i ≥ 0 for all users i, and τ i ≥ 0, with the first user arriving at time 0. We further assume without loss of generality that τ 1 = 0 < τ 2 < ... < τ n , i.e., no two users arrive in the system at the same point in time, and that there exists a feasible assignment.
We compute OP T (I) by solving the following optimization problem.