11
Disjunctive programming: algorithms, Disjunctive programming: algorithms, implementation and solution of implementation and solution of
linear and nonlinear modelslinear and nonlinear models
Aldo Vecchietti INGAR – Instituto de Desarrollo y Diseño
UTN – Facultad Regional Santa Fee-mail: [email protected]
22
Disjunctive Programming has proved to be a successful Disjunctive Programming has proved to be a successful modeling framework for problems involving discrete decisionsmodeling framework for problems involving discrete decisions
LogMIPLogMIP develop a system for solving disjunctive problems in develop a system for solving disjunctive problems in GDP formulationGDP formulation Generate a language for the expressions of disjunctions, Generate a language for the expressions of disjunctions,
logic constraints and logic propositionslogic constraints and logic propositions Implement and develop techniques and algorithms for Implement and develop techniques and algorithms for
solving linear/nonlinear disjunctive problems.solving linear/nonlinear disjunctive problems.
MotivationMotivation
33
General Hybrid/Disjunctive Problem(GHDP)General Hybrid/Disjunctive Problem(GHDP)
x and ci are continuous variablesy are binary variables (0-1)Yik are Boolean variables to establish whether a given term in a disjunction is true [hik(x)0],(Y) are logical relations between Boolean variablesg(x) are linear/nonlinear inequalities that hold independent of the discrete choicesf(x) represents a linear/nonlinear objective function,r(x)+Dy0 corresponds to a general mixed integer algebraic equationsAya is a set of integer inequalities dTy are linear cost terms.
min Z = min Z = kkcckk + f(x) + d + f(x) + dTTyy stst
g(x) g(x) 0 0 r(x) + Dy r(x) + Dy 0 0
Ay Ay a a
(Y) = True(Y) = True
x x R Rnn, y , y {0,1} {0,1}qq, , YY {True, False} {True, False}mm, c, cii 0 0
SD k c
0 (x)h Y
ikk
ik
ik
D i k
This is a general formulation that can This is a general formulation that can used for LogMIPused for LogMIP
ni
TiDi
R x b x a F
)y-(1M b x a iiiTi
1 yi
i
Mi = max{ aiT
x – bi | xlo x xup}
niDi
R x 0 (x)h F
hi(x) Mi(1-yi)
Mi = max{ hi(x) | xlo x xup}
1 yi
i
iupi
i
iDi
i
iiii
ni
Dii
y v v 0
D i 1, y 0 , 1 y
0 )y / v(h y
Rv x, 0 vx -
y v v 0
D i 1, y 0 , 1 y
0 y b -v a
Rv x, 0 vx -
iupii
iDi
i
iiiTi
ni
Dii
Disjunction RelaxationsDisjunction Relaxations
Big-M
Convex Hull
LINEAR
NONLINEAR
44
improper
proper
j i R R ji
R iDi
R iDi
X2
X12 3 4
1
2
3
4
1
X2
X12 3 4
1
2
3
4
1
X2
X12 3 4
1
2
3
4
1
DISJUNCTION CHARACTERIZATIONDISJUNCTION CHARACTERIZATION
55
66
ImproperImproper DisjunctionDisjunction
4x33x2
Y
4x23x1
Y:a sujeto
4.5) -(x 3.5)-x(minZ
2
1
2
2
1
1
22
21
X2
X12 3 4
1
2
3
4
1
O.F.
• The disjunction could be replaced by the disjunction term with the largest feasible region.
The x space
77
Big-M
Proper disjunction - Non-empty IntersectionProper disjunction - Non-empty Intersection
2 3 41
X2
X1
1
2
3
4
For this case is not clear which relaxation is tighter
Both relaxations are equivalent The convex hull relaxation has a tighter feasible region
Convex Hull
2 3 41
X2
X1
1
2
3
4
The objective function plays an important rol:• when located inside the region of one term both relaxations are competitive• in general the convex hull relaxation is tighter
88
Big-M
Proper disjunction - Empty IntersectionProper disjunction - Empty Intersection
2 3 41
X2
X1
1
2
3
4
For this case can be asserted that for the general case the convex hull renders a tighter feasible region
Both relaxations are equivalent The convex hull relaxation has a tighter feasible region
Convex Hull
2 3 41
X2
X1
1
2
3
4
99
The x space
}false,true{Yc0;1x,x0
0c0xx
Y
1c1xx
Y
.t.sc)1.1x()1.1x(Zmin
1
121
1
21
1
1
22
21
1
12
22
1
Improper disjunctionImproper disjunctionSpecial Interest in Process EngineeringSpecial Interest in Process Engineering
(Synthesis Problems)(Synthesis Problems)
Both relaxations have the same feasible region
X1
X2
1
1
1010
X1
X2
yConvex hull
X1
X2
y Big-M
1y0yx0yx0
yxx
.t.sy)1.1x()1.1x(Zmin
1
12
11
21
22
21
12
22
1
1010
1111
121
122
21
12
22
1
y;x,xyxx
.t.sy).x().x(minZ
Improper disjunctionSpecial Interest in Process Engineering
(Synthesis Problems)Including the y-spaceIncluding the y-space
1111
FeaturesFeatures
System linked to GAMSSystem linked to GAMSProblems can be formulated in GHDPProblems can be formulated in GHDPProblems can be linear or nonlinear discreteProblems can be linear or nonlinear discreteProvides:Provides:• Language to write disjunctionsLanguage to write disjunctions• Operators and sentences for logic propositionsOperators and sentences for logic propositions• Linear and nonlinear solvers Linear and nonlinear solvers
http://www.ceride.gov.ar/logmiphttp://www.ceride.gov.ar/logmip
1212
LogMIP: Modeling two terms disjunction
f set sconstraint
condition
t set sconstraintcondition
TTD isTTD isIF (condition) THENIF (condition) THEN constraints set (names) to satisfy when condition is TRUE;constraints set (names) to satisfy when condition is TRUE;ELSEELSE constraints set (names) to satisfy when condition is FALSE;constraints set (names) to satisfy when condition is FALSE;END IF;END IF;
Declaration sentence: Declaration sentence: Disjunction TTD;Disjunction TTD;
Conditions in this LogMIP version are Boolean (binary) variablesConditions in this LogMIP version are Boolean (binary) variables
1313
N set sconstraint
N condition ..
2set sconstraint 2condition
1 set sconstraint
1 condition
MTD isMTD isIF (conditionIF (condition11) THEN) THEN constraints set 1 (names) to be satisfied when conditionconstraints set 1 (names) to be satisfied when condition11 is True; is True;ELSIF (conditionELSIF (condition22) THEN) THEN constraints set 2 (names) to be satisfied when conditionconstraints set 2 (names) to be satisfied when condition22 is True; is True; ELSIF (conditionELSIF (condition33) THEN) THEN ......ELSIF (conditionELSIF (conditionNN) THEN) THEN constraints set N (names) to be satisfied when conditionconstraints set N (names) to be satisfied when conditionnn is True; is True;END IFEND IF
LogMIP: Modeling a multi-term disjunctionLogMIP: Modeling a multi-term disjunction
Declaration sentence: Declaration sentence: Disjunction MTD;Disjunction MTD;
Definition sentence:Definition sentence:
1414
LogMIP: Posing logic propositionsLogMIP: Posing logic propositions
Operands : Boolean (binary) variables (must correspond to disjunctions Operands : Boolean (binary) variables (must correspond to disjunctions conditions)conditions)
Operators: and, or, not , -> (implication), <-> equivalenceOperators: and, or, not , -> (implication), <-> equivalence
More declarative special sentence:More declarative special sentence:atmost, atleast, exactlyatmost, atleast, exactly
Syntax:Syntax: [ [atmostatmost] ] [[atleastatleast] ] (<list of boolean variables>, n)(<list of boolean variables>, n) [[exactlyexactly]]
Y('2') -> Y('3') or Y('4') or Y('5');Y('2') -> Y('3') or Y('4') or Y('5');Y('1') and not Y('2') -> not Y('3');Y('1') and not Y('2') -> not Y('3');Y('2') -> not Y('3') ;Y('2') -> not Y('3') ;Y('3') -> Y('8');Y('3') -> Y('8');
atmost(Y('1'), Y('2'));atmost(Y('1'), Y('2'));atleast(Y('4'), Y('5'));atleast(Y('4'), Y('5'));
Parameter n indicates Parameter n indicates how many variables how many variables must comply the must comply the sentence (default = 1)sentence (default = 1)
1515 .3,2,1k , }false,true{Y
0x ,x ,x,T
0xx
Y
05xxY
06xx
Y
01xxY
02xx
Y
05xxY
6x T 5x T 8x T .t.s
TZmin
k
321
12
3
21
3
23
2
32
2
13
1
31
1
3
2
1
EXAMPLE 1
SET J /1*3/;BINARY VARIABLES Y(J);POSITIVE VARIABLES X(J),T;VARIABLE Z;EQUATIONS EQUAT1, EQUAT2, EQUAT3, EQUAT4, EQUAT5, EQUAT6, EQUAT7, EQUAT8, EQUAT9, FICT, OBJECTIVE;
EQUAT1.. T =G= X('1') + 8;EQUAT2.. T =G= X('2') + 5;EQUAT3.. T =G= X('3') + 6;EQUAT4.. X('1')-X('3')+ 5 =L= 0;EQUAT5.. X('3')-X('1')+ 2 =L= 0;EQUAT6.. X('2')-X('3')+ 1 =L= 0;EQUAT7.. X('3')-X('2')+ 6 =L= 0;EQUAT8.. X('1')-X('2')+ 5 =L= 0;EQUAT9.. X('2')-X('1') =L= 0;FICT.. SUM(J, Y(J)) =G= 0;X.UP(J)=12.;OBJECTIVE.. Z =E= T;
$ONTEXT BEGIN LOGMIPDISJUNCTION D1,D2,D3;D1 ISIF (Y('1')) THEN EQUAT4;ELSE EQUAT5;ENDIF;D2 ISIF(Y('2')) THEN EQUAT6;ELSE EQUAT7;ENDIF;D3 ISIF(Y('3')) THEN EQUAT8;ELSE EQUAT9;ENDIF;$OFFTEXT END LOGMIPOPTION MIP=LOGMIPC;MODEL example1 /ALL/;SOLVE example1 USING MIP MINIMIZING Z;
EXAMPLE 1: LogMIP FileEXAMPLE 1: LogMIP File
1717
.3,2,1j},false,true{Y0c ,5x0, 5x0
)Y (YY Y Y
0xY
1xxY
7c0x2
Y
5c02xx
Y
x x2 c min
j
21
32
321
1
3
21
3
2
2
21
1
21
EXAMPLE 2EXAMPLE 2
EXAMPLE 2: LogMIP FileEXAMPLE 2: LogMIP File$ONTEXT BEGIN LOGMIP$ONTEXT BEGIN LOGMIPDISJUNCTION D1,D2;DISJUNCTION D1,D2;D1 ISD1 ISIF Y('1') THENIF Y('1') THEN EQUAT1;EQUAT1; EQUAT2;EQUAT2;ELSIF Y('2') THENELSIF Y('2') THEN EQUAT3;EQUAT3; EQUAT4;EQUAT4;ENDIF;ENDIF;D2 ISD2 ISIF Y('3') THENIF Y('3') THEN EQUAT5;EQUAT5;ELSEELSE EQUAT6;EQUAT6;ENDIF;ENDIF;Y('1') and not Y('2') -> not Y('3');Y('1') and not Y('2') -> not Y('3');Y('2') -> not Y('3') ;Y('2') -> not Y('3') ;$OFFTEXT END LOGMIP$OFFTEXT END LOGMIPOPTION MIP=LOGMIPC;OPTION MIP=LOGMIPC;MODEL PEQUE2 /ALL/;MODEL PEQUE2 /ALL/;SOLVE PEQUE2 USING MIP MINIMIZING Z;SOLVE PEQUE2 USING MIP MINIMIZING Z;
SET I /1*3/;SET I /1*3/;SET J /1*2/;SET J /1*2/;BINARY VARIABLES Y(I);BINARY VARIABLES Y(I);POSITIVE VARIABLES X(J), C;POSITIVE VARIABLES X(J), C;VARIABLE Z;VARIABLE Z;EQUATIONS EQUAT1, EQUAT2, EQUAT3, EQUAT4, EQUATIONS EQUAT1, EQUAT2, EQUAT3, EQUAT4, EQUAT5, EQUAT6,INT1, INT2, INT3, FICT, EQUAT5, EQUAT6,INT1, INT2, INT3, FICT, OBJECTIVE;OBJECTIVE;EQUAT1.. X('2')- X('1') + 2 =L= 0;EQUAT1.. X('2')- X('1') + 2 =L= 0;EQUAT2.. C =E= 5;EQUAT2.. C =E= 5;EQUAT3.. 2 - X('2') =L= 0;EQUAT3.. 2 - X('2') =L= 0;EQUAT4.. C =E= 7;EQUAT4.. C =E= 7;EQUAT5.. X('1')-X('2') =L= 1;EQUAT5.. X('1')-X('2') =L= 1;EQUAT6.. X('1') =E= 0;EQUAT6.. X('1') =E= 0;INT1.. Y('1')+ Y('3') =L= 1;INT1.. Y('1')+ Y('3') =L= 1;INT2.. Y('2')+ (1-Y('3')) =G= 1;INT2.. Y('2')+ (1-Y('3')) =G= 1;INT3.. Y('2')+ Y('3') =L= 1;INT3.. Y('2')+ Y('3') =L= 1;FICT.. SUM(I, Y(I)) =G= 0;FICT.. SUM(I, Y(I)) =G= 0;OBJECTIVE.. Z =E= C + 2*X('1') + X('2');OBJECTIVE.. Z =E= C + 2*X('1') + X('2');X.UP(J)=20;X.UP(J)=20;C.UP=7;C.UP=7;
1919
Declaring and defining disjunctions over a domain
DISJUNCTIONDISJUNCTION disjunction_identifier[ domain_identifier, …, domain_identifier], … , disjunction_identifier [ domain_identifier, …, domain_identifier];
Example: DISJUNCTIONDISJUNCTION D(I,J);
D(I,J) IS IFIF Y(I,J) THENTHEN
CONSTRAINT1(I,J);EQUATION1(I,J);
ELSEELSECONSTRAINT2(I,J);EQUATION2(I,J);
ENDIF;ENDIF;
One disjunction is defined for One disjunction is defined for every pair I,Jevery pair I,J
You cannot define a domain inside the LOGMIP section. The reasonYou cannot define a domain inside the LOGMIP section. The reasonis that the disjunction’s domains must be in concordance to the is that the disjunction’s domains must be in concordance to the constraint’s domains, which are defined in the GAMS section.constraint’s domains, which are defined in the GAMS section.
D(I,J) IS IFIF Y(I,J) THEN
CONSTRAINT(I,J,’1’);CONSTRAINT(I,J,’2’);
ELSEELSECONSTRAINT(I,J,’3’);CONSTRAINT(I,J,’4’);
ENDIF;ENDIF;
2020
In previous examples Constraint’s domains are expanded In previous examples Constraint’s domains are expanded together the disjunction’s domains.together the disjunction’s domains.If constraint’s domain are different in LogMIP than in GAMS If constraint’s domain are different in LogMIP than in GAMS section, LogMIP reports an error.section, LogMIP reports an error.
Controlling disjunction’s domain
Disjunction’s domain are controlled by the sentence Disjunction’s domain are controlled by the sentence withwith plus other operators: plus other operators:
Relational operators:Relational operators: lt, <lt, < : less than : less than le, <=le, <= : less than or equal to : less than or equal to eq, = :eq, = : equal equal gt, > :gt, > : greater than greater than ge, <=:ge, <=: greater than or equal to greater than or equal to
Logical operators:Logical operators: andand, , oror.. Sets operators:Sets operators: ordord : order of an item in the set: order of an item in the set cardcard : number of items in the set: number of items in the set inin : inclusion of a set item: inclusion of a set item
2121
Controlling disjunction’s domainEXAMPLE 1EXAMPLE 1
Disjunction D(i,j);Disjunction D(i,j);
D(i,j) D(i,j) with (ord(i) < ord(j))with (ord(i) < ord(j)) IS ISIFIF Y(i,j) THEN Y(i,j) THEN
CONSTR1(j);CONSTR1(j);CONSTR2(i,j);CONSTR2(i,j);
ELSEELSE CONSTR3(j);CONSTR3(j); CONSTR4(j,k) CONSTR4(j,k) withwith (ord(k) ge 1);(ord(k) ge 1);ENDIFENDIF;;
Suppose we have in GAMS Section: SET I /1*3/ , J /1*4/, K/1*2/; Suppose we have in GAMS Section: SET I /1*3/ , J /1*4/, K/1*2/;
With this definition, the following disjunctions are generated:With this definition, the following disjunctions are generated:D('1', '2'), D('1', '3'), D('1','4'), D('2', '3'), D('2', '4') y D('3', '4').D('1', '2'), D('1', '3'), D('1','4'), D('2', '3'), D('2', '4') y D('3', '4').
Since k is not controlled by Since k is not controlled by disjunction’s domains, so disjunction’s domains, so this sentence is needed for this sentence is needed for kk
It controls not only disjunction’s It controls not only disjunction’s domains but also constraint’s domains but also constraint’s domainsdomains
2222
Controlling disjunction’s domainEXAMPLE 2: Controlling a domain already controlledEXAMPLE 2: Controlling a domain already controlled
For this case an alias is needed in GAMS section:For this case an alias is needed in GAMS section:
GAMS SectionGAMS SectionSET I /1*3/ , J /1*4/;SET I /1*3/ , J /1*4/;ALIAS (J,JJ);ALIAS (J,JJ);
LogMIP SectionLogMIP SectionDisjunction D(i,j);Disjunction D(i,j);D(i,j) D(i,j) with (ord(i) < ord(j))with (ord(i) < ord(j)) IS IS
IFIF Y(i,j) THEN Y(i,j) THEN CONSTR1(j);CONSTR1(j); CONSTR2(i,jj) CONSTR2(i,jj) with (ord(jj) le 2);with (ord(jj) le 2); ELSE ELSE CONSTR3(j);CONSTR3(j); CONSTR4(j,k) CONSTR4(j,k) with (ord(k) lt card(k));with (ord(k) lt card(k)); ENDIF;ENDIF;
2323
Controlling disjunction’s domainControlling disjunction’s domainEXAMPLE 3: Controlling a domain via a SUBSETEXAMPLE 3: Controlling a domain via a SUBSET
GAMS Section:GAMS Section:SET I /1*3/ , J /1*4/; * Define the subset * Define the subset
kkSET K(I,J) / 1.2, 2.3,
3.4 /;
LogMIP SectionLogMIP SectionDisjunction D(I,J);D(I, J) with K(I,J) IS IF Y(I,J) THEN
CONSTRAINT(I,J);CONSTRAINT(I,J);
ELSECONSTRAINT(I,J);CONSTRAINT(I,J);
ENDIF;Disjunctions generated: Disjunctions generated: D(‘1’,’2’), D(‘2’,’3’) and D(‘3’,‘4’).D(‘1’,’2’), D(‘2’,’3’) and D(‘3’,‘4’).
2424
Hierarchical Discrete DecisionsHierarchical Discrete Decisions(Nested Disjunctions)(Nested Disjunctions)
Nested disjunctions can not be used in the actual version of LogMIPNested disjunctions can not be used in the actual version of LogMIPHierarchical decisions are common in PSE: synthesis and design problemsHierarchical decisions are common in PSE: synthesis and design problemse.g: discontinuous cost functions, simultaneous planning and scheduling,e.g: discontinuous cost functions, simultaneous planning and scheduling,synthesis and design of batch plants. synthesis and design of batch plants.
0c0d0xB
Y
TdT
)T(
Z
PPP
)P(
Z
ddd
)T()P()d(c
Z
0)x(hY
i
i
ii
Bimi
B1im
imi
m,i
Fm
Biki
B1ik
iki
k,i
Ek
Biji
B1ij
iiijiji
j,i
Dj
i
i
i
ij
i
0c0d0xB
Y
0)x(hY
i
i
ii
i iimm
i
iikk
i
iijji
ii
Z Y
Z Y
Z YYY
boundsbetweenvalue any
take can iablesvarY
)
TdT
)T(
Z
(
boundsbetweenvalue any
take can iablesvarY
)
PPP
)P(
Z
(
0cY
)
ddd
)T()P(*
)d(c
Z
(
i
Bimi
B1im
imi
m,i
Fm
i
Biki
B1ik
iki
k,i
Ek
i
i
Biji
B1ij
ii
ijiji
j,i
Dj
i
i
ij
i
Transforming Hierarchical Discrete Transforming Hierarchical Discrete Decisions into GHDP formDecisions into GHDP form
0c0d0xB
Y
0)x(hY
i
i
ii
i
iim
im
iik
ik
iij
ij
iii
YZ
YZ
Y Z
1)Y1(Y
2626
Transforming Hierarchical Discrete Transforming Hierarchical Discrete Decisions into GHDP formDecisions into GHDP form
Algorithm steps:Algorithm steps:1- take out the inner disjunctions, leaving nested disjunctions1- take out the inner disjunctions, leaving nested disjunctions
into a set of individual ones, into a set of individual ones,
2- define an extra term for the disjunction corresponding to the 2- define an extra term for the disjunction corresponding to the inner to represent the fact that none of the other terms is trueinner to represent the fact that none of the other terms is true
3- define the equivalence propositions between the outer 3- define the equivalence propositions between the outer and the inner disjunctions (logic propositions or algebraic and the inner disjunctions (logic propositions or algebraic constraints)constraints)
2727
Problem Input File
GAMSsection
LogMIPsection
GAMSCompiler
Mathematical Problem Info
LogMIP Compiler
Logic Info
LOGMIP SolverSymbol Table
Interaction GAMS/LogMIP CompilersInteraction GAMS/LogMIP Compilers
Special two termsdisjunction
Logic Based OA
MINLP PROGRAM
MINLP Reformulation by “Big-M” or Convex hull
Relaxation
B&B(SBB)
OA(DICOPT++)
HYBRID / DISJUNCTIVE PROGRAM
NONLINEARLINEAR
MIP Reformulation by “Big-M” or Convex hull
Relaxation
MILP PROGRAM
B&B(OSL, CPLEX, etc
LogMIP AlgorithmsLogMIP Algorithms
NOT DONE NOT DONE YET!YET!
LogMIPCLogMIPC LogMIPMLogMIPM LogMIPV3LogMIPV3
2929
Nonlinear Disjunctive problemsNonlinear Disjunctive problemsLogic-Based OA algorithmLogic-Based OA algorithm
Nonlinear models solved by Logic-Based Outer Approximation Nonlinear models solved by Logic-Based Outer Approximation needs initialization, these are needed to run the first NLP problems needs initialization, these are needed to run the first NLP problems to provide initial values for the first MASTER MIP subproblem. to provide initial values for the first MASTER MIP subproblem.
More details can be found in Turkay and Grossmann (1996). More details can be found in Turkay and Grossmann (1996).
The clause The clause INIT INIT is used. is used. INIT TRUEINIT TRUE Y('1'), Y('3'), Y('4'), Y('7'), Y('8'); Y('1'), Y('3'), Y('4'), Y('7'), Y('8');INIT TRUEINIT TRUE Y('1'), Y('3'), Y('5'), Y('8'); Y('1'), Y('3'), Y('5'), Y('8');INIT FALSEINIT FALSE Y('2'), Y('3'), Y('4'), Y('6'), Y('8'); Y('2'), Y('3'), Y('4'), Y('6'), Y('8');
Initialization entries must be written after the disjunction definitionsInitialization entries must be written after the disjunction definitions
Other options:
INIT TRUE INIT TRUE ALL;ALL;
ororINIT FALSE INIT FALSE ALL;ALL;
3030
Hybrid and Disjunctive Programming provide advantages in modeling and solution techniques that complements Mixed Integer Non Linear Programming (MINLP)
LogMIP extends the capabilities of the mathematical modeling systems by means of a language for the expression of disjunctions and logic propositions
Starting with a linear hybrid/disjunctive model it is reformulated into a MIP (by Convex Hull or BigM relaxation). For nonlinear problems with special two terms disjunctions Logic-Based Outer Approximation is used.
LogMIP becomes an alternative modeling and solving continuous/discrete linear/nonlinear program problem
ConclusionsConclusions