From 8da5bb00b690647318a12fa4f5dd7e6c8a0f501c Mon Sep 17 00:00:00 2001 From: martimbrandao Date: Tue, 23 May 2017 23:35:18 +0900 Subject: [PATCH] save gurobi's Irreducible Infeasible Sets (IIS) for easier debug of infeasible optimization problems --- src/sco/gurobi_interface.cpp | 5 ++++- src/sco/optimizers.cpp | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/sco/gurobi_interface.cpp b/src/sco/gurobi_interface.cpp index 69140f76..1d438475 100644 --- a/src/sco/gurobi_interface.cpp +++ b/src/sco/gurobi_interface.cpp @@ -188,7 +188,10 @@ CvxOptStatus GurobiModel::optimize(){ LOG_DEBUG("solver objective value: %.3e", objval); return CVX_SOLVED; } - else if (status == GRB_INFEASIBLE) return CVX_INFEASIBLE; + else if (status == GRB_INFEASIBLE) { + GRBcomputeIIS(m_model); + return CVX_INFEASIBLE; + } else return CVX_FAILED; } CvxOptStatus GurobiModel::optimizeFeasRelax(){ diff --git a/src/sco/optimizers.cpp b/src/sco/optimizers.cpp index 8e37ba89..9f1000bf 100644 --- a/src/sco/optimizers.cpp +++ b/src/sco/optimizers.cpp @@ -289,8 +289,9 @@ OptStatus BasicTrustRegionSQP::optimize() { CvxOptStatus status = model_->optimize(); ++results_.n_qp_solves; if (status != CVX_SOLVED) { - LOG_ERROR("convex solver failed! set TRAJOPT_LOG_THRESH=DEBUG to see solver output. saving model to /tmp/fail.lp"); + LOG_ERROR("convex solver failed! set TRAJOPT_LOG_THRESH=DEBUG to see solver output. saving model to /tmp/fail.lp and IIS to /tmp/fail.ilp"); model_->writeToFile("/tmp/fail.lp"); + model_->writeToFile("/tmp/fail.ilp"); retval = OPT_FAILED; goto cleanup; }