Problem with loop in MINLP model.

Problems with modeling
Post Reply
Posts: 9
Joined: 10 months ago

Problem with loop in MINLP model.

Post by mbh » 4 months ago

Hi all,
I have a MINLP model which I try to do sensitivity analysis in a loop. I set the starting point into the loop. Now I have a problem that the results that I get using the loop are different from the results of corresponding scenario but without a loop. For example, some times the model with the loop gives locally optimum solutions but the same code without the loop gives integer solutions. I tried using clear option for choice variables, but the problem still exists.
Any idea how to fix the problem?

Thanks in advance.

The following is part of my model which includes loop:

set kk /kk1*kk20/;
set jj /jj1*jj100 /;

parameter costt(kk);
costt(kk) = ord(kk) * .01;

parameter costill(jj);
costill(jj) = ord(jj) * 30;

parameter output (*,kk,jj)
output2 (*,*,kk,jj);

loop (kk, ctest= costt(kk);
loop (jj,cill = costill(jj);
p.up(n) = 1;
p.l(n) = 0.561;
weight.l("CA-Imperial","2010") = 1;
weight.up("CA-Imperial",t) = 1;
testing.l(g) = 1;
yield.l(n) = 19.749;
demand.l(n) = 989.409;
csupply.l(n) = 989.409;
surplus.l(n) = 2467.042;
expsw.l = 2467.042;
objective.l = 2467.042;
acr.l("lettuce") = 50.1;
acr.l("other-crops") = 8299.900;
delay.l(n) = 1.367;
d.l(n) = 4796.177;
cn.l(n) = 56.426;
phi.l(n) = 930.156;
sigma2.l(n) = 930.156;
sigma1.l(n) = 0;
th.l = 1569.844;
illness.l(n) = 6.535;
option solveopt=replace
option clear = weight;
option clear = testing;
option clear = yield;
option clear = demand;
option clear = csupply;
option clear = surplus;
option clear = objective;
option clear = acr;
option clear = delay;
option clear = d;
option clear = cn;
option clear = phi;
option clear = sigma1;
option clear = sigma2;
option clear = th;
option clear = illness;
option clear = p;
option clear = illness;
option nlp = conopt;
option mip = cplex;
option rminlp = conopt;
option minlp = dicopt;
solve pricend using rminlp maximizing objective;
abort $(pricend.modelstat > 2.5) "Relaxed model could not be solved";
solve pricend using minlp maximizing objective;
output("expsw", kk,jj) = expsw.l;
output("objective", kk,jj) = objective.l;
output2("test", g, kk,jj) = testing.l(g);
output2("phi", n, kk,jj) = phi.l(n);
output2("demand", n, kk,jj) = demand.l(n);
output2("supply", n, kk,jj) = csupply.l(n);
output2("acr", j, kk,jj) = acr.l(j);
output2("illness", n, kk,jj) = illness.l(n);
output("th", kk,jj) = th.l;
output2("yield", n, kk,jj) = yield.l(n);
output2("delay", n, kk,jj) = delay.l(n);
output2("sigma1", n, kk,jj) = sigma1.l(n);
output2("sigma2", n, kk,jj) = sigma2.l(n);
output("modelstat", kk,jj) = pricend.modelstat;
output("solvestat", kk,jj) = pricend.solvestat;

display output, output2;

Posts: 158
Joined: 3 years ago

Re: Problem with loop in MINLP model.

Post by Fred » 3 months ago


Since you don't share with us how you set the starting point when you are not using a loop, there is no chance to tell you where the difference comes from.
What you do in the loop looks strange. You set many variable levels and then you clear most of the variables before you do anything with them...

If you want to compare two (presumably identical) model instances, you can for example compare the equation and column listing ( ... tionOutput) of the two model instances.

I hope this helps!


Post Reply