Manuscript Offprint
arXiv:2610.31447Peak-Aware One-Way Trading: Competitive and Learning-Augmented Algorithms for Energy Procurement
JACKSON BIBBENS, University of Massachusetts Amherst, USA
ADAM LECHOWICZ, University of Massachusetts Amherst, USA
NICOLAS CHRISTIANSON, Johns Hopkins University, USA
BO SUN, University of Ottawa, Canada
MOHAMMAD HAJIESMAILI, University of Massachusetts Amherst, USA
We introduce peak-aware one-way trading (PA-OWT), an online problem in which a player must purchase a fixed quantity of an asset by a deadline, minimizing its total cost plus a charge proportional to the largest single purchase at any time. The model is motivated by electricity procurement, where the cost of energy rewards buying at low prices, but peak demand charges discourage concentrating purchases in short periods. Balancing these incentives is challenging when future prices are unknown: a large purchase can establish a peak that later decisions cannot undo. We develop a peak-aware online algorithm that balances price and peak control with deadline feasibility and achieves the order-optimal competitive ratio. We further extend our results to a learning-augmented algorithm that uses predictions of optimal purchasing decisions to achieve an order-optimal consistency-robustness tradeoff, exploiting accurate advice while retaining worst-case guarantees in the face of arbitrary prediction errors. Finally, we evaluate our algorithms in a case study on electricity procurement using historical electricity price traces to understand the benefits of peak-aware purchasing.
1 Introduction
In the classic one-way trading problem, an online player buys/sells shares of an item over a fixed time horizon. They observe each price sequentially and must decide how much to trade before seeing the next price. In the purchasing variant, the player must acquire a fixed quantity before the deadline while minimizing their total cost. This paper introduces peak-aware one-way trading (PA-OWT), which adds a second consideration: the player pays not only for the shares purchased, but also for the largest purchase made in any single round. Specifically, the player purchases at least one unit over a horizon of T rounds and minimizes , where is the price, is the (fractional) purchase amount, and is the peak-charge coefficient. The addition of the peak term creates a tension absent from the classic one-way trading setting: a low price encourages buying more now, but doing so can establish a peak charge that no later decision can undo.
This problem is motivated by electricity procurement for large energy consumers, such as data centers or factories. Commercial electricity bills can include both an energy charge, based on consumption, and a demand charge, based on the customer's highest power demand during the billing period [29]. These charges reward different behaviors. Time-varying energy prices encourage an operator to move consumption to cheaper intervals, whereas a demand charge encourages the operator to spread consumption out over time. For example, an enterprise charging a fleet of electric vehicles before the start of the workday can reduce energy costs by concentrating charging in a low-price interval, but doing so will increase the demand component of their energy bill.
The PA-OWT model is related to two lines of work in the online optimization literature. In online search problems such as one-way trading and k-search, there is a long-term fixed demand which can be met flexibly across the time horizon, and the goal is to purchase enough supply
Authors' Contact Information: Jackson Bibbens, University of Massachusetts Amherst, USA, jbibbens@umass.edu; Adam Lechowicz, University of Massachusetts Amherst, USA, alechowicz@umass.edu; Nicolas Christianson, Johns Hopkins University, USA, christianson@jhu.edu; Bo Sun, University of Ottawa, Canada, bo.sun@uottawa.ca; Mohammad Hajiesmaili, University of Massachusetts Amherst, USA, hajiesmaili@cs.umass.edu.
Jackson Bibbens, Adam Lechowicz, Nicolas Christianson, Bo Sun, and Mohammad Hajiesmaili
to satisfy the demand while minimizing the total purchasing cost in the face of uncertain future prices [8, 12, 26, 37]. Viewing the problem as one of allocating a fixed trading budget across prices that arrive online, these problems have an online packing structure [6, 48]. To the best of our knowledge, costs associated with peak purchases (i.e., demand charges) have not been studied in this line of work, and significantly complicate algorithm design due to their coupling the cost of decisions across time. In contrast, studies of peak-aware economic dispatch [45, 46] explicitly account for demand charges. However, in this line of work, demands are uncertain and arrive over time, and the decisions at each time are whether to purchase supply from the grid (which includes both purchasing cost and demand charge) or from an alternative supply, such as energy storage [30] or expensive local generation [15, 22, 45, 46]. However, nearly all models in this line of work have an online covering structure [3, 32], where demand must be met exactly at each stage; while some works also consider flexible demand, the proposed algorithms are typically only heuristic, and do not come with formal performance guarantees for the setting with both flexible demand and time-varying prices [24, 30, 41].
PA-OWT sits at the intersection of these tracks of literature, considering the question of how to optimally handle both a flexible, horizon-wide purchasing requirement and a peak penalty under time-varying prices. Buying aggressively at low prices risks an unnecessarily large peak if many cheap prices arrive later, while spreading purchases out more cautiously risks paying higher prices, and postponing too much procurement to the end of the instance can force a large purchase near the deadline. Knowledge of the horizon also matters: a player that knows how many rounds remain can plan how to distribute its remaining purchases, whereas a player facing an unknown horizon cannot rely on those opportunities. We therefore ask:
Is it possible to design competitive algorithms for PA-OWT that balance a purchasing cost and a peak charge while meeting a deadline?
The online algorithms literature typically studies algorithm design using worst-case competitive analysis: comparing an algorithm's total cost with that of an offline optimum that knows the entire input sequence in advance. In an electricity market context, worst-case guarantees are useful: prices are known to be non-stationary and challenging to predict [33]. However, algorithms that optimize purely for the worst-case can be overly conservative in practice. Learning-augmented algorithms provide a framework for using untrusted advice about the future (e.g., machine-learned predictions, day-ahead price forecasts, etc.) without losing the worst-case guarantees associated with traditional algorithm design. Prior related work for one-way trading and peak-aware energy scheduling has shown that such algorithms can use predictions (e.g., of the best price or the optimal decisions at each round) to improve empirical performance without sacrificing worst-case guarantees [15, 16, 22, 36]. This naturally motivates our second question:
Can predictions of the optimal purchasing decisions improve the performance of algorithms for PA-OWT while preserving a worst-case guarantee?
Competitive results. We show that—unlike classic one-way trading (OWT) —there is an asymptotic separation between the known-horizon and unknown-horizon settings. When the horizon T is unknown, we show a linear lower bound of (Theorem 2.1), which can be matched up to constant factors by any algorithm, which motivates a focus on the known-horizon setting for the rest of the paper. In Section 3, we present Peak-Aware Water Level Smoothing (PAWS), a dual-threshold online algorithm, and show that it achieves the order-optimal competitive ratio for PA-OWT: (Theorems 3.2 and 4.1). This bound is a generalization of the one-way trading competitive ratio (for the minimization setting) and results in a sublinear dependence on T when L = 0. Unlike classic one-way trading, PAWS only requires fixed thresholds rather than a threshold curve, and can accommodate L = 0. We additionally show that PA-OWT transitions smoothly to OWT as and to trivial peak minimization when C is sufficiently large.
Learning-augmented results. In Section 5, we consider the design of learning-augmented algorithms for the PA-OWT problem. We first give a lower bound on the achievable consistency-robustness trade-off for any learning-augmented algorithm (Theorem 5.1). Specifically, any -consistent algorithm requires -robustness. We then show that a naive convex combination of PAWS and decision advice (Mix) is unable to match this tradeoff, giving robustness linear in (Theorem 5.2) and necessitating the development of a more sophisticated strategy. Motivated by this gap, we propose an algorithm, PAWS-DA, which generates proposed actions based on decision advice and projects those actions onto a robust interval. We show that PAWS-DA can achieve any desired consistency and matches the order-optimal trade-off between robustness and consistency (Theorem 5.3, Theorem 5.5).
Technical insights. Algorithms for OWT and online search compare purchases made at a reservation price or threshold curve to an optimal cost equaling the lowest price seen. The addition of a peak charge breaks this analysis, as the offline optimum may now spread purchases across multiple time steps. In PA-OWT, the offline dual problem elicits a water filling solution, where OPT pays cost at least whenever the amounts by which prices fall below sum to at most the peak-charge coefficient C. Our competitive algorithm PAWS follows this structure; buying proportionally to how far the price falls below a fixed water level, so it either completes its purchase below that level or certifies that the optimum pays at least as much. PAWS also introduces a rate limiter to spread compulsory purchases as the deadline nears, ensuring feasibility while preventing a large peak.
Integrating predictions in this framework requires a mechanism to limit the damage of poor advice. The convex combination strategy of Mix—appropriate in related problems — here inherits a fixed fraction of the advice's peak regardless of advice quality. By comparison, PAWS-DA uses shadow decisions to greedily track advice while the accumulated cost of these decisions (including peak charge) remains within a budget. This reduces the exposure to bad advice from a multiplicative to an additive term. In each time step, PAWS-DA will purchase the larger of the shadow and water filling decisions, capped by a rate limiter as in PAWS.
Case study. In Section 6, we evaluate the performance of our proposed algorithms in a case study on electricity procurement in four US grid regions. We observe that day-ahead prices serve as effective predictions, allowing learning-augmented algorithms to perform within 20% of the offline optimal solution on average. Empirical behavior of the algorithms generally follows the theoretical results, despite testing on predictable, non-adversarial instances. Our theoretical results rely on both price and peak charge separation between algorithms and the offline optimal; we find empirical variation on both dimensions, though slightly more within the peak charge than prices. Similarly, algorithm performance tends to improve as C increases, and degrades as T increases — both of which align with our theoretical analysis.
1.2 Related Work
Our work builds on several related lines of work in the online algorithms literature and application-focused studies. We first discuss how PA-OWT directly relates to prior work in online search and
Jackson Bibbens, Adam Lechowicz, Nicolas Christianson, Bo Sun, and Mohammad Hajiesmaili
peak-aware economic dispatch, before highlighting connections to the broader online optimization literature and relevant application studies.
Online search. Most directly related to our setting, the classic online problems of one-way trading and k-search study sequential purchases (or sales) of a divisible asset at varying prices revealed over time [12, 26]. In the purchasing setting, the player must buy a fixed amount by a deadline, but pays no charge for the largest purchasing decision. These problems (and related problems such as online knapsack [48]) admit optimal threshold-based algorithms that make decisions based on price observations and remaining budget or capacity [8, 37]. Extensions of these problems have considered switching costs that penalize the player for changing their purchasing decisions over time [20, 21], inventory models [25, 44], and nonlinear price functions [19]. Unlike these models, PA-OWT must balance buying at low prices against keeping the largest purchase small.
Peak-aware economic dispatch. Several papers study peak charges through an online algorithms lens. Canonical peak-aware economic dispatch assumes inelastic demand revealed online and chooses between grid purchases and local generation [45, 46]. Related work also considers flexible demand. Wang et al. [39] allow data-center workloads to be delayed or dropped under time-varying prices and peak charges, although they give guarantees only for a case with time-invariant prices where demand is dropped, not delayed. Zhao et al. [47] derive competitive guarantees for peak-minimizing online EV charging with flexible deadlines, but no time-varying prices—their model extends prior work on processor speed scaling [4]. Other extensions consider inventory [17] and time-varying prices under an assumption that the peak charge exceeds the price range [31]—in this regime, focusing exclusively on peak minimization is optimal (see Lemma 2.3).
Compared with these models, PA-OWT captures a distinct combination of features. It adopts the maximal temporal flexibility of one-way trading: a fixed divisible demand requirement is known at the outset and may be allocated arbitrarily across the horizon as time-varying prices are revealed. By allowing demand to be shifted freely across the horizon, PA-OWT isolates the fundamental online trade-off between when and how much to purchase to exploit low prices versus limiting the peak created by those purchases.
Online convex optimization and covering. PA-OWT’s peak charge couples all purchase decisions through an norm. This connects PA-OWT to online covering with convex and norm objectives, although in these problems the objective is known (i.e., prices are known in advance) and constraint rows arrive online [3, 32]. Other problems such as convex body chasing and smoothed online convex optimization also include norms in their objectives to model the cost of switching between consecutive decisions, but do not consider costs (like a peak charge) that couple decisions across all time steps [1, 9, 34].
Learning-augmented algorithms. Learning-augmented algorithms use predictions to improve performance (consistency) while retaining worst-case guarantees (robustness). For one-way trading and related online search models, studies consider instance advice (e.g., a single predicted “best price” for each instance) [23, 36]. Follow-up work has shown that considering consistency-robustness alone can hide “brittle” behavior under small errors in instance advice [13]. In peak-aware energy scheduling, studies have also considered instance advice [22], with follow-up work that considers risk-sensitivity [15]. In the broader literature on online convex optimization, convex body chasing, and online search problems with switching costs, learning-augmentation has been studied using decision advice that predicts the optimal decision in each time step [2, 10, 20]. In our work, we primarily focus on decision advice; we briefly discuss how instance advice might inform the design of learning-augmented algorithms for PA-OWT in Section 5.
Applications to electric load scheduling. By providing worst-case guarantees under arbitrary price sequences, our competitive-analysis framework complements application-focused approaches that rely on forecasts, stochastic models, or control assumptions. Flexible loads under demand charges have been studied using model predictive control, particularly for EV charging [7, 24, 43], as well as through data-center workload shifting and partial execution [11, 39, 42]. Wu et al. [41] studied flexible EV charging under time-varying prices and peak-charge, formulating it as a bi-objective problem that first minimizes the peak, then minimizes energy cost—they used predictions and rolling-horizon optimization to solve this. Related work has also considered the offline optimization of production scheduling under time-varying energy and demand charges [5] and reinforcement learning for demand-charge minimization with storage [40]. These works study the same basic optimization tradeoff between energy cost and peak charges using forecast- or model-driven approaches; our competitive analysis complements them by providing worst-case guarantees relative to the offline optimum without assumptions on the accuracy of future price forecasts.
2 Problem and Preliminaries
In this section, we formalize peak-aware one-way trading, state our assumptions, and define the competitive ratio used throughout the paper.
2.1 Problem Formulation
We introduce the peak-aware one-way trading problem (PA-OWT), where the player's goal is to purchase a fixed quantity of an asset by the end of a time horizon T while minimizing their purchase cost and a peak charge. Without loss of generality, the purchase quantity is normalized to one unit.
At each time step , the player observes a unit price and chooses a purchase amount before observing any future prices. Each decision is irrevocable: a purchase cannot be canceled or moved to another time step. The player must purchase at least one unit by the end of the final time step , i.e., .
A purchase of units costs . In addition to the total purchase cost, the player pays a single peak charge , proportional to its largest purchase, where the peak-charge coefficient is constant and known in advance. Thus, buying more at a low price may reduce purchase costs but increase the peak charge. For a price sequence , the offline problem is
where the first term and second term in the objective are the purchase cost and the peak charge, respectively. In the online setting, the player must meet the same purchase constraint without knowing future prices. Any amount still needed in the final round must be purchased at ; this compulsory trade contributes to both purchase cost and the peak charge.
2.2 Preliminaries & Assumptions
We study PA-OWT within the online algorithms framework. In this setting, the objective is to design an algorithm that achieves a small competitive ratio [28], defined as follows:
Let denote the purchase schedule produced by a deterministic online algorithm, and let denote an optimal solution to (1) with full knowledge of the price sequence. We write their total costs as and , respectively. Let be the set of possible PA-OWT price instances. The competitive ratio of ALG on sequences of length is
Jackson Bibbens, Adam Lechowicz, Nicolas Christianson, Bo Sun, and Mohammad Hajiesmaili
We call ALG -competitive if for every . Note that , by definition, is at least one, and a smaller ratio gives a stronger worst-case guarantee. We restrict our focus in this work to deterministic algorithms, since convexity of the objective implies that any randomized algorithm can be derandomized (i.e., finding a corresponding deterministic algorithm) without increasing its total cost. This can be seen by following the proof of Theorem 1 in [12] and applying the convexity of the objective.
Following the related literature [12, 26, 36], we assume:
ASSUMPTION 1. All prices satisfy , where are known bounds.
Without this assumption, it is known that the competitive ratio of any online algorithm can be arbitrarily large, even in the setting without a peak charge [12, 48]. In particular, the classic competitive guarantees in OWT depend on the price fluctuation ratio [12]; the optimal OWT competitive ratio is unbounded as , which occurs when for fixed , ruling out any finite competitive ratio in the setting without a peak charge. In PA-OWT, we allow , as the peak charge forces the offline optimal strategy to incur a minimum peak charge , and this is structure not present in OWT. Prices can otherwise vary arbitrarily within the range , and thus the set of possible price instances is . We assume neither a stochastic price model nor access to future prices.
For one-way trading without a peak charge, prior work has considered both a known-horizon setting [12] where the player knows T before the first time step, as well as an unknown-horizon setting [25] where T is not known beforehand and is only revealed at the start of the final (i.e., Tth) time step to force a compulsory trade, if needed.
For the latter case of unknown horizon, we show the following impossibility result for PA-OWT:
THEOREM 2.1. If , , and the horizon T is unknown, any algorithm for PA-OWT has competitive ratio .
PROOF SKETCH. Fix an arbitrary algorithm and consider rounds at price , with large enough that . If the algorithm buys more than half a unit on some such prefix, its peak exceeds and its cost is at least . The adversary then extends the horizon to an arbitrarily large with prices . An offline plan buys uniformly over these rounds, at cost . Hence the competitive ratio is at least as grows with fixed: the algorithm cannot undo its earlier purchases or peak.
Otherwise, the algorithm buys at most half a unit on every such prefix. The adversary announces round as the final round, using price U, forcing a purchase of at least half a unit and cost at least U/2. An offline plan instead buys 1/k in each preceding round, at total cost . With , the competitive ratio is at least . Thus, without horizon knowledge, the algorithm cannot avoid both risks: committing early leaves an irreversible cost if cheap rounds continue, while waiting risks a large compulsory trade.
The full proof is in Appendix A; this result in particular implies that, since T is unknown, the competitive ratio can be made arbitrarily large as . Moreover, as we show in the following proposition, this linear dependence on T is tight in general: any purchasing strategy for PA-OWT has a competitive ratio .
PROPOSITION 2.2. If L = 0, any algorithm for PA-OWT has competitive ratio at most
PROOF. This follows directly from the assumptions: any optimal solution must incur a purchasing cost of at least L (where L = 0), and a peak charge of at least C/T. The worst-case total cost for any purchasing is at most , giving the stated competitive ratio.
Due to the pessimistic bounds in Theorem 2.1 and Proposition 2.2 in the unknown horizon setting, we make the following assumption:
ASSUMPTION 2. Time horizon T is known in advance.
This assumption is well motivated by target applications such as wholesale electricity purchasing, where the billing horizon is known in advance and typically spans one month. Finally, it is clear that, for very large C, the peak charge will dominate the total cost, making it optimal to focus on simply minimizing the peak charge. In particular, we have the following lemma:
LEMMA 2.3. When , uniform purchasing for all is optimal for PA-OWT. The full proof is in Appendix A. Since a very large makes the problem trivial, we make the following assumption:
ASSUMPTION 3. The peak charge price C satisfies .
For the rest of the paper, we denote . Here, is a lower bound on the cost of any feasible solution: purchasing one unit costs at least , and the peak charge is at least . This parameter plays a role analogous to the price fluctuation ratio in OWT.
3 Competitive Algorithms for PA-OWT
In this section, we present a dual-threshold algorithm called Peak-Aware Water Level Smoothing (PAWS) and analyze its competitive ratio. We prove that PAWS achieves a competitive ratio at most ; a matching lower bound in Section 4 establishes its order-optimality.
3.1 Designing Peak-Aware Water Level Smoothing
PAWS (Algorithm 1) is designed to optimally balance the purchase cost and the peak charge. Our algorithm is inspired by the structural properties of optimal primal and dual solutions to the offline version of PA-OWT. Specifically, when all prices are known, the formulation of PA-OWT in (1) can be rewritten as follows:
The dual of this problem introduces a multiplier for each constraint and a multiplier for the requirement to purchase at least one unit; this yields the dual problem:
Let and denote an optimal primal solution to (3), and let and denote an optimal dual solution to (4). These solutions can be characterized as follows:
LEMMA 3.1. The optimal dual variable in (4) satisfies
and for all . An optimal primal solution to (3) is given by
Jackson Bibbens, Adam Lechowicz, Nicolas Christianson, Bo Sun, and Mohammad Hajiesmaili
Algorithm 1 PAWS Algorithm
Input: target water level
Output: online decisions
1: initialize:
2:
▷ Purchase Cap
3:
▷ Remaining Amount to Purchase
4: for do
5:
6:
7: end for
where is the number of time slots whose prices are no greater than .
The offline primal and dual solutions to PA-OWT have a different structure from those of the traditional one-way trading problem [12], in which an optimal primal solution purchases one unit in a single time step at the lowest price. Due to the peak charge, the optimal primal solution characterized above purchases only in time steps whose prices are no greater than the optimal dual price , with an equal amount 1/k purchased in each such slot. The optimal dual solution has a water-filling structure, with serving as the water level. However, determining the optimal water level is challenging in the online setting. Even if were known a priori, one would still not know in advance the number of time slots in which to purchase, i.e., with prices at or below this level. Thus, there are two key challenges in designing an online algorithm for this problem: first, we must determine an appropriate estimate of the optimal water level, to obtain prices that are competitive with the optimal value; and second, we must decide how many times to purchase, so that we do not either significantly overpay on the peak charge, or miss out on a small number of good prices.
Our algorithm PAWS exploits this structure by setting a target water level and using it to guide its purchasing decisions. In particular, at each time step t, we aim to purchase
provided that the remaining amount to purchase is at least and no compulsory purchase is needed. This target purchase amount has two useful properties. First, if , then , so purchasing in every time slot would yield exactly one unit in total. Second, is larger when lies farther below the target water level , so the algorithm aims to purchase more at lower prices.
One issue with the purchase decision in (7) arises when . In this case, , so compulsory purchases near the end of the time horizon may lead to a large peak charge. To avoid this, we set as the purchase limit. At time , if the remaining amount to purchase satisfies , the compulsory purchase phase begins with purchase , and then the algorithm purchases in each remaining time slot to ensure that the peak purchase does not exceed .
In our main results, PAWS sets the target price to (see the proof of Theorem 3.2 for the intuition behind this choice). Note that as (eliminating the peak charge), the rate limiter is non-binding (i.e., , allowing PAWS to purchase the entire unit in a single time step).
3.2 Competitive Analysis
We now prove an upper bound on the competitive ratio of PAWS. The analysis determines the target water level and the corresponding rate limiter m based on problem parameters.
THEOREM 3.2. PAWS is -competitive for PA-OWT when .
PROOF. For any instance I of the PA-OWT problem, we denote the cost of PAWS using target price by . We first establish the offline comparison used when a compulsory trade occurs. For any , set and let for a feasible purchase vector . If , then
Thus Cost(OPT(I)) ≥ Φ whenever . We now consider two cases.
No Compulsory Trade. PAWS is able to purchase its entire constraint at price at most with peak charge at most . By construction of , , so . Since every feasible solution buys at least one unit at prices at least and has peak purchase at least , .
Compulsory Trade. If a compulsory trade occurs, PAWS can be forced to purchase at a price as high as U, but its peak charge remains at most Cm. Therefore, Cost(PAWS ) . To bound OPT, consider the first round t in which the compulsory term exceeds the threshold purchase . All earlier purchases then follow the threshold, totaling . When , every later threshold purchase is at most m, and hence
When , a compulsory trade can occur only at , so the same inequality holds without a future term. It follows from (8) that .
Combining these results, we see that the competitive ratio is at most
To balance the two cost bounds, we set . Since , we have:
Thus, PAWS is -competitive when and .
□
Jackson Bibbens, Adam Lechowicz, Nicolas Christianson, Bo Sun, and Mohammad Hajiesmaili
4 A Fundamental Limit
The preceding section gives an online algorithm with competitive ratio at most . Under the assumptions in Section 2.2, we ask the question: can any online algorithm achieve an asymptotically better competitive ratio? In this section, we show that the answer is no: any online algorithm for PA-OWT has competitive ratio . The proof uses two price sequences with a common prefix, forcing a trade-off between buying before prices rise and waiting for prices to fall.
THEOREM 4.1. In the PA-OWT setting, under the assumptions 1-3, any online algorithm has competitive ratio at least .
PROOF. The lower bound of 1 comes directly from the definition of the competitive ratio. We now consider the case.
The argument uses two price sequences with a common prefix. Because an online algorithm cannot see future prices, any algorithm ALG will make the same purchasing decisions for the common prefix of both sequences, resulting in a performance trade-off across the suffixes. Let , , and define sequences like so:
where , for . Note that and . We consider two cases based on the relative size of and .
Case: . Suppose ALG purchases a total volume of s across the prefix of n prices p.
On , purchasing in each of the first rounds shows that , while any feasible ALG pays at least . On , purchasing in each of the final rounds shows that , while ALG pays at least . These feasible offline schedules suffice; they need not be optimal.
Since , we can lower bound the expression by
Case: . Here we can ignore the price sequences and recognize the premise implies that . Thus
Since the competitive ratio is at least 1, it is lower bounded by .
Compared to OWT (without a peak charge), the lower bound for PA-OWT intuitively depends on the additional peak charge C. As , the PA-OWT lower bound smoothly recovers the optimal competitive bound for the minimization version of OWT [20, 26].
Together, Theorem 3.2 and Theorem 4.1 establish that the optimal competitive ratio for PA-OWT is , attained by PAWS up to constant factors.
5 Learning-Augmented Algorithms for PA-OWT
To go beyond the worst-case analysis, in this section, we aim to further investigate how to make use of machine-learned predictions to design learning-augmented algorithms for PA-OWT. Suppose that an algorithm receives predictions of the form , where denotes a prediction of the optimal purchase decision at time . We aim to design an algorithm that uses the decision advice ADV to improve the average-case performance for PA-OWT when ADV is of good quality, while retaining a worst-case bound.
To investigate this, we evaluate learning-augmented algorithms [18, 27] using two metrics: consistency, which compares the algorithm's cost with that of the decision advice; and robustness, which bounds its competitive ratio regardless of the quality of the advice. Given a feasible advice ADV for instance I, we let denote the online decision of learning-augmented algorithm. Given a parameter , we say the algorithm is -consistent and -robust if for every instance I and feasible advice ADV,
In particular, when ADV is the optimal solution, the consistency guarantees implies a competitive ratio of at most .
5.1 Lower Bound on Consistency-Robustness Trade-off
We begin by proving a result that gives a fundamental limit on the trade-off between consistency and robustness. In particular, we have the following lower bound:
THEOREM 5.1. Any learning-augmented algorithm for PA-OWT that is -consistent must be at least -robust, where .
PROOF. The first two terms follow from Theorem 4.1: with arbitrary predictions, a learning-augmented algorithm cannot guarantee a better competitive ratio than the prediction-free lower bound. We therefore prove the remaining bound, .
If , this term is less than and is already covered by the first two terms. Otherwise, suppose . We construct two instances with the same prices and advice during an initial block of rounds. On the first instance, the advice is optimal, so consistency requires the algorithm to buy a substantial amount during this block. On the second, prices fall after the block, but the algorithm has already made the same purchases.
Let , , and . Since and , the assumption that gives
Thus all prices in the following instances are admissible:
On both instances, a learning-augmented algorithm receives the same decision advice: buy in each of the first n rounds and nothing thereafter. Let z denote its total purchases during the shared initial block. Because the algorithm sees the same prices and advice before the last k rounds, this value of z is the same on both instances.
Jackson Bibbens, Adam Lechowicz, Nicolas Christianson, Bo Sun, and Mohammad Hajiesmaili
Instance 1: correct advice forces early purchases. Following the advice on costs . This schedule is optimal, not just feasible. To see why, consider any schedule buying exactly one unit, with volume s in the first n rounds. Its peak is at least , so its total cost is at least
The last inequality holds because . Since prices and the peak charge are nonnegative, buying more than one unit cannot improve the optimum. Hence , and -consistency requires
But the algorithm must buy any volume still missing after the initial block at price U, giving . Combining these inequalities yields .
Instance 2: the same purchases are costly when prices fall. On , the algorithm again buys during the initial block, even though the final rounds now offer price . These purchases alone cost and establish a peak of at least . Therefore,
An offline plan can instead wait and buy in each of the final k rounds. This gives the upper bound
where the last inequality uses for every . Robustness must cover this instance even when the advice is incorrect, so
Thus, stronger consistency forces more commitment to the shared initial block, limiting robustness when the same advice is wrong.
Using the optimal consistency-robustness trade-off shown in Theorem 5.1 as a benchmark, we next consider how an algorithm can use predictions to improve performance.
5.2 Naive Convex Combination Algorithm
Given decision advice ADV, a natural learning-augmented algorithm is to apply a linear combination of some robust decisions (e.g., from PAWS) and the decision advice [20]. Given a linear combination parameter , we define an algorithm Mix that combines robust decisions from PAWS and the decision advice in Algorithm 2.
We now analyze the consistency and robustness of Mix:
THEOREM 5.2. For a given , Mix is -consistent and -robust.
Note that when , the robustness of the Mix is approaching , where can be of order . Therefore, simple MIX cannot achieve the consistency-robustness lower bound shown in Theorem 5.1.
Algorithm 2 Mix Algorithm
Input: consistency parameter , -competitive algorithm PAWS
Output: online decisions
1: initialize: 2: 3: 4: for do 5: observe price and advice 6: 7: 8: end for
PROOF. First, the online solutions from PAWS and the advice are feasible solutions, and thus the solution from MIX is also feasible, i.e.,
The total cost of the MIX is
Since Cost(OPT) ≤ Cost(ADV), we have Cost(MIX) ≤ . Thus, MIX is -consistent.
In addition, note that and , then . Thus, . Thus, the robustness of MIX is .
Therefore, to achieve consistency below , the Mix algorithm requires robustness with a linear dependence on T (and C) which is not required for general learning-augmented algorithms. In order to match the lower bound of Theorem 5.1, we next propose a more sophisticated algorithm that carefully controls the impact of the peak charge when provided with incorrect decision advice.
5.3 Augmenting PAWS with Decision Advice
In this section, we design an algorithm called Peak-Aware Water Level Smoothing with Decision Advice (PAWS-DA), which augments PAWS with advice-tracking decisions to match a specific consistency bound . Depending on the value of , PAWS-DA calculates a method of following the advice in one of two ways.
Near 1-consistency. The algorithm will aggressively track advice when . PAWS-DA aims to match the accumulated volume purchased by the advice stream, with per-step purchases capped by a rate limiter . In this setting, the algorithm does not consider the arriving prices, only the advice stream. Although the rate limiter may lead to added price costs compared to Mix, when advice is accurate, we show that the savings to the peak charge outweigh them. In addition, the
Jackson Bibbens, Adam Lechowicz, Nicolas Christianson, Bo Sun, and Mohammad Hajiesmaili
rate limiter allows PAWS-DA to avoid the linear dependence on T seen in Mix. The full procedure is given in Algorithm 3.
General consistency. When , the algorithm engages in balanced tracking of advice. In this setting, similar to PAWS, PAWS-DA takes a target water level parameter that influences purchases via the water-filling solution , and a rate limiter parameter .
PAWS-DA also takes a parameter that allows it to decide how to follow the decision advice. At a high level, PAWS-DA improves upon Mix by explicitly accounting for the accrued cost of the decision advice so far: when the running cost of advice is high, PAWS-DA switches to ignore it to preserve robustness. In particular, bounds the cost attributable to the advice; it does so by influencing a set of shadow decisions , where a larger corresponds to more willingness to follow a large (at the risk of incurring an ill-advised large peak charge). Reflecting this intuition, is set to , meaning that there is a looser restriction on the purchasing rate as grows.
In each time step, PAWS-DA computes the dual decision and the shadow decision , purchasing the larger of the two. This decision is capped by and overridden if compulsory trading is needed to meet the constraint. The full procedure is given in Algorithm 3. We show that to reach the target consistency, it suffices to set and for . If input , we instead run the algorithm with as there is no robustness benefit to higher consistency beyond this point.
THEOREM 5.3. Given input parameter , PAWS-DA is -consistent.
Proof. We give separate arguments for (aggressive tracking) and (balanced tracking).
Aggressive tracking. We split the analysis into cases based on the size of the largest advice decision . If , then the advice respects the rate limiting parameter. Note that the algorithm is able to follow advice exactly, as will always equal . Because it follows the advice exactly, PAWS-DA is 1-consistent in this case.
Now, if , we note that . We define the total amount of “deferred advice” as
Let ADV represent following the decision advice exactly. Deferred advice increases the price cost of PAWS-DA compared to ADV—in the worst-case, this price increase is at most . Simultaneously however, PAWS-DA's peak charge is reduced by at least . We have:
The final inequality holds because implies and similarly . Since , PAWS-DA is 1-consistent by definition. Thus, regardless of the size of , we show 1-consistency, which also implies -consistency.
Balanced tracking. We first consider the consistency as a function of and (Lemma 5.4), deferring the full proof to Appendix B. This result then suggests assignments for and that satisfy the desired consistency bound.
Algorithm 3 PAWS-DA Algorithm
Input: Consistency parameter Output: online decisions
1: initialize: 2: 3: if then 4: 5: 6: 7: else 8: 9: 10: 11: 12: 13: end if 14: 15: for do 16: Observe price and advice 17: 18: 19: if then 20: 21: 22: else if then 23: 24: 25: 26: end if 27: 28: 29: 30: end for
LEMMA 5.4. The PAWS-DA algorithm is -consistent for
Therefore, if we set and we find
.
Thus, we have shown PAWS-DA is -consistent in both regimes.
Next, we show that for a given (desired) consistency , PAWS-DA is -robust, where matches the optimal consistency-robustness bound from Theorem 5.1.
Jackson Bibbens, Adam Lechowicz, Nicolas Christianson, Bo Sun, and Mohammad Hajiesmaili
THEOREM 5.5. Given input parameter , the PAWS-DA algorithm is -robust, where
Proof. We split the analysis by .
Aggressive tracking. In this case we can note that PAWS-DA has cost at most . Since , this results in cost at most . Meanwhile, OPT has a trivial lower bound of .
Balanced tracking. If , we clip to as there is no consistency or robustness benefit to a larger value of . We first consider robustness as a function of and . We then show that the specified assignment of and via gives the stated bound.
LEMMA 5.6. The PAWS-DA algorithm is -robust for .
Using the above result, if we set and , we find robustness:
Since and , the left term
Since and , the right term
Using the clipped , we can conclude that that PAWS-DA achieves robustness .
5.4 Converting other forms of predictions into decision advice
Our framework is not restricted to predictions as purchase decisions. Other forms of predictions can also be incorporated by converting them into decision advice. The resulting advice can then be used by PAWS-DA without modifying the algorithm. Moreover, whenever the converted advice can attain the offline optimal cost when the predictions are accurate, the analysis of PAWS-DA also applies and the same consistency-robustness guarantee holds.
As an example, the structure of the optimal primal and dual solutions in Lemma 3.1 suggests a form of instance advice: , where predicts the optimal dual variable , which also equals the optimal cost, and predicts the number of prices no greater than . These predictions specify both which prices to accept and how much purchase at each accepted price. We can convert into decision advice , where . To ensure feasibility under imperfect predictions, each purchase is capped at the remaining demand, and any unmet demand is purchased in the final time slot.
PROPOSITION 5.7. Following advice can attain the optimal offline cost when predictions and are accurate. Additionally, neither nor predictions alone can attain optimal cost.
We present a sketch here, and a full proof is available in Appendix B. Recall the offline primal-dual solution in Lemma 3.1. Perfect knowledge of the optimal cost imposes a ceiling on accepted prices, but does not dictate how much to buy when appears. Conversely, knowledge of the optimal purchase count indicates target purchase amounts, but does not suggest which prices to accept. In both cases, this uncertainty can be exploited to create instances with cost strictly larger than the offline optimum. Put together, these predictions are complementary, describing both which prices are good, and how much to purchase.
6 Experiments
In this section, we evaluate the performance of the PAWS and PAWS-DA algorithms against several natural baselines. We simulate a case study of electricity procurement with a demand charge, using real-time and day-ahead prices from four U.S. electric grids.
6.1 Experimental Setup
We simulate an electricity billing period where a consumer (e.g. a flexible data center) must procure a total of 1 (normalized) unit of energy in the real-time market. We solve the offline problem (with full knowledge of prices and demand charge) using SciPy [38] to report the empirical competitive ratio of each tested algorithm.
Data. We use historical US grid price data obtained from GridStatus [14]. We consider real-time and day-ahead locational marginal prices (15 minute increments) for four US grid regions (ISOs): CAISO (California), ISONE (New England), ERCOT (Texas), and PJM (Mid-Atlantic). For ERCOT, CAISO, and PJM, our data covers the 2020-2024 calendar years, while ISONE covers July 2022-EOY 2024, giving ~600,000 total observations. Real-time prices define the price sequence ; any negative prices are clipped to 0.
Day-ahead prices are used to generate decision advice for learning-augmented algorithms by solving for the offline optimal on those sequences. While this is not a true machine-learned predictor, it serves as a reasonable proxy for our evaluation, as day-ahead price forecasts are readily available [33].
In Figure 2(d) specifically, we manipulate the decision advice directly to stress-test the robustness of our learning-augmented algorithms. In this case, we define the decision advice as a linear combination of the true optimal solution on the real-time prices (perfect advice) and an adversarial solution that maximizes total cost (worst-case advice); by varying a parameter, a linear combination of the two solutions captures every scenario for decision advice. This allows us to illustrate the effect of advice quality on performance.
Parameters. For our main experiments, we randomly sample 1000 instances for each ISO and average the results. Instances are drawn as blocks of T = 96 consecutive time steps with no missing data; we set L = 0, U as the 99th percentile price in that ISO across the entire data set, and . Although we set U to the 99th percentile price, this only affects algorithmic thresholds and choice of C; real prices are allowed to exceed this value. In select experiments we evaluate the effect
Jackson Bibbens, Adam Lechowicz, Nicolas Christianson, Bo Sun, and Mohammad Hajiesmaili

(a) CDF of Competitive Ratios

(b) Cost Decomposition
(c) Variation by ISO
Fig. 1. Experiments with fixed parameters. (a) Cumulative distribution function for empirical competitive ratio for each algorithm across all ISOs. (b) Cost decomposition between energy and peak charge for each algorithm, averaged across ISO. (c) Average empirical competitive ratio and 95% CI by ISO.
of parameters on the performance of tested algorithms. For this sensitivity analysis, we randomly sample 100 instances from each ISO for each setting. In each variant, we test 10-15 parameter values.
Baselines. In addition to evaluating the performance of PAWS and PAWS-DA, we consider the following four baseline strategies. BlindAdvice simply follows the decision advice, making the predicted purchase decision at each time step . Mix selects a convex combination of advice and PAWS allocations in each step, we choose a mixing parameter . We also implement OWT, which is the optimal threshold-based strategy for one-way trading without a peak charge; this algorithm neglects the peak charge when making purchasing decisions and demonstrates the gain of PAWS in the standard competitive setting (i.e., without predictions). In contrast to OWT, which minimizes prices, we include Uniform purchasing to demonstrate the effect of minimizing the peak charge. To measure the performance of PAWS-DA at varying target consistencies, we introduce a trust parameter , and set . Thus, larger corresponds to increased trust in advice and smaller consistency bound; note that some advice is used even when .
6.2 Experimental Results
Main Results. Figure 1 shows the results of our main experiment setting. In these experiments, using the day-ahead price forecasts to obtain decision advice resulted in near-optimal advice: as a result, in each plot we observe performance improving as PAWS-DA uses more of the advice. PAWS-DA performs nearly identically to blind advice following, which is to be expected when advice is good. PAWS-DA exhibits performance quite close to BlindAdvice while retaining a strong robustness guarantee that is not present for arbitrary decision advice. We observe that both Uniform and Mix exhibit a better average empirical competitive ratio than PAWS, but worse than the PAWS-DA variants. While both Mix and PAWS-DA are equally balanced on their respective consistency-robustness parameterization, the empirical competitive ratio of PAWS-DA is lower on average. Figure 1(b) shows that more of the variation between algorithms occurs due to the peak charge rather than their energy cost, suggesting that peak management is empirically more difficult. Figure 1(c) demonstrates the impact of specific grids: while there is not much variation, the relatively worse performance of OWT and Uniform in ERCOT is unsurprising due to that grid having more frequent price spikes.

(a) Changing C
(b) Changing T
(c) Changing
(d) Changing Advice
Fig. 2. Experiments with varying parameters. All figures average across ISOs, showing mean empirical competitive ratio and 95% CI. (a) Varying C relative to U: decreasing CR as C grows matches theoretical bounds. (b) Increasing time horizon T makes the price-peak trade-off more challenging (c) Increasing trust parameter in PAWS-DA algorithm converges to blind advice. (d) Comparison of algorithms by share of adversarial advice corruption.
Sensitivity Analysis. Figure 2 shows the results of our sensitivity analysis, where we vary certain parameters of the PA-OWT setting to observe their impact on performance. In the first three plots, high quality decision advice (based on day-ahead price forecasts) allow advice-informed algorithms to generally outperform PAWS and Uniform.
In Figure 2(a), all algorithms show improved performance as the relative size of C increases. This result aligns with the competitive bounds of Theorem 3.2, which are monotonically decreasing in C. While the advice-informed algorithms do slightly worse than PAWS when C is small, they perform better than PAWS at large C. Figure 2(b) shows the competitive ratio of all algorithms increasing in T. Uniform begins increasing immediately, while the remaining algorithms are approximately flat until . While PAWS has the worst empirical competitive ratio when T is small, it is less affected by increased T and is nearly as strong as the advice-informed algorithms for large T. In contrast, Uniform is near-optimal for small T but degrades much worse than the other baselines as T increases.
In Figure 2(c) we show how the performance of PAWS-DA varies with different choices of ; as previously stated, we observe that the day-ahead forecast-based advice is near-optimal. Even with the same robustness bound the PAWS-DA algorithm results in lower competitive ratio on real instances than the conservative PAWS algorithm, though they remain within the same 95% confidence interval.
Finally, Figure 2(d) compares algorithm performance across varying advice corruption, using a linear combination of optimal and worst-case solutions across the actual prices in each instance. We set a corruption factor between 0 and 1, where 0 corresponds to perfect decision advice and 1 corresponds to completely adversarial advice. As expected, BlindAdvice and Mix degrade linearly with advice corruption, while all PAWS-DA variants degrade sublinearly. PAWS and Uniform are both unaffected by advice quality.
7 Conclusion
Motivated by electricity procurement with demand charges, we introduce and study PA-OWT, which extends one-way trading by additionally charging the player for the largest single purchase. This peak charge creates a tension between buying at low prices and spreading purchases across time. We characterize the limits of online purchasing and show that advance knowledge of the time horizon significantly changes what is possible in the setting. For the known-horizon setting, we design
Jackson Bibbens, Adam Lechowicz, Nicolas Christianson, Bo Sun, and Mohammad Hajiesmaili
PAWS, a dual-threshold algorithm that achieves an order-optimal competitive ratio. We also establish a lower bound on the consistency-robustness trade-off and design PAWS-DA, a learning-augmented algorithm that uses decision advice while providing order-optimal guarantees. We evaluate our proposed algorithms in an electricity procurement case study across four U.S. grid regions.
Several directions remain for future work. Our model considers a single purchasing obligation over a fixed horizon. A natural extension would allow multiple obligations with different deadlines that contribute to a shared peak charge, capturing the need to coordinate flexible electricity demand across overlapping workloads. Such an extension might also consider how energy storage could help “shave the peak.” On the learning-augmented side, our algorithms focus on decision advice and use a parameter to control the consistency-robustness trade-off; it would be interesting to investigate other advice models in this setting, including uncertainty quantified predictions [16, 35] and/or instance advice that might be easier to obtain for certain applications of PA-OWT.
Acknowledgments
This research is supported by National Science Foundation grants CAREER-2045641, CNS-2325956, CNS-2512128, and CNS-2533814, and the U.S. Department of Energy, Office of Science, Office of Advanced Scientific Computing Research, Department of Energy Computational Science Graduate Fellowship under Award Number DE-SC0024386. In addition, this work is funded by Natural Sciences and Engineering Research Council of Canada Discovery Grant RGPIN-2026-06424.
References
[1] Lachlan Andrew, Siddharth Barman, Katrina Ligett, Minghong Lin, Adam Meyerson, Alan Roytman, and Adam Wierman. 2013. A Tale of Two Metrics: Simultaneous Bounds on Competitiveness and Regret. In Proceedings of the 26th Annual Conference on Learning Theory (Proceedings of Machine Learning Research, Vol. 30), Shai Shalev-Shwartz and Ingo Steinwart (Eds.). PMLR, Princeton, NJ, USA, 741–763. https://proceedings.mlr.press/v30/Andrew13.html
[2] Antonios Antoniadis, Christian Coester, Marek Elias, Adam Polak, and Bertrand Simon. 2020. Online metric algorithms with untrusted predictions. In Proceedings of the 37th International Conference on Machine Learning (Proceedings of Machine Learning Research, Vol. 119), Hal Daumé III and Aarti Singh (Eds.). PMLR, 345–355. https://proceedings.mlr.press/v119/antoniadis20a.html
[3] Yossi Azar, Niv Buchbinder, T.-H. Hubert Chan, Shahar Chen, Ilan Reuven Cohen, Anupam Gupta, Zhiyi Huang, Ning Kang, Viswanath Nagarajan, Joseph Naor, and Debmalya Panigrahi. 2016. Online Algorithms for Covering and Packing Problems with Convex Objectives. In 2016 IEEE 57th Annual Symposium on Foundations of Computer Science (FOCS). IEEE, Piscataway, NJ, USA, 148–157. doi:10.1109/FOCS.2016.24
[4] Nikhil Bansal, Tracy Kimbrel, and Kirk Pruhs. 2007. Speed scaling to manage energy and temperature. J. ACM 54, 1, Article 3 (March 2007), 39 pages. doi:10.1145/1206035.1206038
[5] Jose Batista Abikarram, Katie McConky, and Ruben Proaño. 2019. Energy Cost Minimization for Unrelated Parallel Machine Scheduling under Real Time and Demand Charge Pricing. Journal of Cleaner Production 208 (2019), 232–242. doi:10.1016/j.jclepro.2018.10.048
[6] Niv Buchbinder and Joseph (Seffi) Naor. 2009. Online Primal-Dual Algorithms for Covering and Packing. Mathematics of Operations Research 34, 2 (May 2009), 270–286. doi:10.1287/moor.1080.0363
[7] Thibaud Cambronne, Samuel Bobick, Wente Zeng, and Scott Moura. 2026. Joint Price and Power MPC for Peak Power Reduction at Workplace EV Charging Stations. In 2026 American Control Conference (ACC). 300–306.
[8] Ying Cao, Bo Sun, and Danny H. K. Tsang. 2020. Optimal Online Algorithms for One-Way Trading and Online Knapsack Problems: A Unified Competitive Analysis. In 2020 59th IEEE Conference on Decision and Control (CDC). IEEE, Piscataway, NJ, USA, 1064–1069. doi:10.1109/CDC42340.2020.9303856
[9] Niangjun Chen, Gautam Goel, and Adam Wierman. 2018. Smoothed Online Convex Optimization in High Dimensions via Online Balanced Descent. In Proceedings of the 31st Conference on Learning Theory (Proceedings of Machine Learning Research, Vol. 75). PMLR, Stockholm, Sweden, 1574–1594. https://proceedings.mlr.press/v75/chen18b.html
[10] Nicolas Christianson, Tinashe Handina, and Adam Wierman. 2022. Chasing Convex Bodies and Functions with Black-Box Advice. In Proceedings of Thirty Fifth Conference on Learning Theory (Proceedings of Machine Learning Research, Vol. 178). PMLR, London, UK, 867–908. https://proceedings.mlr.press/v178/christianson22a.html
[11] Mehiar Dabbagh, Bechir Hamdaoui, Ammar Rayes, and Mohsen Guizani. 2019. Shaving Data Center Power Demand Peaks Through Energy Storage and Workload Shifting Control. IEEE Transactions on Cloud Computing 7, 4 (2019),
1095–1108. doi:10.1109/TCC.2017.2744623
[12] Ran El-Yaniv, Amos Fiat, Richard M. Karp, and G. Turpin. 2001. Optimal Search and One-Way Trading Online Algorithms. Algorithmica 30, 1 (2001), 101–139. doi:10.1007/s00453-001-0003-0
[13] Alex Elenter, Spyros Angelopoulos, Christoph Dürr, and Yanni Lefki. 2024. Overcoming Brittleness in Pareto-Optimal Learning Augmented Algorithms. In Advances in Neural Information Processing Systems, Vol. 37. Curran Associates, Inc., Red Hook, NY, USA, 9329–9357. doi:10.52202/079017-0296
[14] Grid Status. 2025. Grid Status. https://www.gridstatus.io
[15] Lukas Himmelreich, Nicolas Christianson, and Adam Wierman. 2026. Risk-Sensitive Peak-Aware Energy Scheduling: Competitive and Learning-Augmented Algorithms. In Proceedings of the 17th ACM International Conference on Future and Sustainable Energy Systems (Banff, Alberta, Canada) (E-Energy '26). Association for Computing Machinery, New York, NY, USA, 240–271. doi:10.1145/3744255.3811739
[16] Ezra Johnson, Adam Lechowicz, and Mohammad Hajiesmaili. 2026. Signal-Aware Workload Shifting Algorithms with Uncertainty-Quantified Predictors. In Proceedings of the 17th ACM International Conference on Future and Sustainable Energy Systems (E-Energy '26). Association for Computing Machinery, New York, NY, USA, 120–138. doi:10.1145/3744255.3798123
[17] Matthew P. Johnson, Amotz Bar-Noy, Ou Liu, and Yi Feng. 2011. Energy Peak Shaving with Local Storage. Sustainable Computing: Informatics and Systems 1, 3 (2011), 177–188. doi:10.1016/j.suscom.2011.05.001
[18] Ravi Kumar, Manish Purohit, and Zoya Svitkina. 2018. Improving online algorithms via ML predictions. In Proceedings of the 32nd International Conference on Neural Information Processing Systems (Montréal, Canada) (NIPS'18). Curran Associates Inc., Red Hook, NY, USA, 9684–9693.
[19] Adam Lechowicz, Nicolas Christianson, Bo Sun, Noman Bashir, Mohammad Hajiesmaili, Adam Wierman, and Prashant Shenoy. 2024. Chasing Convex Functions with Long-term Constraints. In Proceedings of the 41st International Conference on Machine Learning (Proceedings of Machine Learning Research, Vol. 235). PMLR, Vienna, Austria, 26259–26289. https://proceedings.mlr.press/v235/lechowicz24a.html
[20] Adam Lechowicz, Nicolas Christianson, Bo Sun, Noman Bashir, Mohammad Hajiesmaili, Adam Wierman, and Prashant Shenoy. 2024. Online Conversion with Switching Costs: Robust and Learning-augmented Algorithms. arXiv:2310.20598, version 3. doi:10.48550/arXiv.2310.20598
[21] Adam Lechowicz, Nicolas Christianson, Jinhang Zuo, Noman Bashir, Mohammad Hajiesmaili, Adam Wierman, and Prashant Shenoy. 2023. The Online Pause and Resume Problem: Optimal Algorithms and An Application to Carbon-Aware Load Shifting. Proc. ACM Meas. Anal. Comput. Syst. 7, 3, Article 45 (Dec. 2023), 32 pages. doi:10.1145/3626776
[22] Russell Lee, Jessica Maghakian, Mohammad Hajiesmaili, Jian Li, Ramesh Sitaraman, and Zhenhua Liu. 2021. Online Peak-Aware Energy Scheduling with Untrusted Advice. In Proceedings of the Twelfth ACM International Conference on Future Energy Systems. Association for Computing Machinery, New York, NY, USA, 107–123. doi:10.1145/3447555.3464860
[23] Russell Lee, Bo Sun, Mohammad Hajiesmaili, and John C. S. Lui. 2024. Online Search with Predictions: Pareto-optimal Algorithm and its Applications in Energy Markets. In The 15th ACM International Conference on Future and Sustainable Energy Systems. Association for Computing Machinery, New York, NY, USA, 386–407. doi:10.1145/3632775.3639590
[24] Zachary J. Lee, John Z.F. Pang, and Steven H. Low. 2020. Pricing EV charging service with demand charge. Electric Power Systems Research 189 (Dec. 2020), 106694. doi:10.1016/j.epsr.2020.106694
[25] Qiulin Lin, Hanling Yi, John Pang, Minghua Chen, Adam Wierman, Michael Honig, and Yuanzhang Xiao. 2019. Competitive Online Optimization under Inventory Constraints. Proceedings of the ACM on Measurement and Analysis of Computing Systems 3, 1, Article 10 (2019), 28 pages. doi:10.1145/3322205.3311081
[26] Julian Lorenz, Konstantinos Panagiotou, and Angelika Steger. 2009. Optimal Algorithms for k-Search with Application in Option Pricing. Algorithmica 55, 2 (2009), 311–328. doi:10.1007/s00453-008-9217-8
[27] Thodoris Lykouris and Sergei Vassilvitskii. 2018. Competitive Caching with Machine Learned Advice. In Proceedings of the 35th International Conference on Machine Learning (Proceedings of Machine Learning Research, Vol. 80), Jennifer Dy and Andreas Krause (Eds.). PMLR, 3296–3305. https://proceedings.mlr.press/v80/lykouris18a.html
[28] Mark Manasse, Lyle McGeoch, and Daniel Sleator. 1988. Competitive Algorithms for On-Line Problems. In Proc. of the Twentieth Annual ACM Symposium on Theory of Computing (Chicago, Illinois, USA). Association for Computing Machinery, 322–333. doi:10.1145/62212.62243
[29] Joyce McLaren, Pieter Gagnon, and Seth Mullendore. 2017. Identifying Potential Markets for Behind-the-Meter Battery Energy Storage: A Survey of U.S. Demand Charges. Technical Report NREL/BR-6A20-68963. National Renewable Energy Laboratory.
[30] Yanfang Mo, Qiulin Lin, Minghua Chen, and S. Joe Qin. 2026. Real-time peak-demand minimization with energy storage using competitive ratio. Automatica 184 (Feb. 2026), 112687. doi:10.1016/j.automatica.2025.112687
[31] Yanfang Mo, Qiulin Lin, Minghua Chen, and Si-Zhao Joe Qin. 2021. Competitive Online Peak-Demand Minimization Using Energy Storage. arXiv:2103.00005, version 2. https://arxiv.org/abs/2103.00005v2
Jackson Bibbens, Adam Lechowicz, Nicolas Christianson, Bo Sun, and Mohammad Hajiesmaili
[32] Viswanath Nagarajan and Xiangkun Shen. 2017. Online Covering with Sum of -Norm Objectives. In 44th International Colloquium on Automata, Languages, and Programming (ICALP 2017) (Leibniz International Proceedings in Informatics (LIPIcs), Vol. 80). Schloss Dagstuhl – Leibniz-Zentrum für Informatik, Dagstuhl, Germany, 12:1–12:12. doi:10.4230/LIPIcs.ICALP.2017.12
[33] Ziyu Qu, Li He, Xinxin Ge, Fei Wang, Fei Xu, and Jinling Lu. 2024. A Two-Stage Forecasting Approach for Day-Ahead Electricity Price Based on Improved Wavelet Neural Network With ELM Initialization. IEEE Transactions on Industry Applications 60, 3 (May 2024), 5061–5073. doi:10.1109/tia.2024.3365456
[34] Mark Sellke. 2020. Chasing Convex Bodies Optimally. In Proceedings of the 2020 ACM-SIAM Symposium on Discrete Algorithms (SODA). Society for Industrial and Applied Mathematics, Philadelphia, PA, USA, 1509–1518. doi:10.1137/1.9781611975994.92
[35] Bo Sun, Jerry Huang, Nicolas Christianson, Mohammad Hajiesmaili, Adam Wierman, and Raouf Boutaba. 2024. Online algorithms with uncertainty-quantified predictions. In Proceedings of the 41st International Conference on Machine Learning (Vienna, Austria) (ICML'24). JMLR.org, Article 1915, 22 pages.
[36] Bo Sun, Russell Lee, Mohammad Hajiesmaili, Adam Wierman, and Danny Tsang. 2021. Pareto-Optimal Learning-Augmented Algorithms for Online Conversion Problems. In Advances in Neural Information Processing Systems, M. Ranzato, A. Beygelzimer, Y. Dauphin, P. S. Liang, and J. Wortman Vaughan (Eds.), Vol. 34. Curran Associates, Inc., Red Hook, NY, USA, 10339–10350. https://proceedings.neurips.cc/paper/2021/file/55a988dfb00a914717b3000a3374694cPaper.pdf
[37] Bo Sun, Ali Zeynali, Tongxin Li, Mohammad Hajiesmaili, Adam Wierman, and Danny H.K. Tsang. 2020. Competitive Algorithms for the Online Multiple Knapsack Problem with Application to Electric Vehicle Charging. Proc. ACM Meas. Anal. Comput. Syst. 4, 3, Article 51 (Nov. 2020), 32 pages. doi:10.1145/3428336
[38] Pauli Virtanen, Ralf Gommers, Travis E. Oliphant, Matt Haberland, Tyler Reddy, David Cournapeau, Evgeni Burovski, Pearu Peterson, Warren Weckesser, Jonathan Bright, Stéfan J. van der Walt, Matthew Brett, Joshua Wilson, K. Jarrod Millman, Nikolay Mayorov, Andrew R. J. Nelson, Eric Jones, Robert Kern, Eric Larson, C. J. Carey, Ilhan Polat, Yu Feng, Eric W. Moore, Jake VanderPlas, David Laxalde, Josef Perktold, Robert Cimrman, Ian Henriksen, J. E. A. Quintero, Charles R. Harris, Anne M. Archibald, Antônio H. Ribeiro, Fabian Pedregosa, Paul van Mulbregt, and SciPy 1.0 Contributors. 2020. SciPy 1.0: Fundamental Algorithms for Scientific Computing in Python. Nature Methods 17, 3 (2020), 261–272. doi:10.1038/s41592-019-0686-2
[39] Cheng Wang, Bhuvan Urgaonkar, Qian Wang, George Kesidis, and Anand Sivasubramaniam. 2013. Data Center Cost Optimization Via Workload Modulation Under Real-World Electricity Pricing. arXiv:1308.0585, version 4. https://arxiv.org/abs/1308.0585v4
[40] Lucas Weber, Ana Bušić, and Jiamin Zhu. 2023. Reinforcement Learning Based Demand Charge Minimization Using Energy Storage. In 2023 62nd IEEE Conference on Decision and Control (CDC). IEEE, 4351–4357. doi:10.1109/cdc49753.2023.10383414
[41] Weitiao Wu, Yue Lin, Ronghui Liu, Yaohui Li, Yi Zhang, and Changxi Ma. 2022. Online EV Charge Scheduling Based on Time-of-Use Pricing and Peak Load Minimization: Properties and Efficient Algorithms. IEEE Transactions on Intelligent Transportation Systems 23, 1 (2022), 572–586. doi:10.1109/TITS.2020.3014088
[42] Hong Xu and Baochun Li. 2014. Reducing Electricity Demand Charge for Data Centers with Partial Execution. In Proceedings of the 5th International Conference on Future Energy Systems. Association for Computing Machinery, New York, NY, USA, 51–61. doi:10.1145/2602044.2602048
[43] Lei Yang, Xinbo Geng, Xiaohong Guan, and Lang Tong. 2024. EV Charging Scheduling Under Demand Charge: A Block Model Predictive Control Approach. IEEE Transactions on Automation Science and Engineering 21, 2 (2024), 2125–2138. doi:10.1109/TASE.2023.3260804
[44] Lin Yang, Mohammad H. Hajiesmaili, Ramesh Sitaraman, Adam Wierman, Enrique Mallada, and Wing S. Wong. 2020. Online Linear Optimization with Inventory Management Constraints. Proc. ACM Meas. Anal. Comput. Syst. 4, 1, Article 16 (May 2020), 29 pages. doi:10.1145/3379482
[45] Ying Zhang, Mohammad H. Hajiesmaili, Sinan Cai, Minghua Chen, and Qi Zhu. 2018. Peak-Aware Online Economic Dispatching for Microgrids. IEEE Transactions on Smart Grid 9, 1 (2018), 323–335. doi:10.1109/TSG.2016.2551282
[46] Ying Zhang, Mohammad Hassan Hajiesmaili, and Minghua Chen. 2015. Peak-Aware Online Economic Dispatching for Microgrids. In Proceedings of the 2015 ACM Sixth International Conference on Future Energy Systems. Association for Computing Machinery, New York, NY, USA, 27–36. doi:10.1145/2768510.2768538
[47] Shizhen Zhao, Xiaojun Lin, and Minghua Chen. 2015. Peak-Minimizing Online EV Charging: Price-of-Uncertainty and Algorithm Robustification. In 2015 IEEE Conference on Computer Communications (INFOCOM). IEEE, 2335–2343. doi:10.1109/INFOCOM.2015.7218621
[48] Yunhong Zhou, Deeparnab Chakrabarty, and Rajan Lukose. 2008. Budget Constrained Bidding in Keyword Auctions and Online Knapsack Problems. In Lecture Notes in Computer Science. Springer Berlin Heidelberg, 566–576.
Artificial Intelligence Use Acknowledgment
The authors used generative AI tools in the creation of this paper and detail their role here. ChatGPT models produced PAWS and the matching lower bound of Theorem 4.1. These replaced an algorithm and lower bound which the authors had designed, which achieved the same competitive results but required a more involved analysis. ChatGPT also produced PAWS-DA and its matching consistency-robustness lower bound Theorem 5.1, for which there was no earlier author-designed version. ChatGPT produced the lower bounds on instance advice found in Lemma B.1 and Lemma B.2. The experimental code was generated by Codex, and AI tools were used to assist the literature search. The authors formulated the problem and model, designed the experimental study, independently checked all proofs, and substantially rewrote the generated material. The authors take full responsibility for the presentation and correctness of all content.
A Proofs of Preliminaries
In this section, we give the full proofs of results deferred from Section 2.
THEOREM 2.1. If , , and the horizon T is unknown, any algorithm for PA-OWT has competitive ratio .
PROOF. Fix a deterministic online algorithm, and consider a family of instances indexed by that begin by serving the price for . Let denote the amount the algorithm purchases on instance in each of the first timesteps. We break into two cases.
(1) Suppose there exists some such that . Then . Conclude the instance by presenting prices for , with some arbitrarily large . Then the algorithm incurs cost at least
while OPT has cost at most . Thus, the competitive ratio is at least
as .
(2) Suppose alternatively that there exists no such that . Then for any , conclude the instance with a single price . The algorithm incurs cost at least , while buying at each of the earlier prices is feasible with cost , so . Setting , the competitive ratio is at least
as (i.e., as ).
LEMMA 2.3. When , uniform purchasing for all is optimal for PA-OWT.
PROOF. Order the prices so that , allowing ties. We first show why it suffices to compare uniform purchasing with plans that buy equally in the cheapest rounds. Since and , an optimal plan can be chosen to buy exactly one unit. Fix its largest purchase . Subject to buying at most in any round, it is cheapest to buy at the lowest prices first. For
Jackson Bibbens, Adam Lechowicz, Nicolas Christianson, Bo Sun, and Mohammad Hajiesmaili
, where , this gives purchases of in the first rounds, in round , and zero thereafter. Their total cost is
which is linear in . Its minimum over that interval therefore occurs at or . These intervals cover all possible values of , so at least one optimal plan buys in each of the cheapest rounds for some , at cost .
Now assume . For every , we see that purchasing across the cheapest rounds is at least as expensive as uniform purchasing across :
Because , the cost of buying 1/T in every round satisfies
This also holds with equality when . Since some optimal plan has one of these forms, uniform purchasing is optimal. An online player that buys 1/T in each round is therefore 1-competitive in this regime.
B Proofs of Learning-Augmented Algorithms
In this section, we give the full proofs of results deferred from Section 5.
LEMMA 5.4. The PAWS-DA algorithm is -consistent for
Proof. Let A be the cost when directly following advice. We consider two cases.
Case 1. If then it is the case that every shadow variable and that for all because the peak charge is at most . Therefore, up until the step where constraint is satisfied. The PAWS-DA algorithm may buy more when , displacing at most one unit of lower prices (raising cost at most ) and increasing the peak purchase by at most .
Case 2. If A > H, we instead use the trivial bound
LEMMA 5.6. The PAWS-DA algorithm is -robust for .
Proof. As in Theorem 3.2 we will split the analysis into cases of whether a compulsory trade was needed.
No Compulsory Trade. By construction, we can see that the cost of the shadow decisions is at most . In each time step, if PAWS-DA purchases more than the shadow decision it must be the case that , so the price . The total mass of such purchases is at most 1, and the peak purchase of PAWS-DA is at most greater than the shadow algorithm. Thus, Cost(PAWS-DA) . Meanwhile we can trivially lower bound Cost(OPT) .
Compulsory Trade. Let be the first round in which the compulsory purchase exceeds both the price-threshold decision and the shadow decision. Earlier purchases total and each is at least its threshold decision. Since in future rounds, the compulsory condition implies
To bound OPT directly, let be any feasible schedule and set . Since for every , we have
The last step uses , , and . Hence Cost(OPT) . No purchase exceeds when , so Cost(PAWS-DA) .
Combining these results, we see that for a given , the PAWS-DA algorithm is -robust for:
PROPOSITION 5.7. Following advice ADV( ) can attain the optimal offline cost when predictions and are accurate. Additionally, neither nor predictions alone can attain optimal cost.
Proof. We begin by showing that having only one of is insufficient to reach 1-consistency.
LEMMA B.1. Consider any learning-augmented algorithm with predicted optimal cost . The consistency of ALG is .
Proof. Consider the following families of sequences for and
Jackson Bibbens, Adam Lechowicz, Nicolas Christianson, Bo Sun, and Mohammad Hajiesmaili
Both of these instance families have optimal cost 1 regardless of . For set , and for set .
Now, consider the purchases of learning-augmented ALG. On both instances , so ALG will purchase a set amount . For , let denote the total amount that ALG purchases across price 2. Thus, on , ALG will purchase . We can lower bound the cost on as follows:
Meanwhile, we can lower bound the cost on as
Thus, the consistency can be lower bounded as , which is minimized by equalizing the expressions and solving for .
Substituting this value into either side of the max expression gives consistency at least . Since can be made arbitrarily large, .
LEMMA B.2. Consider any learning-augmented algorithm with predicted optimal purchase count . The consistency of ALG is at least .
PROOF. We begin by establishing a helpful representation for the difference between Cost(ALG) and Cost(OPT), where m is the max purchase of ALG.
The equation holds by decomposing the price cost of ALG as , and recalling that is specifically the value where .
Now, let and set parameters such that for . In this region, note that both and are within . Consider the following families of sequences indexed by .
\mathcal{I}_{1}^{(T)}=\underbrace{(p,\ldots,p}_{k}\underbrace{q,\ldots,q}_{T-k}}\qquad\mathcal{I}_{2}^{(T)}=(p,\underbrace{L,\ldots,L}_{k}\underbrace{q,\ldots,q}_{T-k-1})Note that the optimal solution to is to purchase at each of the prices , for total cost . Meanwhile, the optimal solution to is to purchase at each of the prices 0, for total cost .
Upon observing , ALG cannot differentiate between the possible instances, and will purchase a constant . Recalling 9, we can state that the cost difference between ALG and OPT on thus satisfies:
Since , we can thus claim and .
Now considering , let be the total volume purchased during prices , and recall . Thus, was purchased during remaining prices , meaning max purchase . Recalling 9, we can state that the cost difference between ALG and OPT on is
Since p appears k times
Since
Therefore, we can bound the competitive ratio on as .
Combining these results, we find consistency is lower bounded by . This value is clearly minimized when . Substituting gives the result that consistency with only purchase count advice is at least .
Now that we have established that either prediction is insufficient by itself, we can observe that combining optimal cost and purchase count predictions results in a 1-competitive algorithm. Given perfect predictions ( , ), consider an algorithm which purchases . We can see this is exactly the structure of the optimal primal solution given in Equation 6. Thus, when both predictions are perfectly accurate, giving 1-consistency.