#### 19.3 MPEC Model Type (compl-3)

Run LPL Code , PDF Document)

A complementarity constraint enforces that two variables are complementary to each other,
that is, the following conditions hold for scalar variables x and y:

In LPL, this condition can be formulated by a constraint as follows:

constraint A: Complements(x,y);

A more general version can also be implemented in LPL, where the two scalar variables can
be replaced by arbitrary expressions. LPL reformualtes this version. Hence, for example, the
constraint

constraint A1: Complements(2*x-1,4*y-1);

will be replaced by (where v and w are two new variables):

variable v; w;

constraint A1: v*w = 0;

constraint X: v = 2*x-1;

constraint Y: w = 4*y-1;

Note that Gurobi can solve these constraints if the expressions within the complementarity
are linear or quadratic, otherwise a non-linear solver (such as Knitro) will do the
job.

Listing 23:
The
Complete
Model
implemented
in
LPL
[10] model complement "MPEC Model Type";

variable x [0..10]; y [0..10];

constraint

A1: Complements(2*x-1,4*y-1);

maximize obj: x + y;

Writep(obj,x,y);

end