gurobi06.gms : GUROBI test suite - general constraints norm

Description

Tests a model with 0-norm, 1-norm, 2-norm and inf-norm constraints.

Contributor: Renke Kuhlmann, November 2021


Small Model of Type : GAMS


Category : GAMS Test library


Main file : gurobi06.gms

$title 'GUROBI test suite - general constraints norm' (GUROBI06,SEQ=882)
$onText
Tests a model with 0-norm, 1-norm, 2-norm and inf-norm constraints.

Contributor: Renke Kuhlmann, November 2021
$offText

Variables x1, x2, r, obj;
Equations defobj, eqnorm;

defobj.. obj =e= x1 + x2;
eqnorm.. r =e= x1 + x2;
r.up = 1;

Model m / all /;

option solver = gurobi;
$onEcho > gurobi.opt
eqnorm.genconstrtype 14
$offEcho
$onEcho > gurobi.op2
eqnorm.genconstrtype 15
$offEcho
$onEcho > gurobi.op3
eqnorm.genconstrtype 16
$offEcho
$onEcho > gurobi.op4
eqnorm.genconstrtype 17
$offEcho

* without norm constraints
Solve m using LP maximizing obj;
abort$(m.modelstat<>1) 'incorrect model status';
abort$(abs(obj.l - 1) > 1e-4) 'incorrect objective';

* with 0-norm constraints
m.optfile=1;
Solve m using LP maximizing obj;
abort$(m.modelstat<>3 and m.modelstat<>18) 'incorrect model status';

* with 1-norm constraints
m.optfile=2;
Solve m using LP maximizing obj;
abort$(m.modelstat<>1) 'incorrect model status';
abort$(abs(obj.l - 1) > 1e-4) 'incorrect objective';

* with 2-norm constraints
m.optfile=3;
Solve m using LP maximizing obj;
abort$(m.modelstat<>1) 'incorrect model status';
abort$(abs(obj.l - 1.41421) > 1e-4) 'incorrect objective';

* with inf-norm constraints
m.optfile=4;
Solve m using LP maximizing obj;
abort$(m.modelstat<>1) 'incorrect model status';
abort$(abs(obj.l - 2) > 1e-4) 'incorrect objective';