Skip to content

Report MOSEK's solution status from the lifted SDPs - #13

Open
avinashresearch1 wants to merge 1 commit into
avi/stereo-localization-examplefrom
avi/lifted-sdp-solution-status
Open

avinashresearch1 wants to merge 1 commit into
avi/stereo-localization-examplefrom
avi/lifted-sdp-solution-status

Conversation

@avinashresearch1

Copy link
Copy Markdown
Owner

Stacked on #12 (borglab#2960), which is stacked on borglab#2959. Its branch avi/stereo-localization-example is the base here, so this PR shows only its own commit.

The MOSEK-backed LiftedSDPProblem<MonolithicSDP, MosekSDPSolver> and LiftedSDPProblem<ChordalSDP, MosekSDPSolver> report MOSEK's problem status but not its solution status, and solve() returns true whenever MOSEK returns. A solve that MOSEK stopped early, for example at optimizerMaxTime, therefore cannot be told apart from one that converged. This PR adds

std::string solutionStatus() const;

to both, next to problemStatus(). It returns MOSEK's primal solution status from the last solve: SolutionStatus::Optimal when MOSEK converged, and SolutionStatus::Unknown when it stopped early. Like problemStatus(), it throws before solve(). Both are wrapped for Python.

The change only adds API. A benchmark that certifies its solutions can now count a run as certified only when MOSEK reports an optimal solution.

Tests

  • testLiftedSDPs.cpp: the new SolutionStatus test checks, for both formulations, that the status throws before a solve, reads Optimal after a converged solve, and reads Unknown after a solve stopped by a zero optimizerMaxTime.
  • test_certifiable.py: the MOSEK wrapper test checks the same through Python.
  • MosekMonolithicSDP.ipynb lists the new accessor with the others.

Validation

CI does not build MOSEK and does not run on my fork, so I ran the checks locally on Ubuntu 24.04 with GCC 13.3, MOSEK 11.2 and Python 3.12:

Check Result
check.certifiable, with MOSEK 3 of 3 test files pass, including the new SolutionStatus test
test_certifiable.py after python-install, with MOSEK pass
Library build without MOSEK and with GTSAM_BUILD_WITH_WERROR=ON builds; the new code is MOSEK-only
clang-tidy 23.1.4 through clang-tidy-diff.py on the changed lines, with a MOSEK compilation database no findings
scripts/check_code_quality.py and its self-test, git diff --check pass

The MOSEK build had -Werror off: with MOSEK on, GCC 13 reports a spurious -Warray-bounds in SubstituteFixedVariables in LiftedSDPProblem.cpp on develop. This PR does not touch that function.


🤖 Posted by an AI agent · harness: Claude Code 2.1.325 (cli) · model: claude-opus-5-5
Review: unreviewed
Session: local Claude Code session abf6b61e-d2bb-4e00-913a-038009f6811d

The MOSEK-backed monolithic and chordal SDPs report MOSEK's problem status,
but not its solution status, and solve() returns true whenever MOSEK
returns. A solve that MOSEK stopped early, for example at optimizerMaxTime,
could not be told apart from one that converged.

Add solutionStatus() to both, next to problemStatus(). It returns MOSEK's
primal solution status from the last solve, Optimal when MOSEK converged and
Unknown when it stopped early, and throws before solve(). Wrap it for Python
and test it in C++ and Python, including a solve stopped by a zero time
limit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

1 participant