Repository navigation
Conversation
…budget Optional `uncertainty` block on the request: every step may deliver `ft_dev` less solar and `gt_dev` more demand than forecast, at most `budget` steps at once (Bertsimas and Sim). The worst case is priced as the extra import it forces and the export it takes away, so the plan keeps a battery reserve or charges from the grid ahead when that is cheaper than the exposure. Continuous variables and rows only. Solve time about doubles on the stored cases with 16 checkpoints. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Stored Wh reach the load at the discharge efficiency, so a reserve held to the end of the horizon hedged 11 % cheaper than importing the shortfall on any tariff. Consuming the reserve was free, while the plan kept booking the export of the solar the reserve displaces, which the worst case never earns: on a flat tariff the hedge bought a reserve from the grid for that credit. The reserve now counts eta_d of its stored Wh and its use costs the export price.
# Conflicts: # src/optimizer/optimizer.py
|
@andig Do you need any other logs of configuration data? |
|
@cp-fabian-pittroff thanks, both requests are useful. I replayed them against this branch. Strange solve The first response keeps the battery near full for the whole horizon (0.3 kWh discharged, ends at
The model maximises, so your first response is 5.2 worse on its own objective. None of the commits on this branch reproduces it, they all land at about -12.4. Your second response matches the replay exactly: charge from grid at 20 ct at night, discharge in the 30 ct evening. That is plain arbitrage (20 ct / 0.81 round trip ≈ 24.7 ct). The full battery plan looks like an incumbent cut off by the time limit and still reported as Not Solved Your log shows the split path with 5.3 s elapsed, which points to a time limit around 5 s. The hedge makes this request about 10× slower (0.2 s → 2 s here, more on slower hardware). Locally the first request comes back Not Solved with Logs that would help
🤖 Generated with Claude Code |
|
Strage solve: environment:
hardware:
Pod:
I can't reproduce the not solved request. |
|
@cp-fabian-pittroff thanks, that log explains it. With the hedge the joint probe takes about as long as its 2 s budget, so some requests fall back to the split. With Workaround until the hedge gets cheaper: set 🤖 Generated with Claude Code |
|
Please try #323, that should give similar results at much better performance. |
|
@andig should I also switch to cbc with the new version? |
|
Performance not feasible :/ |
The hedge paid one maximum over the horizon. Once a late step's worst case exceeded what any reserve could cover, that step alone set the cost and every other row went slack, so raising ft_dev or budget drained the earlier days back to s_min. Book the worst case import per step instead, as #315 did, on the precomputed worst case: cumulative import covers what the reserve does not, bounded by the step's discharge plus the deviation arriving in it, at that step's import price. The reserve consumed instead is priced at the export price. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>








Alternative to evcc-io/evcc#35923, which holds a fixed battery reserve against the same risk.
A schedule on the forecast alone drains the battery to its minimum whenever that is cheapest on paper, and a short solar afternoon then puts the evening on the grid at the evening price. This adds an optional
uncertaintyblock that makes the risk part of the cost instead of a fixed reserve: every step may deliverft_devless solar andgt_devmore demand than forecast, but at mostbudgetsteps do so at once (Bertsimas and Sim). The schedule stays as planned, the worst case over which steps deviate is priced as the recourse it forces, and the solver trades a battery reserve or an early grid charge against that exposure.uncertainty: {ft_dev, gt_dev, budget}onOptimizationInput, all optional, budget 0 or omitted leaves the model untoucheds_min, then extra import at that step's priceobjective_valuestays the plan's worth on the forecast as sent, the hedge is excluded like the other penaltiestests/test_uncertainty.py, Go client regenerated (theValid()churn is the checked-in client catching up with the oapi-codegen v2.7.1 bump ingo.mod)Performance on the stored cases with
ft_dev 0.3, gt_dev 0.2, budget 8, median of three solves each, two runs agree within 0.5 s, all stillOptimal(measured after the reserve pricing of 23fa06c):Longest horizon (028, T=245) goes from 1.3 s to 7.2 s. Cases with T below 10 are unchanged. Fewer checkpoints are not cheaper: at 8 the two-day case 020 turns hard and runs into the stage clocks. The cost is the per-checkpoint dual block, so the constant is the knob if production latency needs it.
🤖 Generated with Claude Code