Skip to content

Add Paper Problem 1 upstream reference generation#33

Open
bernalde wants to merge 1 commit into
pr/paper-ocp-validationfrom
fix/issue-27-upstream-reference
Open

Add Paper Problem 1 upstream reference generation#33
bernalde wants to merge 1 commit into
pr/paper-ocp-validationfrom
fix/issue-27-upstream-reference

Conversation

@bernalde
Copy link
Copy Markdown
Member

Summary

  • Add benchmarks/paper_problem1_reference.py to generate the Paper Problem 1 upstream reference via a batch-safe MATLAB wrapper, without editing the upstream clone.
  • Extend upstream .mat loading to preserve full-reference fields (policy, tsw) and expose metrics needed for initialization/comparison.
  • Add compare_paper_problem1_trajectories() for Pyomo-vs-upstream drying time, first switch time, terminal interface position, and max-temperature deviations.
  • Document the generation and comparison commands in the Paper OCP docs and Pyomo models README.

Tests run

  • python -m ruff check lyopronto/pyomo_models/paper_ocp.py lyopronto/pyomo_models/__init__.py benchmarks/paper_problem1_reference.py tests/test_pyomo_models/test_paper_ocp.py tests/test_pyomo_models/test_init.py - passed.
  • pytest tests/test_pyomo_models/test_paper_ocp.py tests/test_pyomo_models/test_init.py -k 'load_upstream or compare_paper_problem1 or reference_runner or pyomo_exports' -n 0 - 5 passed, 14 deselected.
  • pytest tests/test_pyomo_models/test_paper_ocp.py -m 'not slow' -n 0 - 11 passed, 3 deselected.
  • pytest tests/test_pyomo_models/test_init.py -n 0 - 5 passed.
  • python benchmarks/paper_problem1_reference.py generate --runner-only --work-dir /tmp/lyopronto-paper-problem1-runner --upstream-root /home/bernalde/repos/simDAE-optimalcontrol-lyo --output /tmp/lyopronto-paper-problem1-reference.mat - passed; wrote the batch-safe MATLAB wrappers and printed the matlab -batch command.
  • git diff --check and git diff --cached --check - passed.

Notes about tests not run

  • Full MATLAB/GEKKO reference generation was not run locally because there is no Linux matlab executable on PATH; the runner-only mode verified generation of the MATLAB wrapper files and command.
  • pytest tests/test_pyomo_models -m 'not slow' -n 0 --maxfail=1 failed during collection with ModuleNotFoundError: No module named 'tests.utils'; direct Python imports can resolve tests.utils.
  • Retried broader scope with python -m pytest tests/test_pyomo_models -m 'not slow' -n 0 --maxfail=1; it progressed through existing optimizer replay tests and was stopped after it became impractically long for this issue pass.

Closes #27

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