mhw4dx.gms : MHW4D with additional Tests

Description

This popular test problem has several local solutions, local minima
with obj value of 27.87190522 and 52.90257967, and the global minimum
with an obj value of 0.02931083.  Additional programming is done to
test for the correct solution.

Reference

  • Wright, M H, Numerical Methods for Nonlinearly Constraint Optimization. PhD thesis, Stanford University, 1976.

Small Model of Type : NLP


Category : GAMS Model library


Main file : mhw4dx.gms

$Title Nonlinear Test Problem (MHW4DX,SEQ=267)

$Ontext

This popular test problem has several local solutions, local minima
with obj value of 27.87190522 and 52.90257967, and the global minimum
with an obj value of 0.02931083.  Additional programming is done to
test for the correct solution.


Wright, M H, Numerical Methods for Nonlinearly Constraint Optimization.
PhD thesis, Stanford University, 1976.

$Offtext


Variables m, x1, x2, x3, x4, x5;
Equations funct, eq1, eq2, eq3;

funct.. m =e= sqr(x1-1)      + sqr(x1-x2)     + power(x2-x3,3)
            + power(x3-x4,4) + power(x4-x5,4) ;

eq1.. x1 + sqr(x2) + power(x3,3) =e= 3*sqrt(2) + 2 ;

eq2.. x2 - sqr(x3) + x4          =e= 2*sqrt(2) - 2 ;

eq3.. x1*x5 =e= 2 ;

Model wright / all / ;

x1.l = -1; x2.l = 2; x3.l = 1; x4.l = -2; x5.l = -2;

option limcol=0,limrow=0;

Solve wright using nlp minimizing m;

* there are at least three solutions
*  52.90257967
*  27.87190522
*   0.02931083 global

option decimals=8; display m.l, x1.l, x2.l, x3.l, x4.l, x5.l;

$eolcom //
scalar tol / 1e-4 /;
if(       abs(m.l-52.90257967) < tol, // local solution
   abort$(abs(x1.L-.728003827) > tol) 'x1.l is bad';
   abort$(abs(x2.L+2.24521084) > tol) 'x2.l is bad';
   abort$(abs(x3.L-.779513778) > tol) 'x3.l is bad';
   abort$(abs(x4.L-3.68127970) > tol) 'x4.l is bad';
   abort$(abs(x5.L-2.74723830) > tol) 'x5.l is bad';
   display 'good local solution';
   abort$(wright.modelstat=%modelstat.Optimal%) 'solver report a local solution as global';
elseif    abs(m.l-27.87190522) < tol, // local solution
   abort$(abs(x1.L+1.27305303) > tol) 'x1.l is bad';
   abort$(abs(x2.L-2.41035427) > tol) 'x2.l is bad';
   abort$(abs(x3.L-1.19485902) > tol) 'x3.l is bad';
   abort$(abs(x4.L+0.15423906) > tol) 'x4.l is bad';
   abort$(abs(x5.L+1.57102647) > tol) 'x5.l is bad';
   display 'good local solution';
   abort$(wright.modelstat=%modelstat.Optimal%) 'solver report a local solution as global';
elseif    abs(m.L -0.02931083) < tol,
   abort$(abs(x1.L-1.11663475) > tol) 'x1.l is bad';
   abort$(abs(x2.L-1.22044082) > tol) 'x2.l is bad';
   abort$(abs(x3.L-1.53778539) > tol) 'x3.l is bad';
   abort$(abs(x4.L-1.97277020) > tol) 'x4.l is bad';
   abort$(abs(x5.L-1.79109597) > tol) 'x5.l is bad';
   display 'this is the global solution';
else
   abort$yes 'unknown solution' );