GAMS [ Home | Downloads | Documentation | Solvers | APIs | Tools | Model Libraries | Resources | Sales | Support | Contact Us | Search ]

lindgl04.gms : Test non-convex quadartic program with Lindo(Global)

Description

In this test we check that the Lindo returns the correct solution, especially
correct marginals, for a non-convex QCP.

Small Model of Type : GAMS


Category : GAMS Test library


Main file : lindgl04.gms

$title 'Test non-convex quadartic program with Lindo(Global)' (LINDGL04,SEQ=695)

$ontext
In this test we check that the Lindo returns the correct solution, especially
correct marginals, for a non-convex QCP.
$offtext


Sets
    i    /i1*i5/
alias(i,j);

Parameters
    c(i)  /i1    42
           i2    44
           i3    45
           i4    47
           i5    47.5/
    a(i) / i1  20
           i2  12
           i3  11
           i4   7
           i5   4 /
    Q(i,j)
;

Q(i,i) = -50;

Variables
    x(i)
    f;

x.lo(i) = 0;
x.up(i) = 1;

Equations
    Obj    objective function
    Con    constraint function;

Obj ..
    f =e= sum(i, c(i)*x(i)) + sum((i,j), x(i)*Q(i,j)*x(j));

Con ..
    sum(i, a(i)*x(i)) =l= 40;

Model
    problem /Obj, Con/;

option optcr=0;
option qcp=LindoGlobal;
solve problem using qcp minimizing f;

abort$(problem.ModelStat <> %ModelStat.Optimal%) 'Expecting optimal solution';
abort$(con.slack = 0) 'Expecting con to be non-binding';

Set MaringalError(i);
MaringalError(i) = abs(c(i)+2*Q(i,i)*x.l(i)-x.m(i)) > 1e-8;

abort$card(MaringalError) 'Wrong Solution for x', MaringalError;