Skip to content

Add methanol_availability model - #155

Open
bernalde wants to merge 1 commit into
mainfrom
feat/methanol-availability
Open

bernalde wants to merge 1 commit into
mainfrom
feat/methanol-availability

Conversation

@bernalde

@bernalde bernalde commented Nov 14, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Adds gdplib/methanol_availability, an availability-aware variant of the methanol GDP. Qi Chen wrote it in September 2020 alongside the original methanol model, but it was never added to GDPlib.
  • The operating profit is weighted by the system availability, which is the product of the availabilities of the installed compressors, heat exchangers, and expansion valve. Equipment capacities (1.2 × load or duty) and reactor volumes are decision variables. Each installed unit pays fixed, repair, and capacity costs.
  • Ported to the current methanol.py style:
    • binary_indicator_var in the objective
    • unit annotations and component docs
    • an m.profit Expression with a minimize(-profit) objective
    • build_model() with Big-M suffixes
    • solve_with_gdp_opt(algorithm=...)
    • Black formatting
  • Registered in gdplib/__init__.py, the module test lists, and generate_model_size_report.py. The regenerated README size table changes only by the new column.

Differences from methanol

Item methanol methanol_availability
Objective profit availability × operating profit − reactor and equipment costs
Product price 7650 8650
Electricity cost per unit load 175 + 0.255 255
Two-stage compressor fixed cost 50 replaced by per-unit equipment costs
Reactor volume fixed, 100 m³ variable, [30, 150] m³
temps[13], temps[18], reactor temperature [4.23, 8.73], [5.23, 8.73], [3, 8.73] [3, 6]
temps[23], temps[25] fixed at 4 fixed at 4.2
Production limit flows[22] <= 1 flows[23] <= demand = 1

The base methanol formulation is unchanged since 2020: main's model has the same variables, bounds, constraints, and objective as the version this variant was derived from.

Verification

  • Port equivalence: I built the 2020 code (patched only to use binary_indicator_var) and the port side by side. They have the same 318 variables and 474 constraints, with matching names, bounds, and domains, and identical constraint residuals and objective values at 5 random points.
  • Lint and tests: pixi run lint passes. pixi run test on this branch gives 351 passed and 3 skipped; the skips are the existing GAMS/BARON-only tests.
  • Newer Pyomo: the suite also passes against Pyomo 6.10.1 and Pyomo main (4a83eef, 2026-11-13). Building the model and applying gdp.bigm or gdp.hull emits no Pyomo warnings on 6.10.0, 6.10.1, or main.
  • Best known value: -2174.8024, with expensive feed, single-stage feed and recycle compressors, a cheap reactor, and availability 0.9318.
    • I fixed each of the 16 configurations with gdp.fix_disjuncts and solved it with IPOPT 3.14.20. All 16 terminated locally optimal.
    • GDPopt LOA (CBC 2.10.3 MIP, IPOPT NLP) reaches the same design in 15 iterations. It reports optimal on Pyomo 6.10.1 and feasible on Pyomo main, which reflects Fix non-rigorous crossed bound results Pyomo/pyomo#4013's non-rigorous-bound change.
    • The model is nonconvex, so this is not a global certificate.

Objective sense

The model keeps minimize(-profit), as methanol does (see #70 and #114):

  • LOA ignores a maximization sense in Pyomo ≤ 6.10.1. The fix is Fix GDPopt LOA maximization objective sense Pyomo/pyomo#3986, which is on Pyomo main but not in a release. I reproduced the bug with open solvers on methanol. On 6.10.1, maximize(profit) stops after 1 iteration at 1743.43, against 1793.43 for minimize(-profit). On Pyomo main, both senses give 1793.43 with the same disjuncts.

  • maximize(m.profit) crashes GDPopt for this model's nonlinear objective. This happens on 6.10.1 and on Pyomo main whenever MC++ is available. move_nonlinear_objective_to_constraints calls McCormick(discrete_obj.expr), and MC++ asserts (assert node_result not in self.refs in pyomo/contrib/mcpp/pyomo_mcpp.py) when the expression root is a named Expression. Minimal reproducer:

    m = pyo.ConcreteModel()
    m.x = pyo.Var(bounds=(1, 2), initialize=1.5)
    m.y = pyo.Var(bounds=(0, 3), initialize=1)
    m.e = pyo.Expression(expr=m.x * m.y)
    McCormick(m.e)       # AssertionError
    McCormick(m.e.expr)  # ok
    McCormick(-m.e)      # ok

    Reported upstream as McCormick (MC++) raises AssertionError when the expression is a named Expression Pyomo/pyomo#4085.

Not covered

Follow-up PR: #156 adds methanol_stochastic (two-stage stochastic extension with optional redundancy), stacked on this branch.

🤖 Generated with Claude Code

Add an availability-aware variant of the methanol synthesis GDP. The
operating profit is weighted by the system availability (the product of
the availabilities of the installed compressors, heat exchangers, and
expansion valve), equipment capacities and reactor volumes are decision
variables, and each installed unit pays fixed, repair, and capacity costs.

Qi Chen wrote the model in September 2020, alongside the original
methanol model, but it was never added to GDPlib. It is ported to the current
methanol.py style: binary_indicator_var in the objective, unit
annotations and component docs, a profit Expression, build_model() with
Big-M suffixes, the GDPopt helper with algorithm=..., and Black
formatting. Compared with the 2020 code at random points, the port has the
same 318 variables, 474 constraints, bounds, constraint residuals, and
objective values.

Tests cover the model structure, binary indicators in the objective, the
system availability of each compressor configuration (solver-free FBBT
check), the gdp.bigm and gdp.hull transformations, and the GDPopt option
pass-through. The README records a best known value from solving the 16
fixed configurations with IPOPT.

Co-authored-by: Qi Chen <qichen@andrew.cmu.edu>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant