Benders decomposition
POMMES can solve the planning problem by Benders decomposition
(pommes.solver.benders.solve_benders()) as an alternative to the
monolithic solve. This page specifies the decomposition mathematically and
explains when it is worth using.
Problem structure
The monolithic problem built by pommes.model.build_model.build_model()
couples two families of variables:
planning variables \(x\), indexed by investment and decommissioning years \((y_{inv}, y_{dec})\);
operation variables \(u_y\), indexed by hour and operation year \(y\).
Which is which is not read off the names: every variable and constraint
carries its stage in the catalogue of the model
(pommes.model.catalogue.Catalogue, see Architecture),
written by the module that created it. The master keeps the planning
variables and the annual capacities (Catalogue.master_variables) and
the planning and linking rows (master_constraints); a subproblem pins
the planning decisions and states (fixed_in_subproblem), removes the
planning rows that define nothing (dropped_from_subproblem) and keeps
the rest; the master objective is made of the planning cost aggregates
(planning_cost_variables). pommes.solver.benders.planning_variables()
lists the pinned variables a given model still holds, in its order.
The only coupling between them is through the operational capacities
implemented by the operation_*_capacity_def constraints. Once
\(x\) is fixed, the operation years are independent of each other
(storage is cyclic within a year, carbon goals and import limits are yearly).
pommes.solver.benders.build_master() checks it on the monolith: a
constraint of the subproblems that holds the operation variables of two
years, or an operation variable without year_op, raises
NotImplementedError, since the subproblems are built one year at a time
and would drop that coupling.
Writing \(c_P(x)\) for the discounted annualised planning cost and
\(f_y(\kappa_y)\) for the optimal discounted operational cost of year
\(y\), the monolith is
where \(X\) is the planning feasible set (investment bounds, capacity bounds, retrofit constraints). Each \(f_y\) is the value function of a linear program parameterised by its right-hand side, hence convex and piecewise linear: Benders decomposition is exact.
Master problem
The master problem keeps the planning variables and bounds each year’s operational cost with an epigraph variable \(\theta_y\):
One cut is added per operation year and iteration (multi-cut): the number
of operation years is small, so the master stays small while converging in
fewer iterations than the aggregated single-cut variant
(multi_cut=False, which empirically needs roughly |year_op| times
as many iterations on POMMES problems and is only intended for future
settings with very many subproblems).
\(\theta_y\) is expressed in discounted units, so no rescaling of the subproblem values or duals is needed.
\(\theta_{lb}\) must be a valid lower bound on the discounted
operational cost of a subproblem at every plan. Otherwise the master prices
some plans above their cost: it is no longer a relaxation, and its lower
bound proves nothing. By default (theta_lb=None) the bound is chosen
(#148):
0 when no cost of the data can be negative. The sources are listed by
pommes.solver.benders.negative_cost_sources(): an export price on an export that is allowed, a negative variable, fixed, shedding or spillage cost, and a negative emission factor whose carbon tax outweighs the variable cost of its technology.Otherwise, the cheapest each subproblem can operate over the planning bounds of the master: the subproblem is solved once before the loop, its planning variables free between their bounds instead of fixed, and a margin of \(10^{-6}\), relative, is taken below its optimum.
A subproblem with no finite minimum there, such as uncapped exports served by a capacity without upper bound, has no valid constant bound, and
theta_lbmust be given.
Whatever its origin, a bound that a subproblem goes below at an evaluated
plan stops the run with a ValueError that names the sources. On one
area and two years that export up to 200 units a year at 2000, each year
worth about \(-6.3 \times 10^5\), the bound of 0 stopped the run at its
second iteration as "numerical_error", 2 % from the optimum. The
computed bound, \(-6.29 \times 10^5\) a year, reaches the optimum in 11
iterations at tol=1e-6.
Subproblems
The subproblem of year \(y\) at master iterate \(\bar x\) is the
full operational problem of that year, built from the year_op-sliced
input dataset, with
every
*annuity_cost*parameter set to zero, so that its objective is purely operational (the master accounts for planning costs; otherwise the duals below would double-count them), andthe planning variables kept but fixed by equality constraints
benders_fix_*:
where \(d_y\) is the discount factor and \(\Omega_y\) the operational feasible set. The dual vector \(\lambda\) of the fixing constraints is exactly the gradient of \(v_y\) in the space of the planning variables — linear-programming duality applies the capacity map \(A_y\) implicitly — which yields the optimality cut
valid globally by convexity of \(v_y\). Pure planning constraints
(investment bounds, retrofit caps: the planning rows of the catalogue that
define nothing) are removed from the subproblem: they are redundant under
\(x = \bar x\) and would otherwise attract degenerate duals. A planning
definition (planning_*_costs_def) stays, its variable read back from
the master, and so does every linking and operation row.
Operating conditions
With operating conditions (see Model Description), the conditions
\(k\) of a year share its capacities \(\kappa_y = A_y x\) and
nothing else: \(f_y = \sum_k f_{y,k}\), each \(f_{y,k}\) the
value function of the dispatch of one condition. A variable the
conditions of a year share although it is decided with the operation – the
TURPE contract power, shared_across_conditions in the catalogue –
breaks this independence: such a year is solved as one subproblem. Each
(year, condition) pair with a finite weight is a subproblem of its own,
with its own epigraph
variable \(\theta_{y,k}\) (benders_theta[year_op,
operating_condition]) and one cut per iteration
(pommes.solver.benders.subproblem_keys()). The subproblem keeps the
weight \(\pi_{y,k}\) of its condition, so its value is the share of
the expected cost of the year that the condition carries – fixed costs
included – and the values of the conditions of a year add up to its
expected cost.
The TURPE contract power couples the conditions of a year, being subscribed once for all of them. With TURPE enabled, the subproblems stay one per year, each holding every condition of its year.
One cut per year
With tens of conditions (climate years), the master gains one cut per
(year, condition) pair at every iteration. multi_cut="year" (#126)
keeps the subproblems one per pair – each solved apart, in parallel with
n_jobs – but gives the master one epigraph variable per year, \(\theta_y\)
bounding \(\sum_k f_{y,k}\) (benders_theta[year_op]), and one cut
per year and iteration, the sum of the cuts of its conditions:
It is the level between multi_cut=True (one cut per pair) and
multi_cut=False (one cut in all): the master stays at one row per year
and iteration however many conditions there are, for cuts that describe
each condition less well, so that the run may need more iterations. The
lower bound of \(\theta_y\) is the sum of those of its conditions.
Where a condition of the year needs slack at the point (a feasibility cut,
see below), the year has no optimality cut at that iteration, as the
single cut has none when any subproblem needs slack. Without conditions,
"year" is True. The string value keeps every call with a bool
meaning what it meant; solve_benders_subperiods(),
whose cuts of whole years bound the epigraph variables of their
sub-periods one by one, needs multi_cut=True.
Benders by batch
Each iteration solves every subproblem, though a few of them may already
show the point not worth finishing. batch_size (#126) solves them by
batches of that many epigraph variables – subproblems with
multi_cut=True, years with "year" – and stops as soon as the
batches solved prove it, the Benders by batch of Blanchot et al. (EJOR
2023), as Antares-Xpansion implements it.
Write \(\check\theta_g(x)\) for the cutting-plane model of group \(g\) (an epigraph variable) at \(x\): the largest of its cuts there, and its lower bound. The cuts being valid, \(\check\theta_g(x) \le v_g(x)\), and since \((x, \check\theta(x))\) is feasible in the master, \(c_P(x) + \sum_g \check\theta_g(x) \ge LB\). After each batch, the excess of the groups \(S\) solved so far, \(\Delta_S = \sum_{g \in S} \big(v_g(x) - \check\theta_g(x)\big)\), a lower bound of \(F(x) - c_P(x) - \sum_g \check\theta_g(x)\) where \(F(x) = c_P(x) + \sum_g v_g(x)\) is the value of the point, is compared with the remaining epsilon \(\varepsilon_r\):
without stabilisation, \(\varepsilon_r = \text{tol} \cdot \max(1, |UB|)\), the criterion of the paper: beyond it, the master point is not \(\varepsilon\)-optimal;
with stabilisation, the point evaluated is not the master’s optimum, and the stabilisation needs the value of every point that improves the incumbent – its centre for in-out, the level of the level set. So \(\varepsilon_r = \max\big(\text{tol} \cdot \max(1, |UB|),\; UB - c_P(x) - \sum_g \check\theta_g(x)\big)\): beyond it, the point is proven worse than the incumbent, which it therefore cannot replace. Before the first incumbent, \(UB\) is the best penalised value, as the level takes it.
Beyond \(\varepsilon_r\), the iteration ends with the cuts of the
batches solved and the master is solved again. A subproblem that needs
slack (a feasibility cut) proves the point infeasible, hence not worth
finishing, at once, except before the first incumbent with
stabilisation, where its penalised value counts. Only a full pass, every
batch solved at the same point, prices that point: it alone moves the
upper bound, the incumbent and the penalised bound. A stopped pass, proven
no better than the incumbent, shrinks the adaptive \(\alpha\) as any
point that does not improve it. With stabilisation, every point that
improves the incumbent is therefore found exactly as without batches. The
gap may close on any iteration, both bounds being valid throughout; the
final pass at the incumbent is unchanged. Each batch is solved on
n_jobs threads. history counts the subproblems solved
(n_subproblems), those solved again for their phase one
(n_phase_one) and the full passes (full_pass).
The order of the batches is batch_order:
"cyclic"(default): fixed batches in the order of the keys, taken in turn from the one after the last solved, as in Antares-Xpansion;"gap": the largest estimated gap first (Yu, Jürgens and Göke, arXiv 2607.05063, 2026). The value of each group at the point is interpolated by its nearest neighbour among the points it was solved at – each coordinate of the planning point scaled by its largest magnitude –, and the estimated gap is that value less \(\check\theta_g(x)\). The groups are sorted by decreasing estimate, those never solved first, and cut into batches: the excess grows fastest, and the iteration stops after fewer batches.
The criterion of the paper alone does not suit a stabilised run: the
iterations end at the first batch, the upper bound and the level are
seldom updated, and the stabilisation degrades to the cutting plane. On 2
years of 10 conditions (20 subproblems, HiGHS, tol=1e-6), it needed 56
iterations instead of 19 with the level set and batches of 4, and did not
converge in 100 with batches of 1.
Subproblem solves (iterations) on that set, full loop against batches in
either order (benchmarks/benders_batches.py, which writes
benchmarks/results/benders_batches_20261112_092247_50377fa.csv):
Stabilisation |
Full loop |
Cyclic, 4 |
Gap, 4 |
Gap, 1 |
|---|---|---|---|---|
level set (default) |
340 (17) |
404 (22) |
328 (23) |
341 (19) |
in-out |
700 (35) |
676 (35) |
684 (35) |
683 (36) |
none |
340 (17) |
344 (59) |
164 (37) |
110 (89) |
Taken in turn, the batches save little on these 20 subproblems of 10 hours, where the conditions weigh alike, and cost solves with the level set: the paper reports its savings on hundreds of scenarios. Against the full loop, the gap order saves 68 % of the solves without stabilisation, for more, cheaper iterations, and HiGHS 1.16.0 gives nearly the same counts. With the level set it saves 4 % under HiGHS 1.15.1, which made these counts; under 1.16.0 the full loop, cyclic and gap order take 380 (19), 304 (16) and 316 (17) solves (#165). Whether the gap order beats the cyclic one there depends on the vertices the solver returns. With in-out, whose points nearly all improve the incumbent and are priced whole, neither order matters. The timing on real cases belongs to the benchmarks.
Feasibility and elastic slacks
Load shedding and spillage give the subproblems complete recourse only
where their maximum capacities are unbounded. In typical POMMES datasets
they are bounded or forbidden for some resources, so a subproblem can be
infeasible at an intermediate master iterate (e.g. zero capacities) even
when the monolith is feasible. The subproblems are therefore built with
elastic slack variables on the adequacy constraint (both directions),
on the carbon goal and on the annual ceilings (conversion and
combined *_max_yearly_production, the yearly import and export caps,
production_group_max_yearly_production), penalised at penalty_cost
(default \(10^6\)), which keep every subproblem feasible. The ceilings
need it as soon as a must-run technology is capped: the master can build
more of it than its ceiling lets it run, and no shedding or spillage
absorbs a production floor.
Feasibility cuts (feasibility_cuts, on by default with the
interior level set of Convergence, off with in-out). Where a
subproblem cannot do without slack, the penalty would give a steep
optimality cut, its slope of the order of the penalty: such cuts
ill-condition the master, up to failures of every solver in the recovery
ladder (#124). That subproblem is instead solved a second time minimising
its total slack alone – every slack at cost 1, every other cost 0 –, the
two-stage separation with L1 normalisation of the automatic Benders of
CPLEX (P. Bonami, D. Salvagnin and A. Tramontani, “Implementing automatic
Benders decomposition in a modern MIP solver”, IPCO 2020). Its value
\(w(\bar x) > 0\) is convex in the planning point, and its duals
\(\mu\) give the feasibility cut
which excludes \(\bar x\) and no plan every subproblem can serve. Linopy
exposes no dual ray, but this phase-one problem is feasible, and its
ordinary duals are all that is needed. Only the objective changes, so the
persistent solvers keep their warm start. A point that needs slack is never
taken as the incumbent; when the cuts leave the master infeasible, or a
feasibility cut has no gradient while its value exceeds the noise of one
row (\(10^{-6}\) times the smallest row scale defined below), the
planning problem itself is infeasible and
pommes.solver.benders.BendersInfeasibleError is raised. Once an
incumbent exists, that verdict contradicts it – a subproblem was solved
wrongly at one point or the other –, and the run stops on the incumbent
with status "numerical_error".
A subproblem leans on its slack when one slack exceeds \(10^{-6}\), ten times the primal feasibility tolerance of HiGHS, times the scale of its row: 1 for the hourly adequacy rows, the right-hand side of each row for the carbon goal and the yearly ceilings, where the solver tolerance acts relative to it. The rows of a year cut into sub-periods that tie a week to a planning variable, its storage level at the end and its share of a yearly ceiling, have a right-hand side of 0: their scale is the value the variable is fixed to, at least 1. Each row has its own scale: a ceiling of 10 is not judged by the noise of a neighbour at \(10^7\). Slacks are compared one by one, not summed: summed over a large model, slack within the solver tolerance crosses any threshold (#121). An incumbent with noise slack can break a feasibility cut by that noise; should the final solve of the master at the incumbent fail on it, the master is solved without its cuts, which are then put back. The cuts are not relaxed by the noise instead: the master goes to the relaxed boundary, where the penalised optimum keeps slack of that order, priced at up to \(10^9\), and the upper bound stalls. Below it, the slack is noise and its penalty is left out of the value of the subproblem: at up to \(10^9\) per unit (see below), it would otherwise move both bounds by hundreds and stall the lower one below the optimum (#122).
The penalty then only prices the points that need no slack, where it caps
the steepest duals. It still has to be exact: should the penalised optimum
use slack at a point the phase one finds feasible, the penalty undercuts
the cost of serving the demand there, and a warning says so. With
feasibility_cuts=False, the penalised optimality cuts are used
throughout, as in earlier versions. Either way, if the final solution
leans on the slack, BendersResult.status is "elastic_slack" rather
than "optimal", and a warning says so. A run stopped by max_iter
keeps that status; BendersResult.elastic_slack holds the slack of the
incumbent in every case.
What a slack competes with is the cost of serving the demand, capacity
included. Capacity in service in year \(y\) is paid in every operation
year it lives through, each at its objective weight – the discount factor
times operation_year_weight –, so a peak that only a light year has can
cost the annuity times the weights of the heavier years that follow. The
penalty of year \(y\) is therefore multiplied by the sum of the
objective weights of the years closer to \(y\) than the longest life
span of the dataset, floored at 1 (penalty_weight). Weighted by its own
year only, a peak of a light year was still cheaper to slack than to serve.
The weight \(\pi_{y,k}\) of an operating condition is left out on
purpose. The capacity a rare condition needs is shared by the whole year
and paid at the full weight of the year, so a penalty scaled by
\(\pi_{y,k}\) would let the slack stand in for it; for the same reason a
condition of weight 0 keeps the full penalty and remains feasible.
Effective penalty. A subproblem of year \(y\) thus prices a unit of
slack at penalty_cost * penalty_weight(p, y), which the run logs at
INFO, in one line by year (and at DEBUG per subproblem). With year
weights [1, 1000], both years being within a life span of each other, that
is \(1.001 \times 10^9\) per unit in both.
A less steep window was studied and is not exact (#122). Looking forward only, \([y, y + \text{life span})\), assumes the capacity of year \(y\) can be built in \(y\); when it cannot – the investment stopped in \(y\), a single investment year –, it is built earlier and paid in the heavier years before \(y\): with weights [1000, 1] and gas investable in 2020 only, the forward window priced the 2030 peak at 1 and in-out Benders ended on the slack, 92 % below the monolith. The penalty of a year cannot take the life span of the technology it stands in for either, not knowing which one that is: with gas living 30 years and wind 10, weights [1, 1, 1000] and a 2020 peak only gas can serve, the shortest life span priced it at 1, 91 % below. Both cases are tests. A cap computed from a bound on the adequacy duals has the same problem: shedding costs and import prices bound them only under complete recourse, where no penalty is needed (see below).
The window matters only where the penalty prices the plans that need slack, that is without feasibility cuts. With them, such a plan is cut off by a feasibility cut whatever the penalty, which then only has to exceed the operational duals of its year at the plans that need none – and a run where it does not says so. On the cases above and those of #117 (a light peak, the floor, a rare condition of weight 0), every variant, even the weight of the year alone, matched the monolith to \(10^{-9}\) with feasibility cuts. The window is kept for both modes: lighter only with feasibility cuts, it would change the default runs, which is for a benchmark to decide.
Precision. Slack within the primal feasibility tolerance of the
subproblem solver (\(10^{-7}\) for HiGHS) is worth up to
\(10^{-7} \times\) penalty_cost \(\times \max_y\)
penalty_weight in the objective, \(10^2\) with weights [1, 1000].
Feasibility cuts take the penalty of such slack out of the values (see
above). Without them, it moves both bounds, and a tol below that amount
over the objective may not be reached: on the rare condition above
(weights [1, 1000]) at tol=1e-9, in-out and the level set without
feasibility cuts stopped on "numerical_error" for a condition of weight
0.001, and in-out failed in HiGHS on a subproblem for weight 0, while the
default run is optimal at \(10^{-9}\) in both. A run
without feasibility cuts therefore warns once when penalty_cost times
the largest penalty_weight times the feasibility tolerance exceeds
tol times the upper bound – the tolerance given in
subproblem_solver_options, \(10^{-7}\) otherwise. Raise tol, or
lower penalty_cost: it has to exceed the largest dual of the relaxed
constraints for a year of weight 1 only, penalty_weight doing the rest.
Complete recourse. Where every subproblem is feasible for any plan –
unbounded load shedding, no capped must-run technology, no carbon goal,
nothing pommes.solver.benders.check_recourse() warns about –,
penalty_cost=None is the right choice: the subproblems carry neither
slack nor penalty. On a dataset that never needs slack, the penalty only
weighs on the conditioning of the subproblems, so the gain is expected to
be small; the default stays, as it protects the datasets whose subproblems
can be infeasible.
Convergence
The master objective is a lower bound; \(c_P(\bar x) + \sum_y
v_y(\bar x)\) is an upper bound at every point that needs no slack. The
loop stops when the relative gap drops below tol or after
max_iter iterations. Because hourly dispatch problems are massively
degenerate, the raw cutting-plane iteration (stabilization=None)
oscillates, and starting from the zero-capacity plan it spends most of its
iterations at points that cannot serve the demand.
Interior level set (stabilization="level-interior", the default;
L. Pecci and J. D. Jenkins, “Regularized Benders decomposition for high
performance capacity expansion models”, IEEE TPWRS 2025,
doi:10.1109/TPWRS.2025.3526413). After the master solve gives the lower
bound \(LB\), a second master LP is solved, with zero objective and the
master objective as a constraint:
by an interior-point method stopped before crossover (level is
\(\lambda\), 0.5 by default). The point it returns lies near the
analytic centre of the level set, not at one of its vertices, and the
subproblems are evaluated there. The projection runs on the persistent
master of every backend, which keeps its basis across it where it
warm-starts (HiGHS, Gurobi), and through the linopy master with each
solver’s barrier options when persistent=False; should that solve
fail, the in-out point stands in. Before the first
incumbent, \(UB\) is the best penalised value of the points
evaluated so far: finite from the first one, it centres the iterates while
they still look for a feasible plan, and keeps the feasibility cuts from
turning that search into a raw cutting plane. The planning cost of the
level point is not a combination of known ones: it is priced on a copy of
the master taken before any cut, pinned at the point and solved by HiGHS
(a dependency of pommes, whatever the solver of the decomposition). Each
planning variable is pinned within \(10^{-6}\) of its value, relative:
an interior point without crossover meets the master’s planning
constraints only to about \(10^{-8}\) relative, above HiGHS’s primal
tolerance on large capacities.
Trust region (trust_region, off by default, 0.3 on the
multi-fidelity ladder). The centre of the level set ignores the incumbent:
near the optimum, where the cuts describe the recourse worst, it lands far
from the best plan known, and a run seeded with good cuts or a good
x_init loses most of their benefit. As in the double interior-point
regularisation of L. Göke and G. Sansavini (“Double interior-point
regularization for large-scale capacity expansion”, arXiv 2607.05047,
2026), once there is an incumbent \(\hat x\) the interior point is
sought within a box around it,
with \(k\) running over the entries of the variable of \(j\),
\(\rho\) the trust_region and \(g\) the relative gap: while
the gap is above 5 %, the incumbent is a poor anchor yet, and the box
widens in proportion. Where the box misses the level set, it widens twice
by 2, then is dropped. Iterations to tol=1e-3 (CPLEX, #127):
Case |
Level set |
Trust region |
|---|---|---|
TYNDP 3 zones at 6 h, no cuts |
132 |
42 |
TYNDP 3 zones at 6 h, 24 h level cuts |
123 |
27 |
study case 13/6 (42 subproblems) |
63 |
66 |
With one subproblem, the seeded run gains little from its cuts without the
box, and three quarters of its iterations with it. With many subproblems,
each iteration adds as many cuts and the model of the recourse is good
already: the box gains nothing there. Hence its default, off
for solve_benders() and on for
solve_benders_multi_fidelity(), whose levels
start from the cuts and plan of the coarser ones.
In-out (stabilization="in-out") evaluates the subproblems at
\(\hat x = \alpha \, x_{master} + (1 - \alpha)\, x_{incumbent}\).
adaptive_alpha adapts \(\alpha\) by the rule of X. Blanchot et al.
(EJOR 2023): times 1.2 when the point improves the upper bound, times 0.8
otherwise. snap_tolerance moves the coordinates of \(\hat x\) within
that distance of their bound onto it, as Antares-Xpansion’s roundXCut
does, so that residual capacities are not halved forever; it is off by
default, since moving a capacity down onto zero leaves demand unserved when
the optimum sits on the adequacy boundary, and it switches itself off at
the first point it makes infeasible.
On the synthetic system of benchmarks/benders_vs_monolith.py (HiGHS,
tol=1e-4, max_iter=300; the CSVs of commit 4bc76ab under
benchmarks/results/), the iteration counts are:
Stabilisation |
2 areas 3 years 1344 h |
3 areas 3 years 1344 h |
2 areas 5 years 2016 h |
2 areas 2 years 8760 h |
|---|---|---|---|---|
in-out, penalised cuts |
110 |
206 |
117 |
132 |
in-out, feasibility cuts |
137 |
>300 |
132 |
123 |
level, feasibility cuts |
34 |
41 |
31 |
34 |
The first row is the loop of 0.7.0 (stabilization="in-out",
feasibility_cuts=False, scale_theta=False), the last one the default; on
8760 h they take 122 s and 50 s. Feasibility cuts alone slow the in-out
loop down – on 3 areas it had not converged after 300 iterations –,
which is why they are off with in-out by default; but they keep the master
well conditioned, which the interior-point projection needs: with the
\(10^6\) penalty cuts, HiGHS’s interior point fails on most
projections.
Numerical safeguards. The epigraph variables are scaled by the largest
gradient coefficient of the first optimality cuts (scale_theta, as in
CPLEX): benders_theta then holds \(\theta / s\) and enters the
objective and the cuts with coefficient \(s\), which keeps the
coefficient range of a cut close to that of its gradient. Each cut is
cleaned of its negligible coefficients (at most \(10^{-9}\) of its
largest) by lowering its right-hand side by the largest value the dropped
term takes within the variable bounds, which keeps it valid; cuts whose
coefficient range still exceeds \(10^9\) are counted in the log.
Should the master fail through its whole recovery ladder once an
incumbent exists, the loop stops on it with status "numerical_error"
(#124): its objective is still an upper bound and the last master value a
lower bound.
Checked lower bound. The master objective is the lower bound, so a master solver that returns a wrong optimum and reports it optimal corrupts the stopping test.
On the penalised in-out cuts this does happen (#130). Those cuts carry the penalty slope summed over the hours: coefficients up to \(10^{10}\), right-hand sides up to \(10^{12}\). Which solver is wrong then changes with the instance, the presolve, even the order of the rows. On 2 areas / 5 years, every cut holds at the monolith optimum, yet:
At 2016 h, MOSEK solves the final master to 50 302 instead of 33 780.
At 8760 h, HiGHS’s simplex solves it to 41 174, where HiGHS’s interior point and MOSEK find 33 222.
The lower bound then crossed the upper bound, and 0.7.0 stopped as
optimal 0.1-0.2 % above the optimum, with only a warning logged.
HiGHS’s interior point with crossover was right on every master tried.
A lower bound is therefore checked on the same linopy master, cuts
included, by HiGHS’s interior point (without crossover if that fails;
never by the simplex, one of the solves the check is there to catch).
This happens when the bound
closes the gap on a master not already solved that way, or when it
exceeds the upper bound by more than 10 * tol. There are three
outcomes:
If the check finds the gap still open, its bound replaces the master’s, and the master is solved by HiGHS’s interior point for the rest of the run.
solver_config["master_solver"]and["master_options"]record the switch. On MOSEK, the in-out runs above then converge: to 33 787 at 2016 h (monolith: 33 786), and to 33 272 at 8760 h (monolith: 33 271).If the check also puts the bound above the upper bound, or fails on a crossing, the loop stops on the incumbent with status
"numerical_error".lower_boundis then not a valid bound.If the check fails (both interior-point solves) on a bound that merely closes the gap, the run ends with status
"optimal"on that unverified bound, with a warning, andBendersResult.lower_bound_uncheckedis True. The incumbent is a valid plan either way; only the gap rests on the master’s own solver.
Persistent solver backends
By default (persistent=True, supported for HiGHS, Gurobi, MOSEK,
CPLEX and COPT) the subproblems are re-solved through a persistent solver
object: the solver model is built once from the linopy model, each
iteration only patches the bounds of the benders_fix_* rows in place,
and the solver warm-starts from the previous basis. persistent=False
restores the plain linopy path, which regenerates the full solver model
at every iteration and is roughly 10-30x slower per subproblem re-solve.
Capacity rows as column bounds (capacity_bounds=True, the
default; #125). Once the planning variables are fixed, every operation
capacity of a subproblem is a constant, defined by its
operation_*_capacity_def row from planning variables alone. A row
that bounds one operation column by such a capacity – hourly conversion
power, must-run, storage level and power, transport flow –, or by a
constant, is then a bound on that column:
These rows are about half of a subproblem (157 704 of 315 450 on
3 areas / 1 year / 8760 h). The persistent backends delete them and set
the bounds at each evaluation, which takes them out of the simplex basis;
presolve does the same on a cold solve, but not on a warm re-solve. This
is CPLEX’s “generalised bound constraints” (Bonami, Salvagnin and
Tramontani, IPCO 2020, section 4.1). The cut gradient they carried is
rebuilt from the reduced costs: a column at the bound of its row with
reduced cost \(d\) gives the row’s dual \(y = d / a\), which adds
\(-b\, y\) to the derivative in \(\kappa\), carried to the
planning variables by the definition of \(\kappa\). The values,
cuts and stored duals are those of the rows (tested on HiGHS, MOSEK and
CPLEX; at zero capacity, where the dual is not unique, the gradients are
valid subgradients). A column takes at most one bound row per side, and a
capacity defined through other operation columns keeps its rows. The
linopy path keeps every row. On CPLEX and Gurobi, the subproblems with
bounds run with a primal feasibility tolerance of 1e-9 instead of their
default 1e-6, unless the options set it: with the bounds of capacities near
zero, a warm CPLEX re-solve left a power column at -2.6e-7, within the
default tolerance, beside a bound of 1.9e-6, which put an upper bound below
the optimum at tol=1e-8. Gurobi shares the default but is untested.
Basis resets. A stale basis suppresses presolve, so the basis used to
be reset whenever the planning point moved by more than
basis_reset_threshold (relative, 0.1). With the capacity rows as
bounds, warm re-solves are the cheaper ones, and the default
(basis_reset_threshold=None) keeps the basis whatever the step in
every subproblem where rows became bounds:
HiGHS caps each warm solve at four times the simplex iterations of the last cold one of the same objective (a phase one is counted apart), and solves cold if the cap is hit. A warm iteration costs about 30 µs with the bounds against 200-800 µs with the rows, where a warm solve far from its basis could take a minute.
CPLEX keeps its basis without a cap.
MOSEK never reset: its presolve gives false infeasibility certificates on these subproblems, so it runs without, which makes a cold solve far slower than a warm one.
A subproblem without bound rows, capacity_bounds=False, or an explicit
threshold resets the basis above the threshold, 0.1 by default. As the
choice is per subproblem, solver_config reports a list of the values
where the subproblems differ.
Failed solves (#137). A warm subproblem solve that fails is solved
again cold; if that fails too, HiGHS and CPLEX solve it once more with
presolve and the interior point, whose crossover leaves a basis for the
next warm solves (Gurobi and MOSEK raise the cold failure). A
subproblem that still fails has its solver model
(.mps) and the planning point written to a temporary directory,
named in the error, for replay. After the loop, a subproblem that fails
at the incumbent is solved through linopy instead, its persistent solver
model released first; should that fail too, the run returns with status
"report_failed" and the subproblems in failed_subproblems: the
plan (master), the bounds and the history are kept, and
loop_status says how the loop ended, hence whether lower_bound and
gap can be trusted. solution and dual assemble the
subproblems that were solved, NaN where a failed one is missing (#138):
the whole year when the year is one subproblem; for a failed (year,
condition) pair, what carries that condition, and what the year sums over
its conditions (annualised_totex, the duals of the capacity rows),
a sum that would otherwise lack the failed share without a sign. The
capacities in solution are the plan’s and stay complete, as does,
for a failed pair, the objective weight of its year in dual; the
other years are those of a run without failure.
Threads. With n_jobs > 1, the subproblems are solved by one pool of
threads for the whole run. A pool per iteration put each persistent
HiGHS subproblem’s re-allocations on fresh threads, hence on glibc malloc
arenas that fragmented instead of being reused, and the memory grew at
every iteration (#131).
HiGHS keeps one task scheduler per OS thread, started by the first run on
it for that run’s threads option, and a later run on the same thread
asking another count fails at once with status “Not Set”. The master and
the planning pricer run on the main thread; so do the subproblems of the
final pass after the loop, and of the whole loop with n_jobs=1. With
threads set differently for the master and the subproblems, as the
study benchmarks do (8 and 1), every HiGHS run of pommes
restarts its thread’s scheduler first when the count changes. Without
this, the 42 subproblems of a study case (7 years, 6 operating
conditions) all failed in the final pass (#137).
Memory of the subproblems (#136). A persistent subproblem keeps the
labels of its linopy model, not the model: solve_benders builds the
subproblems one by one and lets each linopy model go once its arrays are
read, and BendersResult.subproblems builds a model again when it is
read, with its solution at the incumbent. Each subproblem also parks
its solver object between two evaluations: a solve leaves its
factorisation and work arrays in the object, and clearSolver and its
counterparts release little of it. The model is kept as arrays (about
10 MiB for 100k columns, ModelArrays):
the matrix read once from linopy, the bounds and costs read back from
the solver at each park, with the basis. The next evaluation builds the
object again and solves warm from the basis. A subproblem is born parked,
so its object is first built where it is first solved, and only the
subproblems being solved, n_jobs at most, hold one. All five
backends park. MOSEK keeps the memory of a deleted task for the next ones
instead of returning it, so with MOSEK the peak goes down, not the
resident size of an idle process. Should an object fail to be built
again, the subproblem stays parked and the evaluation fails as a solve
would; should a park fail, the subproblem keeps its object. A parked
model has no names, so the files a failed solve writes (see Failed
solves above) include the linopy labels of its columns and rows.
The subproblems of a year share most of their arrays: two operating
conditions of a year of the study case differ in 300 of 361k matrix
coefficients, about 3000 of 57k row bounds and the costs of 4480 of 107k
columns, and not at all in the structure of the matrix, the column
bounds and the labels. An ArrayPool
holds one copy of what is equal, and a subproblem keeps only the entries
where it differs from the first of its year; the shared arrays are read
only. The parked model is the model as built: when the object is built
again, the subproblem first writes its last planning point into the
arrays, so that the basis is taken with the bounds it was saved with
(CPLEX and MOSEK check the statuses as they take them: a capacity column
at its bound has no such bound in the model as built, and CPLEX then
solved from scratch). A park reads nothing back from the solver. On the
42 subproblems of the case below, parked, the arrays take 154 MiB
instead of 718 MiB (3.7 MiB a subproblem instead of 17.1 MiB).
A solver object is still built for each evaluation rather than patched
from one condition to the next: that would save the build, not memory,
and the build is a small share of a warm evaluation of the subproblem of
2030 (compute1, six evaluations), the most patching could save:
Solver |
Build |
Warm evaluation |
Build share |
|---|---|---|---|
CPLEX |
0.020 s |
2.49 s |
0.8 % |
MOSEK |
0.055 s |
1.56 s |
3.4 % |
HiGHS |
0.080 s |
1.15 s |
6.5 % |
COPT |
0.466 s |
1.43 s |
25 % |
Peak RSS and time of the six subproblems of year 2030 of the study case (13/6 resolution, 107k columns and 95k rows each), evaluated twice each in turn, on compute1 (Gurobi not measured):
Solver |
Objects kept |
Objects parked |
|---|---|---|
HiGHS |
974 MiB / 35.9 s |
593 MiB / 39.4 s |
CPLEX |
746 MiB / 47.0 s |
496 MiB / 42.0 s |
MOSEK |
898 MiB / 64.9 s |
643 MiB / 64.0 s |
COPT |
1388 MiB / 40.3 s |
586 MiB / 44.9 s |
MOSEK needs the whole basic solution back, not only the basis: from its status keys alone, a warm solve at a moved point took more iterations than from scratch.
On the whole case (7 years × 6 operating conditions, 42 subproblems,
HiGHS, n_jobs=8), peak RSS goes from 13.7 GiB to 8.2 GiB over 60
iterations (9.1 GiB without the shared arrays), in 1739 and 1832 s (the
second on a busier machine; an earlier revision of the parking took
1760 s). A rebuilt object
warm-starts from the basis alone, without the solver’s other state, and
may stop at another optimal vertex of these degenerate subproblems,
hence other duals and other cuts: the two runs part from the second
iteration on, at the same pace (gap 0.14 % and 0.18 % at 60 iterations,
lower bounds within 0.007 %).
Construction of the subproblems (#141). With operating conditions,
the persistent path builds one linopy model per year, every condition
included, and cuts the subproblem of each condition out of its arrays: the
columns of the condition and the shared ones (capacities, planning
variables and costs, annualised_totex), the rows of the condition, and
the shared rows restricted to those columns. A row belongs to the
condition of its constraint. A constraint without the dimension is shared
if one of its rows holds a shared column, as annualised_totex_def, and
belongs to the condition of its columns otherwise, as the flexibility
windows, which carry the condition in their name. The rows alone would not
tell: a condition of weight 0 has no term in annualised_totex_def.
That constraint, the only one holding the columns of several conditions,
weights each by its own weight, so that its restriction is the row of the
condition’s model. The subproblems are those
built one condition at a time, rows and columns in the same order, so a
run is unchanged. linopy builds a year about three times faster than its
conditions one by one: on the study case 13/6 (42 subproblems), building
them takes 56.5 s instead of 141.1 s, and the peak RSS of the
construction goes from 642 MiB to 990 MiB, the model of a year, well
below that of the loop. A year whose conditions are not independent (a
row of one condition holding the columns of another) is built one
condition at a time. The linopy path, the final pass and
BendersResult.subproblems build one condition at a time.
Three of the five backends reuse linopy’s direct exports
(to_highspy, to_gurobipy, to_mosek). CPLEX has none: linopy’s
CPLEX driver round-trips an LP file on every solve, so that
backend assembles the cplex.Cplex object itself from model.matrices,
reading the same vectors in the same order so that row and column
indices keep matching the linopy labels. Its subproblems run on CPLEX’s
own defaults (presolve on, lpmethod=auto) with only threads=1
pinned, since subproblems already solve concurrently across operation
years. CPLEX’s Python API converts every vector to and from a Python
list, element by element and holding the GIL, which under concurrent
subproblems cost more than the solves themselves. The backend therefore
sets bounds and reads values, duals and reduced costs through the
callable library the cplex package loads, into numpy arrays
(ctypes), and falls back to the Python API if it cannot find it. Only
a library the process has already loaded is used, never another copy.
Its master, however, is solved cold (advance=0). Warm-starting it
from the previous basis after cut rows have been appended terminates
early while still reporting optimal, and always on the high side —
measured against a cold solve of the identical model on 3 areas / 5 years
/ 8760 h: +8.2 % at iteration 6, +23.0 % at iteration 10. Since the
master objective is the lower bound and cuts only tighten it, such an
over-estimate breaks the monotonicity the algorithm depends on, and was
observed driving the gap negative and the answer outside tol. Solving
the master cold costs nothing (it is a small model, and cold solves are
faster than the warm ones plus the recovery ladder they triggered). So
like MOSEK, though for a different reason and on the opposite side of the
decomposition, CPLEX does need one defensive override.
COPT has no direct export either, and its backend assembles the coptpy
model from model.matrices the same way (Model.loadMatrix). Its
bounds, costs and solution values go through coptpy’s matrix objects
(MVar, MConstr) and numpy arrays rather than lists of Var and
Constraint objects, and these calls are serialised across the process
(not the solves). coptpy holds the GIL through them but hands it over
often, and five subproblem threads queuing for it at every hand-over made
a few milliseconds of work last seconds. On 1 and 2 areas / 5 years /
8760 h, the subproblems took 43 s and 164 s through lists, without the
lock, and take 5.7 s and 22.5 s now (22.8 s and 52.7 s end to end, against
20.7 s and 35.9 s on CPLEX and 23.4 s and 53.6 s on HiGHS). coptpy deletes
rows lazily, and until it has done so the remaining rows keep their old
indices: the backend flushes the deletion (Model.update) before the
next bound is written. Like CPLEX it pins Threads=1 (the Threads
option overrides it), and tightens its feasibility tolerance on
subproblems with capacity bounds; neither that tolerance, nor never
resetting the basis, nor forcing the dual simplex changed the run time
measurably. Warm-starting the master after new cuts gives the same
objective as a cold solve (within 1e-15 at every iteration on 2 and 3
areas / 5 years), so unlike CPLEX the master keeps its warm start. All
models share one COPT environment, created without COPT’s banner. COPT’s
trial licence is bound to a user and a machine; without a licence, the
model size is limited to a few thousand variables.
Measured performance
Measured with benchmarks/benders_vs_monolith.py (synthetic
electricity system, 8760 hours, OCGT + wind + battery per area, areas
connected in a ring, tol=1e-4, monolith on the solver options of
pommes.utils.solver_options()). The raw runs are the CSVs under
benchmarks/results/; the parenthesised figure is the Benders
iteration count, and Ratio is monolith time over Benders time, so
above 1.0 means Benders wins:
Configuration |
Solver |
Monolith |
Benders (persistent) |
Ratio |
|---|---|---|---|---|
2 areas, 2 years |
HiGHS |
157 s / 1.4 GB |
50 s / 3.3 GB (34) |
3.1x |
2 areas, 2 years |
HiGHS |
124 s / 1.7 GB |
137 s / 4.2 GB (118) |
0.9x |
2 areas, 2 years |
CPLEX |
61 s / 1.8 GB |
82 s / 0.9 GB (140) |
0.7x |
1 area, 5 years |
CPLEX |
14 s / 1.7 GB |
29 s / 1.0 GB (56) |
0.5x |
1 area, 5 years |
MOSEK |
20 s / 1.8 GB |
47 s / 1.4 GB (30) |
0.4x |
2 areas, 5 years |
CPLEX |
68 s / 3.8 GB |
109 s / 1.9 GB (146) |
0.6x |
2 areas, 5 years |
MOSEK |
50 s / 3.5 GB |
209 s / 2.8 GB (52) |
0.2x |
2 areas, 10 years |
CPLEX |
187 s / 6.6 GB |
187 s / 4.4 GB (137) |
1.0x |
2 areas, 10 years |
MOSEK |
114 s / 5.8 GB |
292 s / 5.5 GB (49) |
0.4x |
3 areas, 5 years |
CPLEX |
496 s / 5.7 GB |
227 s / 3.3 GB (247) |
2.2x |
3 areas, 5 years |
MOSEK |
79 s / 4.7 GB |
467 s / 4.0 GB (68) |
0.2x |
All objectives agree within the 1e-4 gap tolerance. The first row and
the MOSEK rows are measured with the interior level set and feasibility
cuts, the defaults since #123 (first row: Benders at commit 4bc76ab,
monolith at 513c0a0, which leaves it unchanged; MOSEK rows: Benders
at 1671a44, monolith at 4d12a37, MOSEK 11.2). The other rows are measured with 0.7.0’s in-out
stabilisation and penalised cuts, which needed 2-5 times as many
iterations (see Convergence). The CPLEX rows have not been measured
again.
Benders is not a speed win at these sizes. The fastest monolithic option available is MOSEK’s interior point, which solves every configuration measured in under two minutes. Benders on MOSEK is 2.4-5.9x slower than it. With 0.7.0, Benders beat the monolith in exactly one measured pair (3 areas / 5 years on CPLEX, 2.2x) and tied in one more (2 areas / 10 years on CPLEX). Those say more about CPLEX’s algorithm choice on the full model than about the decomposition. On HiGHS, the default backend, the level set turned 0.7.0’s 10 % loss into a 3.1x gain.
On MOSEK, the level set cuts iterations but not time. It takes 30-68 iterations where 0.7.0 took 60-240, but each iteration costs more. The subproblems are re-solved by warm-started simplex, and the interior level points are far from the previous vertex, so each re-solve needs more pivots. On 2 areas / 5 years, in-out takes 136 iterations at 1.2 s of subproblem time each (225 s in all), its master on HiGHS’s interior point from iteration 126 (see the checked lower bound in Convergence). The level set takes 52 iterations at 3.0 s each (209 s).
What it does buy today is memory: with the CPLEX and MOSEK backends peak RSS is up to 49 % below the monolith, and never above it, because no single solver ever holds the full hourly model. The HiGHS backend used to be the exception, its memory growing at every iteration; with one thread pool for the run it is in line with the others (table below).
Subproblem cost (#125, #131). The capacity rows as column bounds, the
basis kept across steps, the CPLEX callable library and the single thread
pool, against main at f2a2057 (the defaults of #123), on compute1
(16 cores), tol=1e-4, 8760 h. Time, peak RSS and iterations of
Benders; the monolith column is the fastest monolith of #131 (CPLEX):
Configuration |
Solver |
Before |
After |
Monolith |
|---|---|---|---|---|
1 area, 5 years |
HiGHS |
27 s / 2.8 GB (23) |
25 s / 1.1 GB (26) |
7.7 s |
1 area, 5 years |
CPLEX |
27 s / 1.1 GB (27) |
20 s / 0.9 GB (27) |
|
1 area, 5 years |
MOSEK |
38 s / 1.4 GB (27) |
29 s / 1.1 GB (29) |
|
2 areas, 5 years |
HiGHS |
88 s / 8.8 GB (41) |
56 s / 2.2 GB (39) |
25.9 s |
2 areas, 5 years |
CPLEX |
59 s / 2.4 GB (39) |
36 s / 1.7 GB (36) |
|
2 areas, 5 years |
MOSEK |
189 s / 2.9 GB (54) |
117 s / 2.3 GB (56) |
|
3 areas, 5 years |
HiGHS |
150 s / 14.4 GB (47) |
85 s / 3.6 GB (49) |
73.8 s |
3 areas, 5 years |
CPLEX |
76 s / 3.1 GB (44) |
46 s / 2.4 GB (43) |
|
3 areas, 5 years |
MOSEK |
367 s / 4.1 GB (79) |
137 s / 3.3 GB (56) |
|
2 areas, 10 years |
HiGHS |
144 s / 23.9 GB (38) |
106 s / 5.1 GB (37) |
45.2 s |
2 areas, 10 years |
CPLEX |
100 s / 4.6 GB (37) |
66 s / 3.3 GB (36) |
|
2 areas, 10 years |
MOSEK |
258 s / 5.7 GB (49) |
144 s / 4.5 GB (47) |
Benders is 1.1 to 2.7 times faster, and its peak memory on HiGHS 2.5 to 4.7 times lower. The subproblems take 3 to 13 s of the CPLEX runs, against 9 to 45 s before. CPLEX Benders now beats the CPLEX monolith on 3 areas / 5 years (46 s against 74 s); MOSEK’s monolith is still the faster MOSEK option, and HiGHS’s monolith takes 138 s to more than 40 minutes on these cases (dev machine, 24 cores, #131).
The structural argument is the reason to keep it. The iteration count is driven by spatial coupling (30 iterations on one area against 68 on three with the level set on MOSEK; 56-60 against 240-247 with 0.7.0) and is nearly flat in the number of operation years, while each added year enlarges the monolith. More importantly, adding operational scenarios (climate years, demand scenarios) multiplies the subproblems while leaving the master untouched, so the decomposition’s cost grows linearly in a dimension where the monolith grows a single coupled LP. That regime is not benchmarked here, and it is where this implementation is expected to pay off.
Note
Earlier revisions of this page reported a consistent 3-5x speedup
over the monolith. Those measurements came from a subproblem-caching
path that was removed in commit e4f16b6 because it was solving
the wrong problem, and they are withdrawn. Only the table above
reflects the current code.
If memory is the binding constraint, lower n_jobs (fewer concurrent
solver copies) trades speed back for memory.
Which solve to use. If the model fits in memory and a commercial
barrier is available, solve the monolith: on the four cases of the table
above, the CPLEX and MOSEK monoliths beat the best decomposition on the
same solver everywhere but 3 areas / 5 years on CPLEX (Gurobi has not
been measured). COPT too: its monolith takes 7.9 s and 28.6 s on 1 and 2
areas / 5 years, Benders on COPT 22.8 s and 52.7 s (#135). With HiGHS
only, use Benders: HiGHS’s interior point is 6 to 30 times slower than
the commercial barriers on these models, and
Benders on HiGHS takes 25 to 106 s where its monolith takes 138 s to more
than 40 minutes, 5 to more than 20 times as long (the monolith on the
dev machine, #131). Use Benders as well when the monolith does not fit
in memory: Choosing a Benders method says which entry point.
benchmarks/benders_vs_monolith.py
reproduces these comparisons; its --threads option pins the thread
count of the monolith, and --load-shedding-capacity /
--load-shedding-cost add load shedding, which gives the subproblems
complete recourse.
Two-phase warm start
pommes.solver.benders.solve_benders_two_phase() reduces the
cold-start cost of the cutting plane. Phase 1 solves the decomposition on
a temporally aggregated copy of the dataset — hours averaged into blocks
of block_size by pommes.solver.benders.aggregate_hours() — to a
loose tolerance (phase1_tol, default 2.5 %). Its cuts are discarded,
since they are not valid lower bounds for the full-resolution recourse
(the Multi-fidelity ladder keeps them, its levels being certified
relaxations); only its incumbent planning point is kept and passed to the
full-resolution solve as x_init. The master therefore starts from a
sane incumbent instead of the zero-capacity iterate whose infeasible
subproblems produce the elastic-penalty “burn-in” of a cold start.
Superseded by the ladder. It was the recommended entry point on
large models with the in-out stabilisation of 0.7.0. On a TYNDP 2024 case
with 3 areas (FR, DE, NO) and 2 weather years (a 7.8 M-variable monolith,
solved in 242 s by Gurobi’s barrier), it reached optimal in 88
iterations, where the single-phase solve of 0.7.0 was still at a 56 % gap
after 40. Since the interior level set and the multi-fidelity ladder, it
lags: on TYNDP at 8760 h without capacity bounds, it was still at a gap of
0.35 % after 130 iterations and 5 h 15, where the ladder ended in 41
minutes (#127). It is kept for compatibility; see Choosing a Benders
method.
aggregate_hours averages the hourly profiles within each block and
leaves time_step_duration alone, letting
operation_year_normalization rescale the aggregated year; scaling the
step duration instead desynchronises the bare-power cost terms
(load shedding, spillage) from the energy-weighted ones. Aggregation is
information-lossless when the profiles are constant within a block, and
otherwise only affects phase 1 — the answer is always the
full-resolution optimum.
The technique follows S. Lumbreras and A. Ramos, “How to solve the transmission expansion planning problem faster: acceleration techniques applied to Benders’ decomposition”, IET Generation, Transmission & Distribution 10(10):2351-2359, 2016, doi:10.1049/iet-gtd.2015.1075, §3.2.3.
Multi-fidelity ladder
pommes.solver.fidelity.solve_benders_multi_fidelity() (#127) runs the
decomposition on a ladder of time resolutions, from blocks of 24 hours down
to the model itself, and keeps the cuts of every level. The two-phase warm
start keeps only the plan of its phase 1, whose aggregated model is not a
relaxation; here each level is one, so its cuts are valid lower bounds of
the model and the lower bound never goes back.
pommes.solver.fidelity.relax_hours() builds the levels. A block of
hours becomes one step of the duration of the block, and the copy relaxes
the model: any dispatch, averaged over the blocks, is a dispatch of the copy
that costs no more. build_model adds the demand, the load shedding, the
spillage, the net imports and the flexible demand to the energy balance as
energies, and the other flows times the step duration: the former, and
their bounds, are summed over the block, the availabilities averaged with
the step durations as weights, the hourly costs taken at their lowest (an
export price at its highest). A missing hourly value is first read as
build_model reads it: an availability of 1, a price or factor of 0, no
flexible demand, whose bounds then count for nothing. The storage levels are
exact at the block bounds. The ramps are taken relative to capacity between
whole blocks of steps of one duration, and dropped otherwise, the flexible
demand’s always; TURPE, whose hour types a block may straddle, is not
relaxed.
The storage dissipation and storage_factor_keep act on the level of
every hour, which the copy knows at the block bounds only. What a storage
loses over a block is a variable of the copy, between 0 and what it would
lose full, its energy capacity times \(\sum_h 1 - (1 - d)^{\Delta_h}\)
over the hours of the block (storage_loss_bound); storage_factor_keep
acts on a level of its own, between 0 and the energy capacity
(storage_keep_level_free), which stands for the mean level of the block.
The losses and flows of any dispatch of the model are among those the copy
may choose, so it stays a relaxation whatever spillage costs. Set to 0, as
they were, the losses left the copy without a sink the model has: with
must-run wind above the demand, a battery that loses energy and spillage at
500 a unit, the copy cost \(2.7 \cdot 10^7\) where the model costs 834.
On the TYNDP case only the batteries lose energy, \(4 \cdot 10^{-5}\)
an hour: a block of 24 hours may lose 0.1 % of their capacity.
The review of !122 found this and four other ways the copy
cost more, fixed since: a ramp into a shorter last block, a must-run with
gaps in its profile, a flexibility minimum on hours without flexible
demand, and steps of uneven duration.
On the TYNDP case of pommes-tyndp with 3 areas (BE, DE, FR), the year
2030 and one weather year (8760 h, monolith 1.0561e11 in 524 s by CPLEX’s
barrier), the optimum of the copy, a lower bound of the model, and the
hourly cost of its plan are
(benchmarks/results/fidelity/gonogo_tyndp_3_nodes_2030.csv):
Block |
Lower bound / optimum |
Hourly cost of its plan / optimum |
Subproblem solve (hourly: 62 s) |
|---|---|---|---|
24 h |
0.961 |
1.0034 |
2.3 s |
12 h |
0.965 |
1.0049 |
4.2 s |
6 h |
0.984 |
1.0017 |
9.1 s |
3 h |
0.997 |
1.0003 |
15.4 s |
The averaging of aggregate_hours, which keeps steps of 1 hour, gives
0.917 and a plan 17.6 % above the optimum at 24 h: its storage holds
24 times its capacity. Each level closes most of the gap left at a fraction
of the cost of the next one, hence the ladder rather than two phases.
A level is left once its own gap no longer pays its iterations. From the
moment its gap falls below check_gap (5 %), its incumbent is evaluated
at the next level, on the subproblems that level then runs on, and the
level stops when its gap is at most theta (0.5) times the excess of
that value over its own upper bound – the part of the gap the coarse
level cannot close. Otherwise the next check waits for the gap to reach
that value, or to halve if that comes first.
The rule of Mitchell et al. (a gap that closes by less than 0.5 % in 10
iterations) stops a level that stalls. Each level restarts the level-set
stabilisation from the best plan of the previous one, priced at its own
fidelity: a coarse upper bound is not one of the model. Only the last
level, the model, closes the gap at tol and certifies the optimum.
The persistent subproblems of a level and those of the next, from the first check on, are in memory at once: the peak is that of the last two levels.
The approach follows the multi-fidelity Benders decomposition of Mitchell et al. (Optimization Online, 2026) and the fidelity ladders of Cole et al. (arXiv 2603.29867, 2026).
Sub-periods
pommes.model.subperiods.split_into_subperiods() (#145) cuts the
operation years into sub-periods of a week, after Pecci and Jenkins (arXiv
2403.02559). A week is an operating condition: expectation, persistent
subproblems and cuts apply unchanged, and what couples the weeks becomes a
planning variable of the master, the storage levels at the bounds of each
week and the share of each annual ceiling it may use. The model is the same:
the two datasets have the same optimum.
A run on the weeks alone is not faster to a fine gap. Its subproblems cost 6 s an iteration instead of 100, but the master holds 300 cuts more at each iteration and takes over: on the study greenfield with 6 weather years at 3 h, the gap reaches 2 % in 42 minutes instead of 97, but 0.15 % only in 200 minutes, where the run on the years ends at 0.1 % in 181. Crossover alone costs 45 to 120 s a solve at 300 weeks, where the interior point takes 1.7 s with the capacity columns declared dense: these settings are those of the first phase below, for CPLEX. HiGHS is far behind on this master: with its interior point, 282 s an iteration at iteration 41, at a gap of 63 %. MOSEK, Gurobi and COPT were not measured.
pommes.solver.subperiods.solve_benders_subperiods() therefore runs two
phases. The first works on the weeks, and every 5 iterations below a gap of
15 % it solves the years whole at the current point: a cut on the sum of the
epigraph variables of the weeks of a year, and an exact upper bound. At a gap
of 2 %, the second phase runs solve_benders() on
the model from the best plan, with the cuts of the years, the lower bound of
the first phase and a box around that plan: without the box, the centre of
the wide level set of a master of few cuts leaves that plan, and the gap
stays at 2 % for 24 iterations. The result is that of the model, its dispatch
without any slack of a week.
On that greenfield with CPLEX, minutes to each gap, the two phases in one call that ends optimal at 0.1 % in 1 h 54, 76 + 62 iterations, without slack, with a peak of 38.3 GiB against 33.6 for the years:
Gap |
Years |
Weeks and year cuts |
Two phases |
|---|---|---|---|
5 % |
77 |
32 |
29 |
2 % |
97 |
42 |
38 |
1 % |
111 |
60 |
53 |
0.5 % |
139 |
113 |
69 |
0.2 % |
162 |
168 |
99 |
0.1 % |
181 |
> 240 |
114 |
The run on the years comes from the code before the cut pool, on the same machine.
All the time of the second phase is in the subproblems, the 6 whole years side by side: an iteration takes 100 s on 4 threads each, 117 s on 2, and 125 s with 4 years at a time on 7 threads.
The settings of the second phase were measured from the same plan at 2 %, where the uniform box of 0.3 reaches 1 % in 18 minutes and 0.1 % in 86:
a box of 0.15 or 0.6: 1 % in 21 and 33 minutes;
a box by family, 0.15 on the large plants (nuclear, hydro, solar, wind) and 0.6 on the flexibilities: 1.5 % only after 39 minutes;
the box of the large plants closing with the gap: the same as uniform; opening that of the flexibilities to 0.6 with it: 1 % in 39 minutes;
a width per entry from the distance between the master and the incumbent over the last 10 iterations, which foretells well what is left to go (rank correlation 0.66 to 0.91 at 2 % on three study cases): 0.1 % in 148 minutes, a well-sized box being no faster;
the entries the master has held at zero for 10 iterations set at zero in the level point, which keeps them above it: 0.1 % in 196 minutes;
leaving the weeks at 5 % instead of 2 %: 3.9 % after 46 minutes.
The plan alone does not make the gain. From the optimum of the year at 6 h, 1.4 % above the optimum at 3 h but without cuts of the years or lower bound, the gap is still at 5 % after 156 iterations. Plans of fewer weeks are far from it anyway: those of 13 weeks a year cost 8.7 % more than the optimum on the whole year at 3 h, those of 4 weeks 2.8 to 3.7 times more.
This is a gain on that case, not a rule. On the study case with 7 years, 6 conditions and 13 weeks a year, 546 weeks, a run on the years ends at 0.1 % in 83 minutes, where the weekly master, at 170 s an iteration, leaves the gap at 27 % after 84 minutes. The method suits few years of whole chronology, not a large number of weeks.
Tried without gain too: seeding the second phase with tangents of the weekly master at the evaluated plans, valid cuts that left the gap at 0.45 % after as long as the box alone takes to end; freezing the weekly cuts at 2 %, which reaches 0.5 % in 145 minutes; warm dual simplex on the master, 426 s against 1.7 s; solving the master or the level point once per iteration, without putting back the cuts it breaks until the next.
Choosing a Benders method
If the monolith fits in memory and a commercial barrier is available, solve
the monolith (see Which solve to use in Measured performance).
Otherwise, four entry points give the same result schema. Time to
tol=1e-3 (CPLEX, compute1), with the iterations in parentheses, on the
three realistic cases measured (#127, #145; the history of each run is
under benchmarks/results/fidelity/ and benchmarks/results/subperiods/,
with the scripts that ran them):
Case |
Subproblems |
Monolith |
solve_benders |
Ladder |
Sub-periods |
|---|---|---|---|---|---|
TYNDP, 3 areas, 2030, |
1 |
524 s |
1 875 s (44) |
616 s (56) |
not run |
8760 h |
|||||
study greenfield |
6 |
not run |
3 h 01 (109) |
2 h 49 (161) |
1 h 54 (138) |
2060, 6 weather years, |
|||||
2912 steps of 3 h |
|||||
study, 7 years, |
42 |
not run |
83 min (68) |
78 min (92) |
27 % gap |
6 weather years, 728 |
at 84 min |
||||
steps of 3 h |
solve_benders runs there with the box of trust_region=0.3 on TYNDP,
without which it had not converged after 6 hours, and without elsewhere.
The ladder has blocks of 24, 6 and 3 hours on TYNDP, and of 8 and 2 steps
on the study cases. Their monoliths were not solved.
solve_benders_multi_fidelity()is the entry point for Benders on a long chronology. It was never slower thansolve_bendersalone: three times faster where one subproblem holds the year, 6 to 7 % faster with 6 or 42 subproblems, whose iterations bring as many cuts already. It holds the subproblems of two levels at once, for a peak up to 20 % higher (12.3 GiB against 10.2 on TYNDP).solve_benders_subperiods()when a few years of whole chronology at a fine step make each subproblem long: on the greenfield it ends in 1 h 54, against 2 h 49 for the ladder. Not when the weeks are many: at 546 weeks, its master takes over (see Sub-periods).solve_benders()alone on small datasets, in tests, or to set each parameter.solve_benders_two_phase()is superseded by the ladder (see Two-phase warm start), and kept for compatibility.
Usage
import pommes
from pommes.solver import solve_benders
pommes.configure_logging() # shows the iteration table
result = solve_benders(model_parameters, solver="highs", tol=1e-4)
print(result.status, result.objective, result.n_iterations)
result.history # per-iteration bounds, gap and timings
result.solution # same schema as the monolithic model.solution
result.dual # same schema as the monolithic model.dual
On a ladder of fidelities (see Multi-fidelity ladder), the entry point on a long chronology (see Choosing a Benders method), blocks counted in steps of the dataset:
from pommes.solver import solve_benders_multi_fidelity
result = solve_benders_multi_fidelity(
model_parameters, blocks=(24, 6, 3), solver="highs", tol=1e-4
)
result.history.attrs["fidelity"] # status, bounds and time per level
By weeks, then on the years whole (see Sub-periods), with the two kinds of subproblems on their own settings:
from pommes.solver import solve_benders_subperiods
result = solve_benders_subperiods(
model_parameters,
solver="cplex",
tol=1e-3,
n_jobs=7,
subproblem_solver_options={"threads": 4},
subperiod_options=dict(
n_jobs=14, subproblem_solver_options={"threads": 1}
),
)
result.history.subperiods # which phase each iteration is of