summaryrefslogtreecommitdiffhomepage
path: root/ir/lpp
diff options
context:
space:
mode:
authorManuel Mohr <manuel.mohr@kit.edu>2013-01-30 17:38:39 +0100
committerManuel Mohr <manuel.mohr@kit.edu>2013-01-30 17:48:26 +0100
commit5d79ee1d2e04babcad22d9b3ec4f1aee341f3bd5 (patch)
treeadd659fd47cf2542eb3f7e89bd549ff9f1a03b3f /ir/lpp
parent4a4429bf6bcc0dd483bc2e096f1cdd8d4e7d07c1 (diff)
lpp: Only set solution state to feasible if a solution was found.
Diffstat (limited to 'ir/lpp')
-rw-r--r--ir/lpp/lpp_gurobi.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/ir/lpp/lpp_gurobi.c b/ir/lpp/lpp_gurobi.c
index 7a01b17..02bfac8 100644
--- a/ir/lpp/lpp_gurobi.c
+++ b/ir/lpp/lpp_gurobi.c
@@ -190,8 +190,19 @@ static void gurobi_solve(gurobi_t *grb)
case GRB_INFEASIBLE: lpp->sol_state = lpp_infeasible; break;
case GRB_INF_OR_UNBD: lpp->sol_state = lpp_inforunb; break;
case GRB_UNBOUNDED: lpp->sol_state = lpp_unbounded; break;
- /* TODO: is this correct? */
- default: lpp->sol_state = lpp_feasible; break;
+ case GRB_LOADED: /* fallthrough */
+ case GRB_CUTOFF: lpp->sol_state = lpp_unknown; break;
+ default: {
+ int num_solutions;
+ error = GRBgetintattr(grb->model, GRB_INT_ATTR_SOLCOUNT, &num_solutions);
+ check_gurobi_error(grb, error);
+ if (num_solutions > 0) {
+ lpp->sol_state = lpp_feasible;
+ } else {
+ lpp->sol_state = lpp_unknown;
+ }
+ break;
+ }
}
if (lpp->sol_state >= lpp_feasible) {