PR 3/7: Pyomo utilities and single-step optimization#8
Open
bernalde wants to merge 3 commits into
Open
Conversation
This was referenced Mar 3, 2026
fa26a34 to
65fc2c3
Compare
6fa03b3 to
58d26cd
Compare
65fc2c3 to
b8a82c3
Compare
bernalde
added a commit
that referenced
this pull request
Mar 3, 2026
pytest -m 'pyomo' exits with code 5 when no pyomo-marked tests exist. This is expected until PR #8 adds the first pyomo tests. Treat exit code 5 as success so the Pyomo Tests job passes gracefully.
58d26cd to
72e8b86
Compare
b8a82c3 to
53ad6d9
Compare
72e8b86 to
9b54119
Compare
53ad6d9 to
389c49e
Compare
bernalde
added a commit
that referenced
this pull request
Mar 16, 2026
Source fixes: - calc_knownRp.py: use constant.Torr_to_mTorr instead of literal 1000.0 in early-return path, with regression test Test fixes: - Fix percent-dried scale bug: 0.99 -> 99.0 across test_regression.py (5), test_optimizer.py (1), test_opt_Pch_Tsh_coverage.py (2+2), test_opt_Pch_coverage.py (2) - test_coverage_gaps.py: remove duplicate TestIneqConstraints class - test_functions.py: add value assertions to TestIneqConstraints - test_regression.py: skip column 0 (time) in stability test - test_calculators.py: add meaningful assertion in test_higher_pressure_dries_faster - test_web_interface.py, test_calc_unknownRp_coverage.py: use reference_data_path fixture instead of relative paths - test_calc_knownRp.py: add regression test for mTorr conversion Config fixes: - pyproject.toml: remove duplicate [tool.pytest.ini_options] (pytest.ini takes precedence) - pytest.ini: update minversion from 3.8 to 7.4 - requirements-dev.txt: add pytest-mock (matches pyproject.toml [dev]) CI fixes: - pr-tests.yml, tests.yml, slow-tests.yml: consolidate triple pip install into single pip install -e ".[dev]" - Remove hardcoded PR #8 reference from pyomo fallback messages Script fixes: - run_local_ci.sh: remove emojis, replace grep -oP with portable -oE, remove set -e/dead-code if-block, remove hardcoded -n 8, use pip install -e ".[dev]" Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
9b54119 to
a4d2f9a
Compare
c4356ba to
15eb233
Compare
a4d2f9a to
c60cf5e
Compare
bernalde
added a commit
that referenced
this pull request
Apr 17, 2026
pytest -m 'pyomo' exits with code 5 when no pyomo-marked tests exist. This is expected until PR #8 adds the first pyomo tests. Treat exit code 5 as success so the Pyomo Tests job passes gracefully.
This PR adds the foundational Pyomo modules: lyopronto/pyomo_models/utils.py (254 lines): - Warmstart utilities for initializing from scipy solutions - Variable scaling functions for numerical stability - Validation helpers for checking physical constraints - Result extraction and formatting utilities lyopronto/pyomo_models/single_step.py (427 lines): - Single time-point optimization formulation - Direct Pyomo model for one drying step - Basis for multi-period trajectory optimization - Physics constraints as Pyomo constraints Tests: - tests/test_pyomo_models/test_model_single_step.py - tests/test_pyomo_models/README.md These utilities are used by the multi-period model (PR 4) and the optimizer functions (PR 5).
15eb233 to
38607c8
Compare
bernalde
commented
May 7, 2026
Member
Author
bernalde
left a comment
There was a problem hiding this comment.
- Blocking issues: equipment capability can be silently omitted when
eq_capis provided withoutnVial; infeasible/non-optimal solves are returned as usable solutions;extract_solution_to_arrayadvertises the standard output format but writes rawdmdtand a placeholder dried percentage. - Nonblocking issues: the Pyomo test skip guard imports the Pyomo submodule before checking availability.
- Questions: none.
- Tests run and outcomes:
env PYTHONPATH=/tmp/LyoPRONTO_pr8 MPLCONFIGDIR=/tmp/mplconfig pytest tests/test_pyomo_models/test_init.py tests/test_pyomo_models/test_model_single_step.py -m "not slow": 11 passed.env PYTHONPATH=/tmp/LyoPRONTO_pr8 MPLCONFIGDIR=/tmp/mplconfig pytest tests/test_pyomo_models/test_model_single_step.py -m "slow": 3 passed.env PYTHONPATH=/tmp/LyoPRONTO_pr8 MPLCONFIGDIR=/tmp/mplconfig pytest tests/ -m "not notebook and not pyomo" --ignore=tests/test_pyomo_models: 235 passed, 2 skipped.- Initial run from
/tmp/lyopronto-pr8failed because the dash in the worktree directory name made pytest import the repo root under an invalid package name; reran from/tmp/LyoPRONTO_pr8.
- Merge recommendation: do not merge as-is.
I would not merge this until the blocking issues above are addressed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Core Pyomo building blocks.
utils.pyprovides parameter conversion from LyoPRONTO dicts to Pyomo-compatible formats, variable bound defaults, and warmstart helpers.single_step.pyimplements a single time-step steady-state optimization (one NLP solve per step), mirroring the scipy optimizer's step-by-step approach.PR 3 of 7 in the Pyomo integration series.
Changes
lyopronto/pyomo_models/utils.py— Shared utilities (variable bounds, parameter loading, warmstart)lyopronto/pyomo_models/single_step.py— Single time-step Pyomo modeltests/test_pyomo_models/test_model_single_step.py— 307 lines of teststests/test_pyomo_models/README.md— Test documentationKey Design Decisions
Pch(0.05–0.5 Torr),Tsh(-50–50°C),Tsub(-60–0°C)exp()PR Chain
Testing
~307 lines of new tests covering single-step model creation, solving, and parameter validation.