WIP: upgrade to rtc-tools 2.7.3, casadi 3.7.2, rtctools-highs 0.1.3#483
WIP: upgrade to rtc-tools 2.7.3, casadi 3.7.2, rtctools-highs 0.1.3#483jarsarasty wants to merge 2 commits into
Conversation
- Replace rtc-tools-gil-comp and casadi-gil-comp with rtc-tools 2.7.3 and rtctools-highs 0.1.3 (casadi 3.7.2 pinned transitively) - Register HiGHS 1.14.0 CasADi plugin via import in mesido/__init__.py - Widen python_requires to >=3.10,<3.15 - Update solver docstrings from cbc to HiGHS - Fix __state_vector_scaled duplication: delegate to BaseProblemMixin - Add BaseProblemMixin to FinancialMixin bases - Add presolve=off workaround for HiGHS 1.14.0 (ERGO-Code/HiGHS#2388) in HeatProblem and HeatProblemSetPoints; HeatProblemPlacingOverTime explicitly removes it as it needs presolve on for correct solution - Fix test_multicommodity: use asset IDs and correct .__disabled key - Fix test_electricity_storage: use asset IDs, relax tolerance - Fix test_gas_pipe_topology_optimization: relax atol 1e-10 -> 1e-6 - Add test_highs_solver.py: verify HiGHS 1.14.0 and GIL release - Raise tox.ini end_scenario_sizing timeout 120s -> 300s - Remove CBC solver override from test_multicommodity price_profile test - Tighten python_requires to <3.13 (pandas<2.0 has no wheels for 3.13+) - Add comment on CBC removal in test_multicommodity explaining why HiGHS 1.14.0 via rtctools-highs 0.1.3 now passes correctly Known failing (WIP): - test_head_loss::test_heat_network_pipe_split_head_loss: HiGHS 1.14.0 finds different valid flow split; test assumption too strict - test_end_scenario_sizing_staged: IndexError on _priorities_output[1], suggests a priority solve is failing with HiGHS 1.14.0
|
Hi @KobusVanRooyen, With the changes in this PR, we can finally run the latest Highs version (1.14) in mesido. However, two tests are failing due to numerical issues or testing assumptions, and some adjustments should be implemented in a separate PR before we merge this PR:
The piecewise-linear DW approximation introduces near-zero constraint coefficients that can cause numerical ill-conditioning in HiGHS 1.14.0, potentially leading to a suboptimal solution. The assertion could be relaxed to a lower-bound check pending investigation
|
Hi @jarsarasty. Some feedback:
And by the way the only test that I see currently failing is tests/test_head_loss.py::TestHeadLoss::test_heat_network_pipe_split_head_loss (with all the presolve turned in the branch dated 2026/06/10) |
| "pyesdl == 26.3", | ||
| "pandas >= 1.3.1, < 2.0", | ||
| "casadi-gil-comp == 3.6.7", | ||
| "rtctools-highs == 0.1.3", |
There was a problem hiding this comment.
Currently the specific HIGHS and CASADI version cannot be specified in MESIDO. Would it be possible to change the rtc-tools-casadi-plugins such that the HIGHS and CASADI version numbers are inputs?
| Operating System :: MacOS | ||
| """ | ||
|
|
||
| if sys.version_info < (3, 10): |
There was a problem hiding this comment.
I would not remove this but rather update the version numbers
| achieved by having an upper limit on the investment per time-step. | ||
| """ | ||
|
|
||
| def solver_options(self): |
There was a problem hiding this comment.
I am aware that you will still investigate potential solutions such that we do not have to turn of presolve. But this part is not needed, since presolve is already turned off in the inherited problem class (HeatProblem)
| Operating System :: MacOS | ||
| """ | ||
|
|
||
| if sys.version_info < (3, 10): |
There was a problem hiding this comment.
Please update with main before continuing, since there has been some fixes regarding network settings which might have an impact on the head loss testing
| highs_options["mip_rel_gap"] = 0.02 | ||
| highs_options["presolve"] = "on" | ||
|
|
||
| # workaround for HiGHS 1.14.0 presolve bug (ERGO-Code/HiGHS#2388) |
There was a problem hiding this comment.
Not ideal. Any other insights in this one to potential get rid of this?
So this one is here for test_setpoint_constraints.py (test_run_small_ates_timed_setpoints_2_changes, test_run_small_ates_timed_setpoints_0_changes, test_run_small_ates_timed_setpoints_multiple_constraint --> presolve_infeasible_or_unbounded_priority_1)
| options["casadi_solver"] = self._qpsol | ||
| highs_options = options.setdefault("highs", {}) | ||
| # workaround for HiGHS 1.14.0 presolve bug (ERGO-Code/HiGHS#2388) | ||
| highs_options["presolve"] = "off" |
There was a problem hiding this comment.
HiGHS#2388 -> I assume this refers to a specific issue number, but I cannot find it in https://github.com/ERGO-Code/HiGHS/issues?q=is%3Aissue%20state%3Aopen
Can you please clarify?
| """ | ||
| options = super().solver_options() | ||
| options["casadi_solver"] = self._qpsol | ||
| highs_options = options.setdefault("highs", {}) |
There was a problem hiding this comment.
Not ideal. Any other insights to potentially not turn off presolve?
This one is needed for tests/test_ates.py::TestAtes::test_ates
| @@ -0,0 +1,77 @@ | |||
| """Tests for HiGHS 1.14.0 integration via rtctools-highs. | |||
There was a problem hiding this comment.
I am a bit uncertain about this test. Since the idea originally was to be able to specify the version number of casadi and highs in mesido (de-linked via mesido). I will think about this topic a bit futher and get back to you
But here is some feedback:
In this test all version numbers are hard-coded and specific version numbers are also mentioned in the comments/doc strings. I think this needs to be made a bit more generic with no version numbers mentioned in the text and all version numbers in the test itself should ideally be a variable where one sets the version number.
Known failing (WIP):