Skip to content

Fix biofuel site module constraints#133

Open
bernalde wants to merge 1 commit into
mainfrom
fix/issue-62-biofuel-modules
Open

Fix biofuel site module constraints#133
bernalde wants to merge 1 commit into
mainfrom
fix/issue-62-biofuel-modules

Conversation

@bernalde

Copy link
Copy Markdown
Member

Summary

  • Fix biofuel conventional and inactive site disjuncts so their no_modules constraints only reference module variables for the disjunct's own site.
  • Add focused regression tests that verify those constraints are site-local and that biofuel still reformulates with gdp.bigm and gdp.hull.

Tests run

  • pixi run pytest tests/test_biofuel.py -v --tb=short - passed, 4 passed.
  • pixi run pytest 'tests/test_module_imports.py::TestModelConstruction::test_model_construction[biofuel]' -v --tb=short - passed, 1 passed.
  • pixi run test - passed, 288 passed and 1 skipped.
  • pixi run lint - exited 0 after Black, critical flake8, non-blocking full flake8 report, and typos.
  • git diff --check - passed.

Notes

  • No solver-backed benchmark campaign was run locally; the default test coverage remains solver-free and this change is limited to model algebra and GDP transformation smoke tests.
  • Considered Plan PyPI release workflow and Pixi platform support #104 while keeping release and Pixi platform policy out of scope for this model fix.

Closes #62

@bernalde bernalde left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blocking issues: None.

Nonblocking issues: None.

Questions: None.

Tests run and outcomes:

  • git diff --check origin/main...HEAD passed.
  • /home/bernalde/.pixi/bin/pixi run pytest tests/test_biofuel.py tests/test_module_imports.py -v --tb=short passed, 72 passed.
  • /home/bernalde/.pixi/bin/pixi run test passed, 288 passed and 1 skipped.
  • /home/bernalde/.pixi/bin/pixi run lint passed. The configured non-blocking full flake8 report still printed existing style findings under --exit-zero.
  • gh pr checks 133 shows all CI checks passing.

This PR should be merged as-is based on the reviewed diff and checks. I am authenticated as bernalde, which is also the PR author, so I am submitting this as a COMMENT review rather than APPROVE; an eligible reviewer still needs to approve it.

@bernalde

Copy link
Copy Markdown
Member Author

Benchmark evidence from a Gurobi-only biofuel run on this PR branch (2026-05-12).

I skipped gdpopt.enumerate because the model has 252 disjunctions and enumeration is not a useful benchmark for this instance.

Command:

/home/bernalde/.pixi/bin/pixi run gdplib-benchmark run \
  --instances biofuel \
  --strategies gdp.bigm gdp.hull gdpopt.loa gdpopt.gloa gdpopt.lbb gdpopt.ric \
  --timelimit 300 \
  --solver-profile gams-gurobi \
  --gams-nlp-solver gurobi \
  --gams-mip-solver gurobi \
  --gams-minlp-solver gurobi \
  --gams-local-minlp-solver gurobi \
  --run-id pr133_biofuel_gurobi_300s_20260512 \
  --no-skip-existing

Preflight passed with GAMS available at /home/bernalde/packages/gams51.2_linux_x64_64_sfx/gams, Gurobi passed through as the GAMS solver for all direct and GDPOpt roles, and gdplib.biofuel.build_model() constructed successfully.

Strategy Termination Status Objective / UB LB Gap / note User time
gdp.bigm feasible ok 4218.625696814297 2643.195761590122 Gurobi time limit; log gap 37.3446% 300.653s
gdp.hull optimal ok 4099.7532529378705 4059.94206212711 Gurobi reports optimal within optcr=0.01; log gap 0.9711% 4.009s
gdpopt.loa maxTimeLimit ok 4956.837856441751 -inf / missing 1 GDPOpt iteration; did not converge bounds 302.059s
gdpopt.gloa maxTimeLimit ok 4956.837856441751 -inf / missing 1 GDPOpt iteration; did not converge bounds 302.312s
gdpopt.lbb failed n/a n/a 1360.703440658028 before failure no feasible solution recorded; Pyomo AttributeError: 'GDP_LBB_Solver' object has no attribute '_get_final_results_object' about 302s
gdpopt.ric maxTimeLimit ok 4956.837856441751 -inf / missing 1 GDPOpt iteration; did not converge bounds 302.563s

Generated artifacts are local/ignored under:

  • gdplib/biofuel/benchmark_result/pr133_biofuel_gurobi_300s_20260512/
  • benchmark_runs/pr133_biofuel_gurobi_300s_20260512/

The solve cases completed, but the benchmark command exited nonzero after writing the results because the optional post-run summary step could not import generate_benchmark_summary_all. The per-case JSON/log files and benchmark_runs/.../results_flat.json were written before that summary failure.

Important caveat: direct transformed GAMS solves on this PR branch still use the benchmark runner's current direct-solve default optcr=0.01; the gdp.hull "optimal" result is therefore a 1% GAMS/Gurobi certificate, not a 1e-6 certificate. The separate benchmark-gap change in #134 should be used for a stricter direct-solve rerun.

Takeaway: GAMS/Gurobi on the direct Hull reformulation is currently the best evidence for this biofuel instance in this run: it found 4099.7532529378705 quickly, with a 4059.94206212711 bound. Direct Big-M and the GDPOpt variants were materially weaker at the 300-second limit.

@bernalde bernalde force-pushed the fix/issue-62-biofuel-modules branch from 33b988e to f4ecc83 Compare May 14, 2026 16:19
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.

Refactor biofuel to fix benchmark issues

1 participant