Skip to content

Commit

Permalink
Mosek: warn on Q_NOT_PSD #229 #192
Browse files Browse the repository at this point in the history
On 'nonconvex QC' error, remind user to check if she has a SOCP
  • Loading branch information
glebbelov committed Jan 15, 2024
1 parent 87bedd9 commit 10da62d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion include/mp/flat/redef/conic/cones.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ class ConicConverter : public MCKeeper<MCType> {
"solver might not accept the model.\n"
"Try to express all SOCP cones in standard forms,\n"
"not in the objective.\n"
"See mp.ampl.com/model-guide.html#");
"See mp.ampl.com/model-guide.html.");
}
}
}
Expand Down
13 changes: 12 additions & 1 deletion solvers/mosek/mosekbackend.cc
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,18 @@ MSKsoltypee MosekBackend::GetSolutionTypeToFetch() {
}

void MosekBackend::Solve() {
MOSEK_CCALL(MSK_optimizetrm(lp(), &termCode_));
auto res = MSK_optimizetrm(lp(), &termCode_);
if (MSK_RES_ERR_CON_Q_NOT_PSD == res) {
AddWarning("Nonconvex QC",
"Mosek reported the problem as nonconvex QCP.\n"
"If the constraints are in fact Second-Order Cones,\n"
"make sure they have standard SOCP forms, and\n"
"the objective is linear by moving the\n"
"quadratic terms into auxiliary SOC constraints.\n"
"See mp.ampl.com/model-guide.html.");

}
MOSEK_CCALL( res );
solToFetch_ = GetSolutionTypeToFetch();
MOSEK_CCALL(MSK_getprosta(lp(), solToFetch_, &proSta_));
MOSEK_CCALL(MSK_getsolsta(lp(), solToFetch_, &solSta_));
Expand Down

0 comments on commit 10da62d

Please sign in to comment.