perf(optimizer): use direct HiGHS for shared storage - #883
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 19825e40fa
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| started, | ||
| prepare_ms, | ||
| "shared", | ||
| shared=True, |
There was a problem hiding this comment.
Model post-curtailment baseline flows on the shared path
For self_consumption requests where shared curtailment turns a low-PV scenario from export into import, shared=True reuses direct_highs.py's fixed pre-curtailment base_import = max(load - PV, 0) bound. The CVXPY shared model instead derives its auxiliary baseline flow after curtailment (model.py:753-766), so a feasible request—such as widely separated downside/upside PV scenarios behind an export cap—can return kInfeasible here while solving with CVXPY. Auto mode therefore incurs a failed solve before falling back, and shared_backend=highs fails outright; model the post-curtailment baseline flow equivalently or exclude these modes from direct eligibility.
Useful? React with 👍 / 👎.
Summary
Measured result
Local Apple M5 arm64 benchmark, 192 15-minute slots, one warm-up and five measured solves:
On those fixtures, the objective deltas were 0.000000049 and 0.000000115 ore. The largest battery-action deltas were 0.00000322 W and 0.00000886 W.
A seeded 80-case parity sweep also passed. Its largest objective delta was 0.0662 ore and its largest battery-action delta was 0.339 W, both within the existing solver tolerances.
Safety and scope
Auto mode uses the direct path only for continuous, cycle-safe HIGHS requests with storage alone. Commercial constraints, flexible loads, thermal loads, guarded tariffs, CLARABEL, forced MILP, and out-of-bound initial storage stay on CVXPY. Ordinary direct-path errors fall back to the unchanged CVXPY model and report the reason.
This changes the reported engine from
cvxpytohighspyfor eligible default shared plans. CVXPY remains installed and available as the fallback.Checks
make verify-allLimits