Jiajie Shen
Jiajie Shen

Reputation: 97

why AMPL can't solve the optimization failure

I have a problem that I don't know how to solve. In my AMPL model, 1B12 is an item that belongs to a Set.

And when I try to solve the problem by AMPL + cplex, the AMPL command show

presolve, constraint production['1B12']:
no variables, but lower bound = 12792, upper = 12792

And the AMPL doesn't give me the optimal value I want. I am new to AMPL and can't know what the sentence meaning, especially the sentence

no variables, but lower bound = 12792, upper = 12792

And in fact, I checked that 1B12 is in my set when I load the data, thus I am confused why AMPL says no variables

I hope someone can help me solve this problem. Thanks!

Upvotes: 2

Views: 1198

Answers (2)

David Nehme
David Nehme

Reputation: 21572

AMPL is reporting that the specific row (constraint) has no variables in the left hand side, after it runs its presolve algorithms. So the constraint becomes

0 = 12792

It isn't saying that you have no variables in your model. You might even have variables in that constraint, but presolve figured out what their values must be in any feasible solution and replaced them with those values.

Upvotes: 2

G_B
G_B

Reputation: 1573

This is a bit late, but maybe it will help somebody else...

Some solvers, including CPLEX, have an "IIS" option that will help diagnose infeasibility. When the solver detects infeasibility, it will look for an "irreducibly infeasible subset" of constraints. This is a set of constraints that is inconsistent (i.e. impossible to satisfy all of them at once) but if any one of those constraints is removed, it's possible to solve the rest. Depending on the size of the IIS, this can be very helpful in figuring out where the problem lies.

(Note that if you have more than one "bad constraint" in your model, the IIS might not contain all of them; in this case you might need to work through them one at a time.)

HOWEVER, when you use AMPL, normally it runs a "presolve" step first. This step attempts to reduce the size of the problem by removing redundant constraints, setting bounds on the range for each variable, and so on. Sometimes the presolve identifies infeasibility, and gives a message like in your example (cf. David's explanation).

When this happens, it never sends the problem to the solver, so the solver can't give you an IIS. Good if you want to "fail fast", bad if you want to know why it failed.

To get around this, you can switch off presolve:

option presolve 0;

This may slow things down a bit, so once you've dealt with the cause of the infeasibility, re-enable it with

option presolve 10;

Chapter 14 of the AMPL Book gives an example of using CPLEX's IIS functionality.

Upvotes: 0

Related Questions