Gurobi solver with "cannot find MINOS" error

542 views
Skip to first unread message

Tim S

unread,
Jun 11, 2012, 2:52:10 PM6/11/12
to AMPL Modeling Language
Hi Mr. Fourer,

I am experiencing an error where I am telling AMPL to use the gurobi
solver, but then get a "cannot find MINOS" error. Below are the model,
data, and run files. I've found that when I comment out the last line
of the model file related to Problem 3, then I no longer get that
error. If you could please provide some feedback as to why this error
is occurring and what I can do to fix it, I'd greatly appreciate it.

Regards,

Tim


Model File:

param d;
param c;
param p;

set D:= 1..d;
set C:= 1..c;
set P:= 1..p;

param r{k in D, i in D, j in D};
param s{k in D, i in C, j in C};
param t{k in D, l in C, i in P, j in P};
param h:= 1/d;

var u{D} >=0;
var v{C} >=0;
var w{P,C} >=0;

param x{k in D} >=0;
param y{l in C} >=0, default 1;
param z{m in P, l in C} >=0;

# Problem 1:

maximize DMweights{i in D}: sum{j in D} (sum{k in D} h*r[k,i,j])*u[j];
s.t. P1C1: sum{j in D} (sum{k in D, i in D} h*r[k,i,j])*u[j] = 1;
s.t. P1C2{i in D}: sum{j in D} (sum{k in D} h*r[k,i,j])*u[j] >=
d*u[i];

# Problem 2:

maximize CRweights{i in C}: sum{j in C} (sum{k in D}
x[k]*s[k,i,j])*v[j];
s.t. P2C1: sum{j in C} (sum{k in D, i in C} x[k]*s[k,i,j])*v[j] = 1;
s.t. P2C2{i in C}: sum{j in C} (sum{k in D} x[k]*s[k,i,j])*v[j] >=
c*v[i];

# Problem 3:

maximize ProjCrweights{i in P, l in C}: sum{j in P} (sum{k in D}
x[k]*t[k,l,i,j])*w[j,l];
s.t. P3C1{l in C}: sum{j in P} (sum{k in D, i in P}
x[k]*t[k,l,i,j])*w[j,l] = 1;
s.t. P3C2{i in P, l in C}: sum{j in P} (sum{k in D}
x[k]*t[k,l,i,j])*w[j,l] >= p*w[i,l];

problem Prob1{i in D}: u,DMweights[i], P1C1, P1C2;

problem Prob2{i in C}: v,CRweights[i], P2C1, P2C2;

problem Prob3{i in P, l in C}: w, ProjCrweights[i,l], P3C1[l], {g in
P} P3C2[g,l]; # this is the line that allows the problem to work
when commented out


Data File:

param d:= 1;
param c:= 4;
param p:= 3;

param x:=
1 1;

param s:=
[1, *, *]: 1 2 3 4:=
1 1 5 3 2
2 0.2 1 0.2 0.2
3 0.333333333 5 1 0.333333333
4 0.5 5 3 1;

param t:=
[1, 1, *, *]: 1 2 3:=
1 1 3 2
2 0.333333333 1 0.333333333
3 0.5 3 1

[1, 2, *, *]: 1 2 3:=
1 1 0.5 0.5
2 2 1 0.5
3 2 2 1

[1, 3, *, *]: 1 2 3:=
1 1 0.25 1
2 4 1 4
3 1 0.25 1

[1, 4, *, *]: 1 2 3:=
1 1 2 2
2 0.5 1 2
3 0.5 0.5 1;


Run File:

model Test.mod;
data Test.dat;
option solver gurobi_ampl;

for {i in 1..1}
{
solve Prob2[i];
let y[i]:= CRweights[i];
}

display y;

Paul

unread,
Jun 11, 2012, 7:39:38 PM6/11/12
to am...@googlegroups.com
I'm speculating here, but I think the problem is that the solver in effect at the time a named problem is declared "attaches" to that problem.  MINOS is the default solver, so all three of your collections of named problems initially have MINOS associated with them.  I found two changes that both work (and support my hypothesis).  First, you can just move the 'option solver' command from the run file to the top of the model file (before the problems are declared).  Alternatively, you can change the run file to

model Test.mod;
data Test.dat;

for {i in 1..1}
{
        problem Prob2[i];
        option solver gurobi_ampl;  # overrides the default solver choice
        solve;
        let y[i]:= CRweights[i];
}

display y;

Paul
Reply all
Reply to author
Forward
0 new messages