Description
In this test we check that the Lindo Option NLP_QUADCHK does not cause a wrong solution with Lindos global optimizer. This was the case at some stage, for example with the MINLP Lib model ex4. Contributor: Lutz Westermann, November 2013
Large Model of Type : GAMS
Category : GAMS Test library
Main file : lindgl03.gms
$title 'Check that Lindo(Global) Option NLP_QUADCHK works' (LINDGL03,SEQ=633)
$onText
In this test we check that the Lindo Option NLP_QUADCHK does not cause a wrong
solution with Lindos global optimizer. This was the case at some stage, for
example with the MINLP Lib model ex4.
Contributor: Lutz Westermann, November 2013
$offText
Variables b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15,b16,b17,b18,b19
,b20,b21,b22,b23,b24,b25,x26,x27,x28,x29,x30,objvar,x32,x33,x34,x35
,x36,x37;
Positive Variables x27,x29,x32,x33,x34,x35,x36,x37;
Binary Variables b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15,b16,b17
,b18,b19,b20,b21,b22,b23,b24,b25;
Equations e1,e2,e3,e4,e5,e6,e7,e8,e9,e10,e11,e12,e13,e14,e15,e16,e17,e18,e19
,e20,e21,e22,e23,e24,e25,e26,e27,e28,e29,e30,e31;
e1.. 9.57*sqr(x26 - 2.26) + 2.74*sqr(x27 - 5.15) + 9.75*sqr(x28 - 4.03) + 3.96*
sqr(x29 - 1.74) + 8.67*sqr(x30 - 4.74) + 1000*b1 - x32 =L= 1077.839848;
e2.. 8.38*sqr(x26 - 5.51) + 3.93*sqr(x27 - 9.01) + 5.18*sqr(x28 - 3.84) + 5.2*
sqr(x29 - 1.47) + 7.82*sqr(x30 - 9.92) + 1000*b2 - x32 =L= 1175.970966;
e3.. 9.81*sqr(x26 - 4.06) + 0.04*sqr(x27 - 1.8) + 4.21*sqr(x28 - 0.71) + 7.38*
sqr(x29 - 9.09) + 4.11*sqr(x30 - 8.13) + 1000*b3 - x32 =L= 1201.822621;
e4.. 7.41*sqr(x26 - 6.3) + 6.08*sqr(x27 - 0.11) + 5.46*sqr(x28 - 4.08) + 4.86*
sqr(x29 - 7.29) + 1.48*sqr(x30 - 4.24) + 1000*b4 - x32 =L= 1143.953331;
e5.. 9.96*sqr(x26 - 2.81) + 9.13*sqr(x27 - 1.65) + 2.95*sqr(x28 - 8.08) + 8.25*
sqr(x29 - 3.99) + 3.58*sqr(x30 - 3.51) + 1000*b5 - x32 =L= 1154.389533;
e6.. 9.39*sqr(x26 - 4.29) + 4.27*sqr(x27 - 9.49) + 5.09*sqr(x28 - 2.24) + 1.81*
sqr(x29 - 9.78) + 7.58*sqr(x30 - 1.52) + 1000*b6 - x32 =L= 1433.317653;
e7.. 1.88*sqr(x26 - 9.76) + 7.2*sqr(x27 - 3.64) + 6.65*sqr(x28 - 6.62) + 1.74*
sqr(x29 - 3.66) + 2.86*sqr(x30 - 9.08) + 1000*b7 - x32 =L= 1109.07636;
e8.. 4.01*sqr(x26 - 1.37) + 2.67*sqr(x27 - 6.99) + 4.86*sqr(x28 - 7.19) + 2.55*
sqr(x29 - 3.03) + 6.91*sqr(x30 - 3.39) + 1000*b8 - x32 =L= 1041.595916;
e9.. 4.18*sqr(x26 - 8.89) + 1.92*sqr(x27 - 8.29) + 2.6*sqr(x28 - 6.05) + 7.15*
sqr(x29 - 7.48) + 2.86*sqr(x30 - 4.09) + 1000*b9 - x32 =L= 1144.062266;
e10.. 7.81*sqr(x26 - 7.42) + 2.14*sqr(x27 - 4.6) + 9.63*sqr(x28 - 0.3) + 7.61*
sqr(x29 - 0.97) + 9.17*sqr(x30 - 8.77) + 1000*b10 - x32 =L= 1099.834164;
e11.. 8.96*sqr(x26 - 1.54) + 3.47*sqr(x27 - 7.06) + 5.49*sqr(x28 - 0.01) + 4.73
*sqr(x29 - 1.23) + 9.43*sqr(x30 - 3.11) + 1000*b11 - x32 =L= 1149.179125;
e12.. 9.94*sqr(x26 - 7.74) + 1.63*sqr(x27 - 4.4) + 1.23*sqr(x28 - 7.93) + 4.33*
sqr(x29 - 5.95) + 7.08*sqr(x30 - 4.88) + 1000*b12 - x32 =L= 1123.807402;
e13.. 0.31*sqr(x26 - 9.94) + 5*sqr(x27 - 5.21) + 0.16*sqr(x28 - 8.58) + 2.52*
sqr(x29 - 0.13) + 3.08*sqr(x30 - 4.57) + 1000*b13 - x32 =L= 1027.221972;
e14.. 6.02*sqr(x26 - 9.54) + 0.92*sqr(x27 - 1.57) + 7.47*sqr(x28 - 9.66) + 9.74
*sqr(x29 - 5.24) + 1.76*sqr(x30 - 7.9) + 1000*b14 - x32 =L= 1089.926827;
e15.. 5.06*sqr(x26 - 7.46) + 4.52*sqr(x27 - 8.81) + 1.89*sqr(x28 - 1.67) + 1.22
*sqr(x29 - 6.47) + 9.05*sqr(x30 - 1.81) + 1000*b15 - x32 =L= 1293.076557;
e16.. 5.92*sqr(x26 - 0.56) + 2.56*sqr(x27 - 8.1) + 7.74*sqr(x28 - 0.19) + 6.96*
sqr(x29 - 6.11) + 5.18*sqr(x30 - 6.4) + 1000*b16 - x32 =L= 1174.31702;
e17.. 6.45*sqr(x26 - 3.86) + 1.52*sqr(x27 - 6.68) + 0.06*sqr(x28 - 6.42) + 5.34
*sqr(x29 - 7.29) + 8.47*sqr(x30 - 4.66) + 1000*b17 - x32 =L= 1125.102783;
e18.. 1.04*sqr(x26 - 2.98) + 1.36*sqr(x27 - 2.98) + 5.99*sqr(x28 - 3.03) + 8.1*
sqr(x29 - 0.02) + 5.22*sqr(x30 - 0.67) + 1000*b18 - x32 =L= 1222.841697;
e19.. 1.4*sqr(x26 - 3.61) + 1.35*sqr(x27 - 7.62) + 0.59*sqr(x28 - 1.79) + 8.58*
sqr(x29 - 7.8) + 1.21*sqr(x30 - 9.81) + 1000*b19 - x32 =L= 1050.485931;
e20.. 6.68*sqr(x26 - 5.68) + 9.48*sqr(x27 - 4.24) + 1.6*sqr(x28 - 4.17) + 6.74*
sqr(x29 - 6.75) + 8.92*sqr(x30 - 1.08) + 1000*b20 - x32 =L= 1361.197344;
e21.. 1.95*sqr(x26 - 5.48) + 0.46*sqr(x27 - 3.74) + 2.9*sqr(x28 - 3.34) + 1.79*
sqr(x29 - 6.22) + 0.99*sqr(x30 - 7.94) + 1000*b21 - x32 =L= 1040.326419;
e22.. 5.18*sqr(x26 - 8.13) + 5.1*sqr(x27 - 8.72) + 8.81*sqr(x28 - 3.93) + 3.27*
sqr(x29 - 8.8) + 9.63*sqr(x30 - 8.56) + 1000*b22 - x32 =L= 1161.851799;
e23.. 1.47*sqr(x26 - 1.37) + 5.71*sqr(x27 - 0.54) + 6.95*sqr(x28 - 1.55) + 1.42
*sqr(x29 - 5.56) + 3.49*sqr(x30 - 5.85) + 1000*b23 - x32 =L= 1066.858266;
e24.. 5.4*sqr(x26 - 8.79) + 3.12*sqr(x27 - 5.04) + 5.37*sqr(x28 - 4.83) + 6.1*
sqr(x29 - 6.94) + 3.71*sqr(x30 - 0.38) + 1000*b24 - x32 =L= 1340.580732;
e25.. 6.32*sqr(x26 - 2.66) + 0.81*sqr(x27 - 4.19) + 6.12*sqr(x28 - 6.49) + 6.73
*sqr(x29 - 8.04) + 7.93*sqr(x30 - 1.66) + 1000*b25 - x32 =L= 1407.519966;
e26.. x26 - x27 + x28 + x29 + x30 - x33 =L= 10;
e27.. 0.6*x26 - 0.9*x27 - 0.5*x28 + 0.1*x29 + x30 - x34 =L= -0.64;
e28.. x26 - x27 + x28 - x29 + x30 + x35 =G= 0.69;
e29.. 0.157*x26 + 0.05*x27 - x36 =L= 1.5;
e30.. 0.25*x27 + 1.05*x29 - 0.3*x30 - x37 =G= 4.5;
e31.. (-0.6*sqr(x26)) - 0.1*sqr(x29) + b1 + 0.2*b2 + b3 + 0.2*b4 + 0.9*b5
+ 0.9*b6 + 0.1*b7 + 0.8*b8 + b9 + 0.4*b10 + b11 + 0.3*b12 + 0.1*b13
+ 0.3*b14 + 0.5*b15 + 0.9*b16 + 0.8*b17 + 0.1*b18 + 0.9*b19 + b20 + b21
+ b22 + 0.2*b23 + 0.7*b24 + 0.7*b25 + 0.9*x27 + 0.5*x28 - x30 + objvar
- 1000*x32 - 1000*x33 - 1000*x34 - 1000*x35 - 1000*x36 - 1000*x37 =E= 0;
* set non default bounds
x26.lo = 2; x26.up = 4.5;
x27.up = 8;
x28.lo = 3; x28.up = 9;
x29.up = 5;
x30.lo = 4; x30.up = 10;
objvar.lo = -100;
$if set nostart $goTo modeldef
* set non default levels
x28.l = 8;
x29.l = 4;
x30.l = 4.5;
* set non default marginals
$label modeldef
Model m / all /;
m.limrow=0; m.limcol=0;
$echo NLP_QUADCHK=1 > lindo.opt
$echo NLP_QUADCHK=0 > lindo.op2
Scalar quadOn, quadOff, quadDiff;
option minlp=Lindo;
m.optfile=1;
Solve m using MINLP minimizing objvar;
quadOn = objvar.l;
m.optfile=2;
Solve m using MINLP minimizing objvar;
quadOff = objvar.l;
quadDiff = abs(quadOn-quadOff);
Display quadOn, quadOff, quadDiff;
abort$(quadDiff > 1e-4) 'NLP_QUADCHK opton should not cause different results';