Repository navigation
Status at the limit: SCS_INDETERMINATE when the last iterate gives no estimate - #565
Merged
Merged
Conversation
…mate When SCS stops at max_iters or time_limit_secs at an iterate with tau = 0 (project_cones clips it at zero) and b'y >= 0, c'x >= 0, the iterate is an estimate of neither a solution, which needs tau > 0, nor a certificate, which needs b'y < 0 or c'x < 0. set_unfinished returned SCS_FAILED there, printed "ERROR: could not determine problem status.", left the raw iterate in x, y, s, never wrote pobj, dobj, gap, res_pri and res_dual, and appended " (inaccurate - reached max_iters)" to whatever info->status held (past the end of the field when the caller had not zeroed ScsInfo, as scs-matlab does not). It now returns SCS_INDETERMINATE (-3, no longer deprecated), status "indeterminate (inaccurate - reached max_iters)" (or time_limit_secs), with x, y, s and the objective and residual fields NaN. An iterate that is not finite (NaN or Inf in x, y, s, tau or kappa) is tested first and returns SCS_FAILED, status "failure" with no suffix, the same NaN fields; before, such an iterate could come back as "solved (inaccurate)" (tau is fixed at 1 in iteration 0) or as an inaccurate certificate. Every branch now writes the status before the suffix is appended. All tests are exact, so the status is a function of the last iterate alone; the iterates and the other branches are unchanged. No new setting, field or exit code; the existing all_finite is reused. Tests (box LP min 2x, -2 <= x <= 2): test_indeterminate_at_limit (max_iters 2 with a 0x7f-filled ScsInfo; max_iters 3, the default, and a warm-started re-solve as the other side) and test_nonfinite_at_limit (a warm start at half the largest scs_float, max_iters 1 and 2). Docs: exit flags (the -3 and -4 rows, a section on the status at the limit), settings, info, warm start, termination and help. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
bodono
marked this pull request as ready for review
November 25, 2026 21:38
This was referenced Nov 26, 2026
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.
When SCS stops at
max_itersortime_limit_secs,set_unfinishedreports what the last iterate supports. In one case it has nothing to report: tau = 0 (the cone projection clips it at zero) while b'y >= 0 and c'x >= 0. A solution estimate (x, y, s) / tau needs tau > 0, and a certificate estimate y / (-b'y) or (x, s) / (-c'x) needs b'y < 0 or c'x < 0, so the iterate is an estimate of neither. Until now SCS returnedSCS_FAILEDthere, which says that SCS broke when it only ran out of iterations, and it:ERROR: could not determine problem status.;" (inaccurate - reached max_iters)", with no prefix;pobj,dobj,gap,res_priorres_dual, so a zeroedScsInforead as gap 0 and residuals 0;statusheld. A caller that does not zeroScsInfo(scs-matlab declares it without initialising it) got its text past the end of the 128-byte field. With such aninfo, the test below aborts the test binary on master on macOS: the fortifiedstrcattraps.Change
SCS_INDETERMINATE(-3) with the statusindeterminate (inaccurate - reached max_iters)(ortime_limit_secs). x, y, s andpobj,dobj,gap,res_pri,res_dual,res_infeas,res_unbdd_a,res_unbdd_p,comp_slackare NaN. -3 is no longer deprecated. SCS 1.x and 2.x returned -3 in the same form.SCS_FAILED, statusfailurewith no suffix, the same NaN fields, and the lineFailure:the iterate is not finite (NaN or Inf). This test runs first, before the existing branches.strcpy, so the suffix is never appended to the caller's bytes.isfinite, tau > 0, the signs of b'y and c'x). The status depends only on the last iterate, with no threshold and no older iterate.all_finiteis reused.Why NaN rather than the raw iterate: the ray has no documented meaning and looks like a solution. The cost is that a warm start from this result starts from zero, as a cold start does, because
warm_start_varsreads NaN as 0. The scale and the per-row multipliers still carry over.Behaviour changes
solved (inaccurate - reached max_iters)today atmax_iters = 1, with a non-finite solution. Tau is fixed at 1 in iteration 0.Where the no-estimate case happens
Measured on master 4ccf238:
max_iters2 or 3;infeasible (inaccurate)on both, although beaconfd is feasible.Tests (test/problems/test_inaccurate.h)
The test problem is the box LP min 2x s.t. -2 <= x <= 2, which SCS solves in 25 iterations.
test_indeterminate_at_limit:max_iters = 2, withScsInfofilled with 0x7f bytes first.max_iters = 3gives 2;max_itersgives 1;test_nonfinite_at_limit: the box LP warm-started at x = y = s = half the largest finitescs_float, atmax_iters1 and 2. This tests an overflow.failure, and NaN x, y, s.info.iteris not checked: a linear solver that rejects the overflowed system itself also stops with -4 andfailure, at another iteration count.info. With a zeroedinfoit fails with -4 and the status" (inaccurate - reached max_iters)";max_iters = 1with status 2.Run on an M-series Mac (Apple clang, Accelerate's BLAS and LAPACK): the Make builds (default,
SFLOAT=1,USE_LAPACK=0,DEFLATE_VECTORS=0,DLONG=1,NO_PRINTING=1), each with the direct, indirect, dense and Accelerate test binaries it builds, plus CMake/ctest. All pass. Against master's logs, with timings removed, the only differences are the two new tests and the test count. The Accelerate binaries also differ in other tests, but by the same amounts as two runs of master do: Accelerate's sparse solver is not reproducible from run to run. The two new tests are also clean under ASan + UBSan, with the flags of the spectral job, for direct, indirect, dense and Accelerate, in double and single. Not run locally: MKL, cuDSS, the GPU solvers and gcc. In CI, the new tests pass in every job that runs them: Linux (gcc), Windows and macOS, in single and double precision; MKL; OpenMP; the spectral job with its sanitizers; Valgrind; and the simulated GPU and cuDSS jobs. In every one of those jobs the non-finite case reached the new branch and printed its line. None of them stopped with a failed linear solve instead.Docs
exit_flags.rst: the -3 and -4 rows, and a new section "At max_iters or time_limit_secs" on how the last iterate decides among 2, -6/-7, -3 and -4, and what each returns.settings.rst: themax_itersandtime_limit_secsrows, and "How to check it worked".info.rst: which fields are NaN.warm_start.rst: NaN entries of a warm start are read as zero.help/index.rst: a troubleshooting entry forindeterminate.Wrappers
SOLVER_ERROR, so CVXPY users get the sameSolverErroras before. Nothing is needed.INDETERMINATE("norm too small") should change. Tests for -3 and for the non-finite -4 can follow oncescs_sourcepoints at a commit with this change.status_valandstatusas given. The uninitialisedScsInfono longer leads to an overrun.For the maintainer
🤖 Generated with Claude Code