Skip to content

Fail fast when a myopic stage has no solution - #918

Open
mohammadrezwankhan wants to merge 1 commit into
GenXProject:mainfrom
mohammadrezwankhan:codex/fail-fast-myopic-stage
Open

Fail fast when a myopic stage has no solution#918
mohammadrezwankhan wants to merge 1 commit into
GenXProject:mainfrom
mohammadrezwankhan:codex/fail-fast-myopic-stage

Conversation

@mohammadrezwankhan

@mohammadrezwankhan mohammadrezwankhan commented Jul 23, 2026

Copy link
Copy Markdown

Description Fixes the myopic multistage workflow so a failed stage is reported at the point of failure. solve_model can return a model without primal values after logging that no solution was found. The myopic loop previously continued, and the next stage called fix_initial_investments on the unsolved prior model. That masked the original solver failure with a downstream ResultIndexBoundsError from value(...). This change checks has_values immediately after each myopic stage solve and aborts with the stage number, termination status, primal status, and raw solver status. Successful-stage behavior is unchanged. ## What type of PR is this? (check all applicable) - [ ] Feature - [x] Bug Fix - [ ] Documentation Update - [ ] Code Refactor - [ ] Performance Improvements ## Related Tickets & Documents Related to Discussion #917, where the downstream exception obscured a Stage 1 solve failure. ## Checklist - [x] Code changes are sufficiently documented; no user-facing configuration or API changed. - [x] The change is based on the latest main commit. - [x] Code has been tested to ensure all functionality works as intended. - [x] CHANGELOG.md includes an Unreleased > Fixed entry for #918. - [x] I consent to the release of this PR's code under the GNU General Public license. ## How this can be tested Tested with Julia 1.12.6 and HiGHS: - Added a two-stage end-to-end myopic-run test whose first stage is infeasible; it verifies the runner reports Stage 1 directly instead of entering the Stage 2 linking logic. - Verified the message contains termination_status=INFEASIBLE, primal_status=NO_SOLUTION, and the raw solver status. - Ran test/test_multistage.jl successfully. The focused test reports: text Myopic run stops at a stage without a solution | 5 passed

Copilot AI review requested due to automatic review settings July 23, 2026 17:40

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@mohammadrezwankhan
mohammadrezwankhan force-pushed the codex/fail-fast-myopic-stage branch 2 times, most recently from 37f7b0c to 01b2a9c Compare July 23, 2026 17:50
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.

2 participants