powercone2.gms : test conic problem using higher-dimensional power cone

Description

Test of correctness of the levels and marginals returned.
Although this test should work for all NLP solvers,
it is designed specifically to test a conic solvers, e.g., Mosek.


Small Model of Type : NLP


Category : GAMS Test library


Main file : powercone2.gms

$title Test of correct handling of higher-dimensional power cone in DNLP (POWERCONE2,SEQ=799)

$onText
Test of correctness of the levels and marginals returned.
Although this test should work for all NLP solvers,
it is designed specifically to test a conic solvers, e.g., Mosek.


Variation of powercone1.

Contributor: Stefan
$offText

$if not set TESTTOL $set TESTTOL 1e-4
$if not set MCHECKS $set MCHECKS 1

Set i / 1*5 /;

Nonnegative Variables x0, x1;
Variable x3(i), z;
Equations e1, e2, objdef;

objdef.. sum(i,ord(i)*x3(i)) - x0 =E= z;
e1.. x0 + x1 =E= 2;
e2.. sqrt(x0*x1) =G= sqrt(sum(i,sqr(x3(i))));

Model m / all /;

Solve m max z using NLP;

abort$(m.solvestat <> %solveStat.normalCompletion%) "wrong solver status, expected normal completion", m.solvestat ;
abort$(m.modelstat > %modelStat.locallyOptimal% and m.modelstat <> %modelStat.feasibleSolution%) "wrong model status, expected at least feasibility", m.modelstat ;

abort$(abs(x0.l - 0.86636806) > %TESTTOL%) "wrong x0.l, expected 0.86636806", x0.l ;
abort$(abs(x1.l - 1.13363194) > %TESTTOL%) "wrong x1.l, expected 1.13363194", x1.l ;
abort$(smax(i,abs(x3.l(i) - ord(i)*0.133630597)) > %TESTTOL%) "wrong x3.l", x3.l;

abort$(abs(e1.l - 2) > %TESTTOL%) "wrong e1.l, expected 2", e1.l ;
abort$(abs(e2.l) > %TESTTOL%) "wrong e2.l, expected zero", e2.l ;
abort$(abs(z.l - 6.48331477) > %TESTTOL%) "wrong z.l, expected 6.48331477", z.l ;

if( %MCHECKS% <> 0,
  abort$(abs(x0.m) > %TESTTOL%) "wrong x0.m, expected zero", x0.m ;
  abort$(abs(x1.m) > %TESTTOL%) "wrong x1.m, expected zero", x1.m ;
  abort$(smax(i,abs(x3.m(i))) > %TESTTOL%) "wrong x3.m, expected zero", x3.m ;
  abort$(abs(e1.m - 3.24165739) > %TESTTOL%) "wrong e1.m, expected 3.24165739", e1.m ;
  abort$(abs(e2.m + 7.41620846) > %TESTTOL%) "wrong e2.m, expected -7.41620846", e2.m ;
)