Optimization Methods in Energy and Power Systems Lecture















































- Slides: 47
Optimization Methods in Energy and Power Systems Lecture 6: Mixed-Integer Linear Programming Mahdi Pourakbari Kasmaei, 2019 Thursday, 04 April 2019
Mixed-Integer Linear Programming (MILP) ü Introduction of MILP Problems ü Formulating MILP Problems ü Solving MILP Problems ü Useful Tricks for LP and MILP Models M. Pourakbari Kasmaei, 2019 2
MILP (Introduction) ü ü ü Variables of Degree One No Multiplication of variables No Nonlinear Function (Sin, Cos, Log, etc. Terms of Degree One At least one variable can only take integer values (0, 1, 2, . . . ) M. Pourakbari Kasmaei, 2019 3
MILP (Introduction) If the LP model contains both the Continuous and Integer Variables, the model is a Mixed-Integer Linear Programming (MILP). M. Pourakbari Kasmaei, 2019 4
MILP (Introduction) ü Some special types of MILP problems are: • Mixed-Binary Linear Programming (MBLP) Problem: If in MILP problems the Integer Variables take only the values 0 or 1. Binary Variables • Integer Linear Programming (ILP) Problem: If there is no Continuous variables in the MILP problem. • Binary Linear Programming (BLP) Problem: If Integer Variables in ILP Problem take only the values 0 or 1. M. Pourakbari Kasmaei, 2019 5
MILP (Real World Examples) ü Placement Problems (Photovoltaic System, Wind System, Charging Station, etc. ) ü Repair and Maintenance Problems (Wind Farm, Wind Turbine, PV panels, etc. ) ü Electricity Generation and Scheduling Problems (Unit Commitment, Economic Dispatch, etc. ) ü Other (Gas Storage, Oil Transmission, . . . ) M. Pourakbari Kasmaei, 2019 6
MILP (Problem Formulation) Integer Variables M. Pourakbari Kasmaei, 2019 7
MILP (Problem Formulation-MBLP) Binary Variables M. Pourakbari Kasmaei, 2019 8
MILP (Problem Formulation-ILP) Only Integer Variables M. Pourakbari Kasmaei, 2019 9
MILP (Problem Formulation-BLP) Only Binary Variables M. Pourakbari Kasmaei, 2019 10
Mixed-Integer Linear Programming (MILP) Example 6. 1: Transportation Problem Good type Volume Weight A 1. 5 100 B 1. 6 90 C 1. 1 125 M. Pourakbari Kasmaei 11
Mixed-Integer Linear Programming (MILP) Example 6. 1: Transportation Problem m ü The objective is to Maximize something. e l b owhat? ? ü What are the decision variables? To maximize r P P Yes, the number of goods. L I ü Continuous or Integer or Binary? Goods can not be broken (Not Continuous), is not a Yes-No decision (Not Binary), then the variables are Integer. ü Do we have any costraint? Yes, the accomodation limits of the Van. M. Pourakbari Kasmaei 12
Mixed-Integer Linear Programming (MILP) Example 6. 1: Transportation Problem M. Pourakbari Kasmaei 13
Mixed-Integer Linear Programming (MILP) Example 6. 1: Transportation Problem Options Optcr=0; Duality Gap ---- VAR Z ---- VAR x 1 ---- VAR x 2 ---- VAR x 3 Variable Z; Integer Variables x 1, x 2, x 3; Equations Eq. Obj, Eq 1, Eq 2; LOWER -INF. . . LEVEL 8. 000 1. 000 2. 000 5. 000 UPPER MARGINAL +INF. 100. 000 1. 000 Eq. Obj. . z =e= x 1 + x 2 + x 3; Eq 1. 5*x 1 + 1. 6*x 2 + 1. 1*x 3 =l= 10. 7; LOWER ---- EQU Eq. Obj. ---- EQU Eq 1 -INF ---- EQU Eq 2 -INF Eq 2. . 100*x 1 + 90*x 2 + 125*x 3 =l= 970; Model Ex 6_1_ILP /ALL/; LEVEL. 10. 200 905. 000 UPPER MARGINAL. 1. 000 10. 700. 970. 000. Solve Ex 6_1_ILP USING MIP MAXIMIZING Z; M. Pourakbari Kasmaei 14
Mixed-Integer Linear Programming (MILP) ü Optimality Criterion (Opt. Cr): • Specifies a relative termination tolerance for a global solver. The precise definition of Opt. Cr depends on the solver. GAMS and some solvers use the following formula to compute the Optimality Gap: |PB-DB| / max(|PB|, |DB|) The primal bound PB is the objective function value of the best feasible solution found so far and the dual bound DB is the current bound on the optimal value of the problem (i. e. , lower bound for minimization and upper bound for maximization). M. Pourakbari Kasmaei 15
Mixed-Integer Linear Programming (MILP) ü Concept of Optimality Criterion (Opt. Cr): • If the Primal is Min Problem, then the Dual is Max Problem: OPTCR=0 M. Pourakbari Kasmaei 16
Mixed-Integer Linear Programming (MILP) Example 6. 2: Economic Dispatch (LP) Equality M. Pourakbari Kasmaei 17
Mixed-Integer Linear Programming (MILP) Example 6. 2: Economic Dispatch (LP) Demand Restrictions due to Shared Cooling System M. Pourakbari Kasmaei 18
Mixed-Integer Linear Programming (MILP) Example 6. 1: Economic Dispatch (LP) Variables Z; Positive Variables Pg 1, Pg 2; Equations Eq. Obj, Eq 1, Eq 2, Eq 3, Eq 4, Eq 5; Eq. Obj. . z =e= 2*Pg 1 + Pg 2; Eq 1. . Pg 1 + Pg 2 =e= 62; Eq 2. . (2/3)*Pg 1 + Pg 2 =l= 68; Eq 3. . 2*Pg 1 + 0. 3*Pg 2 =g= 50; Eq 4. . Pg 1 =l= 50; Eq 5. . Pg 2 =l= 40; Model LP_ED /ALL/; Solve LP_ED Using LP Minimizing Z; LOWER ---- VAR Z -INF ---- VAR x 1. ---- VAR x 2. LEVEL UPPER 84. 000 +INF 22. 000 +INF 40. 000 +INF LOWER ---- EQU Eq 1 ---- EQU Eq 2 ---- EQU Eq 3 ---- EQU Eq 4 ---- EQU Eq 5 62. 000 -INF 50. 000 -INF M. Pourakbari Kasmaei, 2019 MARGINAL. . . LEVEL UPPER MARGINAL 62. 000 54. 667 56. 000 22. 000 40. 000 +INF 68. 000 +INF 50. 000 40. 000 2. 000 0. 000 -1. 000 19
Mixed-Integer Linear Programming (MILP) Example 6. 3: Economic Dispatch (MILP) ü In Practice, some of the generating unit are prohibited to operate in one/several zone(s). Therefore, • Instead of having only one Operating zone, a set of operating zones, namely, Disjoint Operating Zones exist. • Disjoint Operating Zones is also called Prohibited Operating Zones. M. Pourakbari Kasmaei, 2019 20
Mixed-Integer Linear Programming (MILP) Example 6. 3: Economic Dispatch (MILP) ü Let us consider three Disjoint Operating Zones (DOZ) for the first generating unit. Cost Coefficient (€/MW) Unit Output (MW) DOZ: Logical Constraint M. Pourakbari Kasmaei, 2019 21
Mixed-Integer Linear Programming (MILP) Example 6. 3: Economic Dispatch (MILP) ü There is no solver to handle logical terms, how to address this issue. • Transform these terms into integer-based terms. Prohibited Operating Zones 18 25 40 43 M. Pourakbari Kasmaei, 2019 22
Mixed-Integer Linear Programming (MILP) Example 6. 3: Economic Dispatch (MILP) ü Assign Binary Variables to each Operating Zone Prohibited Operating Zones 18 25 40 43 Only One Zone should be selected M. Pourakbari Kasmaei, 2019 23
Mixed-Integer Linear Programming (MILP) Example 6. 3: Economic Dispatch (MILP) ü Then, the MILP (or more specifically MBLP) model is obtained. M. Pourakbari Kasmaei, 2019 24
Mixed-Integer Linear Programming (MILP) Example 6. 3: Economic Dispatch (MILP) Options OPTCR = 0; Variable Z; Positive Variables Pg 1, Pg 2; Binary Variables u 1, u 2, u 3; Equations Eq. Obj, Eq 1, Eq 2, Eq 3, Eq 4_1, Eq 4_2, Eq 4_3, Eq 5; Eq. Obj. . z =e= 2*Pg 1 + Pg 2; Eq 1. . Pg 1 + Pg 2 =e= 62; Eq 2. . (2/3)*Pg 1 + Pg 2 =l= 68; Eq 3. . 2*Pg 1 + 0. 3*Pg 2 =g= 50; Eq 4_1. . Pg 1 =l= 18*u 1 + 40*u 2 + 50*u 3; Eq 4_2. . Pg 1 =g= 25*u 2 + 43*u 3; Eq 4_3. . u 1 + u 2 + u 3 =e= 1; Eq 5. . Pg 2 =l= 40; Model MILP_ED /ALL/; Solve MILP_ED USING MIP MINIMIZING Z; ---- VAR Z ---- VAR x 1 ---- VAR x 2 LOWER ---- VAR Z -INF ---- VAR Pg 1. ---- VAR Pg 2. ---- VAR u 1. ---- VAR u 2. ---- VAR u 3. M. Pourakbari Kasmaei, 2019 LOWER -INF. . LEVEL 87. 000 25. 000 37. 000. 1. 000. LEVEL UPPER 84. 000 +INF 22. 000 +INF 40. 000 +INF UPPER +INF 1. 000 MARGINAL. . . EPS 25. 000 43. 000 25
LP and MILP Problems (Tricks) Useful Tricks and Linearization Techniques M. Pourakbari Kasmaei, 2019 26
LP and MILP Problems (Tricks) Ø Why to get rid of Nonconvex-Nonlinear Terms? • There is no guarantee for Optimal Global Solution in Nonconvex-Nonlinear Problems. Too much simplification is not aceptable. Finding Equivalent models are appreciated. M. Pourakbari Kasmaei, 2019 27
LP and MILP Problems (Tricks, Abs. . ) M. Pourakbari Kasmaei, 2019 28
LP and MILP Problems (Tricks, Abs. . ) Ø Therefore, the equivalent model is: M. Pourakbari Kasmaei, 2019 29
LP and MILP Problems (Tricks, Abs. . ) Example 6. 4: Absolute Value M. Pourakbari Kasmaei, 2019 30
LP and MILP Problems (Tricks, Abs. . ) Example 6. 4: Absolute Value Variable z; Positive Variables x_p, x_n; Equations Eq. Obj, Eq 1, Eq 2; Eq. Obj. . z =e= (x_p + x_n); Eq 1. . x_p - x_n =l= 6; Eq 2. . x_p - x_n =g= 1; LOWER ---- VAR z -INF ---- VAR x_p. ---- VAR x_n. LEVEL UPPER 1. 000 +INF MARGINAL. . 2. 000 Model Ex 6_4_ABS /ALL/; Solve Ex 6_4_ABS USING LP MINIMIZING Z; M. Pourakbari Kasmaei, 2019 31
LP and MILP Problems (Tricks, Minimax) 2) Minimax Objective For. Exaple for K={1, 2, 3}, and J={1, 2} M. Pourakbari Kasmaei, 2019 32
LP and MILP Problems (Tricks , Minimax) Ø Let us define an auxiliary variable z as follows Ø In order to establish this relationship, the following constraint will be considered M. Pourakbari Kasmaei, 2019 33
LP and MILP Problems (Tricks , Minimax) Ø Finally, we have: M. Pourakbari Kasmaei, 2019 34
LP and MILP Problems (Tricks , Range. . ) 3) Range Constraint: Range Constraint Ø One possibility is to have two seperate constraints, less-thanor-equal-to and greater-than-or-equal-to; M. Pourakbari Kasmaei, 2019 35
LP and MILP Problems (Tricks , Range. . ) Ø However, a clever move is to introduce an auxiliary variable as follows: Ø And then bound this variable: M. Pourakbari Kasmaei, 2019 36
LP and MILP Problems (Tricks , Range. . ) Ø Therefore, we have: M. Pourakbari Kasmaei, 2019 37
LP and MILP Problems (Tricks , Discontinuous. . ) 4) Discontinuous limit Ø Let us consider that a variable can take 0 or should stay within the bounds: Ø We use one binary variable u where M. Pourakbari Kasmaei, 2019 38
LP and MILP Problems (Tricks , Discontinuous. . ) Ø The following constraints can be used M. Pourakbari Kasmaei, 2019 39
LP and MILP Problems (Tricks , Either-or. . ) 5) Either-or Constraint (1) (2) At least one of the conditions (1) or (2) should be hold M. Pourakbari Kasmaei, 2019 40
LP and MILP Problems (Tricks , Discontinuous. . ) By using one binary variable and Big-M Method, this situation can be handled. (1) (2) M. Pourakbari Kasmaei, 2019 41
LP and MILP Problems (Tricks , Either-or. . ) Therefore, we have: M. Pourakbari Kasmaei, 2019 42
LP and MILP Problems (Tricks , Conditional. . ) 6) Conditional Constraint (1) (2) if (1) is satisfied, then (2) must also be satisfied We need some Knowledge on Logical expressions M. Pourakbari Kasmaei, 2019 43
LP and MILP Problems (Tricks , Conditional. . ) ü Let A denote the statement that the logical expression “Constraint (1) holds” is true, and similarly, let B denote the statement that the logical expression “Constraint (2) holds” is true. The notation ¬A and ¬B represent the case of the corresponding logical expressions being false. ü The above conditional constraint can be restated as: A implies B. This is logically equivalent to writing (A and ¬B) is false. Using the negation of this expression, it follows that ¬(A and ¬B) is true. This is equivalent to (¬A or B) is true, using Boolean algebra. It is this last equivalence that allows one to translate the above conditional constraint into an either-or constraint. M. Pourakbari Kasmaei, 2019 44
LP and MILP Problems (Tricks , Conditional. . ) Therefore, if holds, then must also hold, Which is equivalent to or M. Pourakbari Kasmaei, 2019 45
LP and MILP Problems (Tricks , Conditional. . ) We need greater-than-or-equal-to or ü The Problem has been transformed into Either-or Constraint, then: M. Pourakbari Kasmaei, 2019 46
Thanks! M. Pourakbari Kasmaei, 2019 47