ampl / mp

An open-source library for mathematical programming
https://mp.ampl.com
Other
229 stars 42 forks source link

Returning an infeasible solution #225

Closed 4er4er4er closed 1 year ago

4er4er4er commented 1 year ago

When Gurobi is applied to diet.mod with diet2.dat, it generates the following output:

ampl: model diet.mod;
ampl: data diet2.dat;
ampl: option solver gurobi;
ampl: solve;
Gurobi 10.0.3: infeasible problem
2 simplex iterations

------------ WARNINGS ------------
WARNING:  "Solution Check"
     [ sol:chk:feastol=1e-06, :feastolrel=1e-06, :inttol=1e-05,
       :round='', :prec='' ]
  - 1 original variable(s) violate bounds,
        up to 5E+00 (abs), up to 5E-01 (rel)
Algebraic expression violations:
  - 1 original expression(s) of type ':linrange',
        up to 2E+04 (abs), up to 4E-01 (rel)

In this situation, Gurobi reports "infeasible problem" and returns the last infeasible solution that it saw. Since Gurobi has already correctly reported the problem to be infeasible, do we also want the detailed WARNINGS section?

This also relates to a more general issue that was raised in #223:

I assume without a feasible solution all variables should stay untouched, or as fixed by presolve - any thoughts how this should be otherwise?

Many solvers return an infeasible solution in situations where a feasible solution could not be found. When a solver has returned any solution, we have always reported that solution in AMPL, even if it's infeasible.