The attached LP file results in a Status Code 1 after optimizing with Gurobi. I believe this is because it is pre-solved without any simplex iterations. While it is a simple model with an obvious solution, I am using it to initialize a column generation algorithm, and therefore need the information provided by the dual. I can certainly compute the dual using the strong duality theorem, but I'd rather avoid the extra programming if I can make Gurobi do the work for me.
My questions are:
1. Why is the status code 1 returned, when in fact the console output suggests the problem has been solved?
(my suspicion is that it is because there are no simplex iterations performed and therefore there will not be any dual information)
2. Is there a way I can change my model or a gurobi parameter such that I get a status code 2 (for optimal)?
The console output:
Optimize a model with 73 rows, 73 columns and 73 nonzeros
Coefficient statistics:
Matrix range [1e+00, 1e+00]
Objective range [2e+03, 2e+03]
Bounds range [1e+00, 1e+00]
RHS range [1e+00, 1e+00]
Presolve removed 73 rows and 73 columns
Presolve time: 0.00s
Presolve: All rows and columns removed
Iteration Objective Primal Inf. Dual Inf. Time
0 3.8400000e+03 0.000000e+00 0.000000e+00 0s
Solved in 0 iterations and 0.00 seconds
Optimal objective 3.840000000e+03
The method which calls the optimization:
bool ILP::optimizeRelaxation() {
try {
_model->write("test.lp");
GRBModel relaxation = _model->relax();
relaxation.write("relax.lp");
relaxation.optimize();
int model_status = _model->get(GRB_IntAttr_Status);
// If the model timed out, exit.
if (model_status == GRB_OPTIMAL) {
double objval = _model->get(GRB_DoubleAttr_ObjVal);
assert(objval >= 0);
std::cout << "Optimal objective: " << objval << std::endl;
return true;
} else if (model_status == GRB_INF_OR_UNBD) {
std::cout << "Model is infeasible or unbounded" << std::endl;
} else if (model_status == GRB_INFEASIBLE) {
std::cout << "Model is infeasible" << std::endl;
} else if (model_status == GRB_UNBOUNDED) {
std::cout << "Model is unbounded" << std::endl;
} else {
std::cout << "Optimization was stopped with status = "
<< model_status << std::endl;
}
} catch(GRBException e) {
std::cout << "Error code = " << e.getErrorCode() << std::endl;
std::cout << e.getMessage() <<std::endl;
} catch(...) {
std::cout << "Exception during optimization" << std::endl;
}
return false;
}