bilinear.gms : Convexification of bilinear term binary times x
The model demonstrates various forumlations to represent bilinear
product terms of one continuous and one binary variable.
A set of 60 products i is produced on a set of machine with a given
total capacity. Some machine are special in the sense that if a
product is produced on one of them, cleaning treatment costs apply
caused by a set of cleaning treatment machines t.
A binary variable, delta(i), indicates that product i is produced on
one of the special machines. The model is simplified regarding the
machine-product relations.
Here we mimic a larger roduction problem, and just require that
E1.. sum(iE, delta(iE)) =e= 2 ;
E2.. sum(iO, delta(iO)) =e= 5 ;
which represents the fact that it cannot be avoided to use the special
machine and, thus, to have some cleaning treatment.
If product i is produced on a special machine, then the amount, y(i),
of the by-product is given by the recipe constraint y(i)=0.164*p(i),
where the non-negative variable p(i) is the amount produced on special
machines. For each product there is a specific yield of YS(i) $/ton.
The by-product is burnt and leads to an energy yield of YB(i) $/ton,
where YB(i)<YS(i). The by-product also passes the treatment plant.
The production is limited by the production capacity C, where x(i),
100+i <= x(i) <= XUB, is the amount of product i produced.
The amount produced on special machines is p(i)=x(i)*delta(i).
We compare the non-convex MINLP formulation to equivalent linear
forms of p(i)=x(i)*delta(i) using big-M, convex hull, and indicator
forumlations. Moreover, a new SOS-1 formulation is presented which is
described in:
Reference:
- Kallrath, J, Combined Strategic Design and Operative Planning in the Process Industry, 2009. Submitted to Computers \& Chemical Engineering
Large Model of Type: MINLP
$title Convexification of bilinear term binary times x (BILINEAR,SEQ=346)
$ontext
The model demonstrates various forumlations to represent bilinear
product terms of one continuous and one binary variable.
A set of 60 products i is produced on a set of machine with a given
total capacity. Some machine are special in the sense that if a
product is produced on one of them, cleaning treatment costs apply
caused by a set of cleaning treatment machines t.
A binary variable, delta(i), indicates that product i is produced on
one of the special machines. The model is simplified regarding the
machine-product relations.
Here we mimic a larger roduction problem, and just require that
E1.. sum(iE, delta(iE)) =e= 2 ;
E2.. sum(iO, delta(iO)) =e= 5 ;
which represents the fact that it cannot be avoided to use the special
machine and, thus, to have some cleaning treatment.
If product i is produced on a special machine, then the amount, y(i),
of the by-product is given by the recipe constraint y(i)=0.164*p(i),
where the non-negative variable p(i) is the amount produced on special
machines. For each product there is a specific yield of YS(i) $/ton.
The by-product is burnt and leads to an energy yield of YB(i) $/ton,
where YB(i) cplex.opt
mipemphasis 3
$offecho
if (%solvebigM1%, bigM1.optfile=1; solve bigM1 max z using miqcp);
* Alternative bigM forumulation
Positive variable slack(i);
Equations
bigM2_1, bigM2_2, bigM2_3 bigM convexification of binary times bounded continuous;
bigM2_1(i).. p(i) =e= x(i) - slack(i);
bigM2_2(i).. p(i) =l= XUB(i)*delta(i); // this is not needed because of the sign of p in the objective
bigM2_3(i).. slack(i) =l= XUB(i)*(1-delta(i));
model bigM2 / coreConv, bigM2_1, bigM2_2, bigM2_3 /;
slack.up(i) = XUB(i);
if (%solvebigM2%, bigM2.optfile=1; solve bigM2 max z using miqcp);
* Cplex Indicator Formulation
Equations
disj1, disj2 indicator convexification of binary times bounded continuous;
disj1(i).. p(i) =e= x(i);
disj2(i).. p(i) =e= 0; // this is not needed because of the sign of p in the objective
model indic / coreConv, disj1, disj2 /;
$onecho > cplex.op2
indic disj1(i)$delta(i) 1
indic disj2(i)$delta(i) 0
cuts 3
$offecho
if (%solveIndic%, indic.optfile=2; solve indic max z using miqcp);
* The EMP (Extended Math Programming) framework explores modeling
* extensions that result in non-traditional math programs (like
* disjunctions) and automate the reformulation into traditional math
* programs (like MIPs). The manually generated big-M and indicator
* formulations above are automatically produced by EMP from a model
* with disjunctions. Moreover, EMP provides a convex hull formulation
* (which is independent of a bigM) for disjunctions.
* EMP Formulations
file femp / "%emp.info%" /; put femp;
$onecho > emp.opt
SubSolver cplex
SubSolverOpt 1
$offecho
option miqcp=emp;
* Convex Hull Convexification
loop(i, put / 'disjunction ' delta.tn(i) ' ' disj1.tn(i) ' else ' disj2.tn(i));
putclose femp;
if (%solveEMPCH%, indic.optfile=1; solve indic max z using miqcp);
* Cplex Indicator Convexification
loop(i, put / 'disjunction indic ' delta.tn(i) ' ' disj1.tn(i) ' else ' disj2.tn(i));
putclose femp;
if (%solveEMPI%, indic.optfile=1; solve indic max z using miqcp);
* Big-M Convexification type 1 (similar to bigM1 forumlation)
loop(i, put / 'disjunction bigM ' XUB(i) ' ' delta.tn(i) ' ' disj1.tn(i) ' else ' disj2.tn(i));
putclose femp;
if (%solveEMPBM1%, indic.optfile=1; solve indic max z using miqcp);
* Big-M Convexification type 2 (similar to bigM2 forumlation)
loop(i, put / 'disjunction bigM ' XUB(i) ' 1 ' delta.tn(i) ' ' disj1.tn(i) ' else ' disj2.tn(i));
putclose femp;
if (%solveEMPBM2%, indic.optfile=1; solve indic max z using miqcp);
* SOS1 Formulation
delta.prior(i) = inf; // relax binary requirement of delta
Set j binary choice / 0,1 /;
SOS1 Variables S1(i,j), S2(i,j);
Equations
defS1_0, defS1_1, defS2_0, defS2_1 selection constraints;
defS1_0(i).. S1(i,'0') =e= delta(i);
defS1_1(i).. S1(i,'1') =e= x(i) - p(i);
defS2_0(i).. S2(i,'0') =e= 1 - delta(i);
defS2_1(i).. S2(i,'1') =e= p(i);
model sos1conv / coreConv, defS1_0, defS1_1, defS2_0, defS2_1 /;
option miqcp=cplex;
if (%solveSOS1%, solve sos1conv max z using miqcp);