sosweird.inc : weird SOS test cases

File : sosweird.inc  used by :  sosmiqcp01.gms [html]   sosmip01.gms [html]   sosminlp01.gms [html]

Set i /1*4/;
SOS1 Variable x1(i);
SOS2 Variable x2(i);
Variable z;
Equation e1,e2;
e1.. z =e= sum(i, ord(i)*x1(i));
e2.. z =e= sum(i, ord(i)*x2(i));
Model m1 /e1/, m2 /e2/;

option optCR=0;

x1.up(i) = 2;
solve m1 max z us %MTYPE%;

if {(m1.solvestat = %solveStat.capabilityProblems%),
  abort$(m1.modelstat <> %modelStat.noSolutionReturned%)             'bad modelstat';
  abort.NoError 'Cannot handle SOS variables';
}

abort$(abs(z.l-8)>1e-6) 'wrong objective value';

x1.lo('3') = 1;
solve m1 max z us %MTYPE%;
abort$(abs(z.l-6)>1e-6) 'wrong objective value';

x1.lo('1') = 1;
solve m1 max z us %MTYPE%;
abort$(m1.modelstat<>%modelStat.integerInfeasible%    and
       m1.modelstat<>%modelStat.infeasibleNoSolution% and
       m1.modelstat<>%modelStat.infeasible%) 'wrong model status';

option clear=x1;
x1.lo(i) = -inf;
x1.up(i) = 0;
solve m1 max z us %MTYPE%;
abort$(abs(z.l)>1e-6) 'wrong objective value';

x1.up('3') = -1;
solve m1 max z us %MTYPE%;
abort$(abs(z.l+3)>1e-6) 'wrong objective value';

x1.up('1') = -1;
solve m1 max z us %MTYPE%;
abort$(m1.modelstat<>%modelStat.integerInfeasible%    and
       m1.modelstat<>%modelStat.infeasibleNoSolution% and
       m1.modelstat<>%modelStat.infeasible%) 'wrong model status';

x2.up(i) = 2;
solve m2 max z us %MTYPE%;
abort$(abs(z.l-14)>1e-6) 'wrong objective value';

x2.lo('2') = 1;
solve m2 max z us %MTYPE%;
abort$(abs(z.l-10)>1e-6) 'wrong objective value';

x2.lo('4') = 1;
solve m2 max z us %MTYPE%;
abort$(m2.modelstat<>%modelStat.integerInfeasible%    and
       m2.modelstat<>%modelStat.infeasibleNoSolution% and
       m2.modelstat<>%modelStat.infeasible%) 'wrong model status';

option clear=x2;
x2.lo(i) = -inf;
x2.up(i) = 0;
solve m2 max z us %MTYPE%;
abort$(abs(z.l)>1e-6) 'wrong objective value';

x2.up('3') = -1;
solve m2 max z us %MTYPE%;
abort$(abs(z.l+3)>1e-6) 'wrong objective value';

x2.up('1') = -1;
solve m2 max z us %MTYPE%;
abort$(m2.modelstat<>%modelStat.integerInfeasible%    and
       m2.modelstat<>%modelStat.infeasibleNoSolution% and
       m2.modelstat<>%modelStat.infeasible%) 'wrong model status';