SlideShare a Scribd company logo
1 of 12
Packing Problems
Using Gurobi
What is packing problems
 Packing problems are a class of optimization problems in mathematics that
involve attempting to pack objects together into containers. The goal is to
either pack a single container as densely as possible or pack all objects
using as few containers as possible.
Examples of Packing Problems
 Packing Commercials into station breaks
 Packing files onto floppy disks (Dvds, CDs, etc.)
 Packing telemetry data into fixed size pockets
 Packing News articles onto a news paper
 Packing a suitcase
Formulation of packing rectangles
using MILP
 A MILP general model:
 𝑧 = 𝑚𝑖𝑛 𝑖=1
𝑁
(𝑚𝑖 ∗ 𝑔 ∗ 𝑦𝑖)
Subject to

𝑤 𝑖
2
+ 𝑥𝑖 < 𝑥𝑗 −
𝑤 𝑗
2
i = 1,…,N j = 1,…,N

𝑤 𝑗
2
+ 𝑥𝑗 < 𝑥𝑖 −
𝑤 𝑖
2
i = 1,…,N j = 1,…,N

ℎ 𝑖
2
+ 𝑦𝑖 < 𝑦𝑗 −
ℎ 𝑗
2
i = 1,…,N j = 1,…,N

ℎ 𝑗
2
+ 𝑦𝑗 < 𝑦𝑖 −
ℎ 𝑖
2
i = 1,…,N j = 1,…,N
 𝑎𝑖𝑗 ∗ 𝑥𝑗 ≥ 𝑏𝑖 i = 1,…,N j = 1,…,N
 Coefficients:
 w – width of ith rectangle
 h – height of ith rectangle
 A = [N,N] = {aij}, (𝑁 × 𝑁) matrix
 b = [N] = N vector
 g- constant variable
 Variables:
 x = [N] = N vector of variables
 y = [N] = N vector of variables
 Where 𝑥, 𝑦 = the lower left
coordinate of rectangle i
Why an MILP model
 Integer and continuous variables are both considered
 If i = j, z is a Integer Programming Problem (ILP)
 If i = 0, z is a Linear Programming Problem (LP)
 The constraints and the objective function are modeled using linear
equalities/inequalities
 Effective solution techniques: Branch & Bound, Branch & Cut, Branch &
Price
 Software available (CPLEX, XPRESS, GLPK, etc)
 Huge problems can be easily solved
MILP model explanation
 MILP Constraints
 The resources used in a optimization problems always limited by a set of
constraints
 MILP Variables
 Variables reflect the resources to be allocated
 MILP Objective Function
 The objective function reflects the optimization aspect of the model
What is Gurobi Optimization
 The Gurobi Optimizer is a commercial optimization solver for
 Linear programming (LP),
 Quadratic programming (QP),
 Quadratical constrained programming (QCP),
 Mixed integer linear programming (MILP)
 Etc
Solving MILP using Gurobi solver
 The data associated with an optimization model must be stored in a
MATLAB struct.
 Fields in this struct contain the different parts of the model.
 A few fields are mandatory:
 the constraint matrix (A),
 the objective vector (obj),
 the right-hand side vector (rhs),
 the constraint sense vector (sense).
 A model can also include optional fields (e.g., the objective sense
model.sense).
Modifying Gurobi parameters
 We must create a struct variable that will be used to modify the Gurobi
parameters
 params.outputflag = 0;
 params.resultfile = ’………’;
 The Gurobi OutputFlag parameter is set to 0 in order to shut off Gurobi
output.
 Also the ResultFile parameter is set to request that Gurobi produce a file as
output
Solving the model
 The result is where the actual optimization occurs:
 result = gurobi(model, params);
 We pass the model and the optional list of parameter changes to the
gurobi() function.
 It computes an optimal solution to the specified model and returns the
computed result.
Printing the solution
 The gurobi() function returns a struct as its result
 This struct contains a number of fields, where each field contains
information about the computed solution
 The available fields depend on the result of the optimization, the type of
model that was solved,
 The algorithm used to solve the model.
Questions???????

More Related Content

What's hot

Robotic Process Automation Challenges And Solution And Steps PowerPoint Prese...
Robotic Process Automation Challenges And Solution And Steps PowerPoint Prese...Robotic Process Automation Challenges And Solution And Steps PowerPoint Prese...
Robotic Process Automation Challenges And Solution And Steps PowerPoint Prese...SlideTeam
 
mbot2.0教學-陀螺儀與三軸加速計應用.pdf
mbot2.0教學-陀螺儀與三軸加速計應用.pdfmbot2.0教學-陀螺儀與三軸加速計應用.pdf
mbot2.0教學-陀螺儀與三軸加速計應用.pdf吳錫修 (ShyiShiou Wu)
 
RPA (Robotic Process Automation)
RPA (Robotic Process Automation)RPA (Robotic Process Automation)
RPA (Robotic Process Automation)MERITAS-CORPORATION
 
Fieldbus Tutorial Part 8 - Fieldbus Function Blocks
Fieldbus Tutorial Part 8 - Fieldbus Function BlocksFieldbus Tutorial Part 8 - Fieldbus Function Blocks
Fieldbus Tutorial Part 8 - Fieldbus Function BlocksEmerson Exchange
 
A straightforward approach using DeltaV SIS for typical BMS systems
 A straightforward approach using DeltaV SIS for typical BMS systems A straightforward approach using DeltaV SIS for typical BMS systems
A straightforward approach using DeltaV SIS for typical BMS systemsDavid Sheppard
 
New DeltaV Module Templates to Easily Configure, View, and Trend Advanced Pre...
New DeltaV Module Templates to Easily Configure, View, and Trend Advanced Pre...New DeltaV Module Templates to Easily Configure, View, and Trend Advanced Pre...
New DeltaV Module Templates to Easily Configure, View, and Trend Advanced Pre...Emerson Exchange
 
Auto Code Generation and Rapid Brewery/Distillery Automation
Auto Code Generation and Rapid Brewery/Distillery AutomationAuto Code Generation and Rapid Brewery/Distillery Automation
Auto Code Generation and Rapid Brewery/Distillery AutomationDMC, Inc.
 
MakeBlock 超萌機器人 mBot 簡介 - 探奇工作室
MakeBlock 超萌機器人 mBot 簡介 - 探奇工作室MakeBlock 超萌機器人 mBot 簡介 - 探奇工作室
MakeBlock 超萌機器人 mBot 簡介 - 探奇工作室信仁 邱
 
DeltaV Electronic Marshalling
DeltaV Electronic MarshallingDeltaV Electronic Marshalling
DeltaV Electronic MarshallingSumeet Goel
 
Advanced PLC Programming Course EMERSON EDUARDO RODRIGUES
Advanced PLC Programming Course EMERSON EDUARDO RODRIGUESAdvanced PLC Programming Course EMERSON EDUARDO RODRIGUES
Advanced PLC Programming Course EMERSON EDUARDO RODRIGUESEMERSON EDUARDO RODRIGUES
 
Siemens and MES (Manufacturing Execution System)
Siemens and MES (Manufacturing Execution System)Siemens and MES (Manufacturing Execution System)
Siemens and MES (Manufacturing Execution System)Vera Leonik-Shilyaeva
 
Application migration guideline document
Application migration guideline documentApplication migration guideline document
Application migration guideline documentThomas Bronack
 
Delta v advanced control overview_en
Delta v advanced control overview_enDelta v advanced control overview_en
Delta v advanced control overview_enLuis Atencio
 
企業資源規劃(Erp)系統導入規劃
企業資源規劃(Erp)系統導入規劃企業資源規劃(Erp)系統導入規劃
企業資源規劃(Erp)系統導入規劃Simon Huang
 

What's hot (20)

Robotic Process Automation Challenges And Solution And Steps PowerPoint Prese...
Robotic Process Automation Challenges And Solution And Steps PowerPoint Prese...Robotic Process Automation Challenges And Solution And Steps PowerPoint Prese...
Robotic Process Automation Challenges And Solution And Steps PowerPoint Prese...
 
mbot2.0教學-陀螺儀與三軸加速計應用.pdf
mbot2.0教學-陀螺儀與三軸加速計應用.pdfmbot2.0教學-陀螺儀與三軸加速計應用.pdf
mbot2.0教學-陀螺儀與三軸加速計應用.pdf
 
RPA (Robotic Process Automation)
RPA (Robotic Process Automation)RPA (Robotic Process Automation)
RPA (Robotic Process Automation)
 
Fieldbus Tutorial Part 8 - Fieldbus Function Blocks
Fieldbus Tutorial Part 8 - Fieldbus Function BlocksFieldbus Tutorial Part 8 - Fieldbus Function Blocks
Fieldbus Tutorial Part 8 - Fieldbus Function Blocks
 
A straightforward approach using DeltaV SIS for typical BMS systems
 A straightforward approach using DeltaV SIS for typical BMS systems A straightforward approach using DeltaV SIS for typical BMS systems
A straightforward approach using DeltaV SIS for typical BMS systems
 
mbot2.0教學-局域網路傳輸應用.pdf
mbot2.0教學-局域網路傳輸應用.pdfmbot2.0教學-局域網路傳輸應用.pdf
mbot2.0教學-局域網路傳輸應用.pdf
 
AWS IoT Lab Introduction
AWS IoT Lab IntroductionAWS IoT Lab Introduction
AWS IoT Lab Introduction
 
New DeltaV Module Templates to Easily Configure, View, and Trend Advanced Pre...
New DeltaV Module Templates to Easily Configure, View, and Trend Advanced Pre...New DeltaV Module Templates to Easily Configure, View, and Trend Advanced Pre...
New DeltaV Module Templates to Easily Configure, View, and Trend Advanced Pre...
 
Auto Code Generation and Rapid Brewery/Distillery Automation
Auto Code Generation and Rapid Brewery/Distillery AutomationAuto Code Generation and Rapid Brewery/Distillery Automation
Auto Code Generation and Rapid Brewery/Distillery Automation
 
MakeBlock 超萌機器人 mBot 簡介 - 探奇工作室
MakeBlock 超萌機器人 mBot 簡介 - 探奇工作室MakeBlock 超萌機器人 mBot 簡介 - 探奇工作室
MakeBlock 超萌機器人 mBot 簡介 - 探奇工作室
 
DeltaV Electronic Marshalling
DeltaV Electronic MarshallingDeltaV Electronic Marshalling
DeltaV Electronic Marshalling
 
Advanced PLC Programming Course EMERSON EDUARDO RODRIGUES
Advanced PLC Programming Course EMERSON EDUARDO RODRIGUESAdvanced PLC Programming Course EMERSON EDUARDO RODRIGUES
Advanced PLC Programming Course EMERSON EDUARDO RODRIGUES
 
Plant Integration and MES Solution for Industry
Plant Integration and MES Solution for IndustryPlant Integration and MES Solution for Industry
Plant Integration and MES Solution for Industry
 
Siemens and MES (Manufacturing Execution System)
Siemens and MES (Manufacturing Execution System)Siemens and MES (Manufacturing Execution System)
Siemens and MES (Manufacturing Execution System)
 
mbot2.0教學-移動控制.pdf
mbot2.0教學-移動控制.pdfmbot2.0教學-移動控制.pdf
mbot2.0教學-移動控制.pdf
 
Robust ai
Robust aiRobust ai
Robust ai
 
Application migration guideline document
Application migration guideline documentApplication migration guideline document
Application migration guideline document
 
Delta v advanced control overview_en
Delta v advanced control overview_enDelta v advanced control overview_en
Delta v advanced control overview_en
 
企業資源規劃(Erp)系統導入規劃
企業資源規劃(Erp)系統導入規劃企業資源規劃(Erp)系統導入規劃
企業資源規劃(Erp)系統導入規劃
 
教學(10) 藍牙控制應用
教學(10)藍牙控制應用教學(10)藍牙控制應用
教學(10) 藍牙控制應用
 

Similar to Packing Rectangles MILP

NON LINEAR PROGRAMMING
NON LINEAR PROGRAMMING NON LINEAR PROGRAMMING
NON LINEAR PROGRAMMING karishma gupta
 
Solving Optimization Problems using the Matlab Optimization.docx
Solving Optimization Problems using the Matlab Optimization.docxSolving Optimization Problems using the Matlab Optimization.docx
Solving Optimization Problems using the Matlab Optimization.docxwhitneyleman54422
 
Quantitativetechniqueformanagerialdecisionlinearprogramming 090725035417-phpa...
Quantitativetechniqueformanagerialdecisionlinearprogramming 090725035417-phpa...Quantitativetechniqueformanagerialdecisionlinearprogramming 090725035417-phpa...
Quantitativetechniqueformanagerialdecisionlinearprogramming 090725035417-phpa...kongara
 
chapter 2 revised.pptx
chapter 2 revised.pptxchapter 2 revised.pptx
chapter 2 revised.pptxDejeneDay
 
chapter 2 revised.pptx
chapter 2 revised.pptxchapter 2 revised.pptx
chapter 2 revised.pptxDejeneDay
 
4optmizationtechniques-150308051251-conversion-gate01.pdf
4optmizationtechniques-150308051251-conversion-gate01.pdf4optmizationtechniques-150308051251-conversion-gate01.pdf
4optmizationtechniques-150308051251-conversion-gate01.pdfBechanYadav4
 
chapter 2 revised.pptx
chapter 2 revised.pptxchapter 2 revised.pptx
chapter 2 revised.pptxDejeneDay
 
linearprogramingproblemlpp-180729145239.pptx
linearprogramingproblemlpp-180729145239.pptxlinearprogramingproblemlpp-180729145239.pptx
linearprogramingproblemlpp-180729145239.pptxKOUSHIkPIPPLE
 
Convex optmization in communications
Convex optmization in communicationsConvex optmization in communications
Convex optmization in communicationsDeepshika Reddy
 
1 resource optimization 2
1 resource optimization 21 resource optimization 2
1 resource optimization 2shushay hailu
 
Linear Programing.pptx
Linear Programing.pptxLinear Programing.pptx
Linear Programing.pptxAdnanHaleem
 
Model-Based Optimization / INFORMS International
Model-Based Optimization / INFORMS InternationalModel-Based Optimization / INFORMS International
Model-Based Optimization / INFORMS InternationalBob Fourer
 
Chapter 2.Linear Programming.pdf
Chapter 2.Linear Programming.pdfChapter 2.Linear Programming.pdf
Chapter 2.Linear Programming.pdfTsegay Berhe
 
Vcs slides on or 2014
Vcs slides on or 2014Vcs slides on or 2014
Vcs slides on or 2014Shakti Ranjan
 

Similar to Packing Rectangles MILP (20)

Portfolio Planning
Portfolio PlanningPortfolio Planning
Portfolio Planning
 
Unit.2. linear programming
Unit.2. linear programmingUnit.2. linear programming
Unit.2. linear programming
 
NON LINEAR PROGRAMMING
NON LINEAR PROGRAMMING NON LINEAR PROGRAMMING
NON LINEAR PROGRAMMING
 
linear programming
linear programming linear programming
linear programming
 
Solving Optimization Problems using the Matlab Optimization.docx
Solving Optimization Problems using the Matlab Optimization.docxSolving Optimization Problems using the Matlab Optimization.docx
Solving Optimization Problems using the Matlab Optimization.docx
 
Quantitativetechniqueformanagerialdecisionlinearprogramming 090725035417-phpa...
Quantitativetechniqueformanagerialdecisionlinearprogramming 090725035417-phpa...Quantitativetechniqueformanagerialdecisionlinearprogramming 090725035417-phpa...
Quantitativetechniqueformanagerialdecisionlinearprogramming 090725035417-phpa...
 
chapter 2 revised.pptx
chapter 2 revised.pptxchapter 2 revised.pptx
chapter 2 revised.pptx
 
chapter 2 revised.pptx
chapter 2 revised.pptxchapter 2 revised.pptx
chapter 2 revised.pptx
 
4optmizationtechniques-150308051251-conversion-gate01.pdf
4optmizationtechniques-150308051251-conversion-gate01.pdf4optmizationtechniques-150308051251-conversion-gate01.pdf
4optmizationtechniques-150308051251-conversion-gate01.pdf
 
Optmization techniques
Optmization techniquesOptmization techniques
Optmization techniques
 
optmizationtechniques.pdf
optmizationtechniques.pdfoptmizationtechniques.pdf
optmizationtechniques.pdf
 
chapter 2 revised.pptx
chapter 2 revised.pptxchapter 2 revised.pptx
chapter 2 revised.pptx
 
Xgboost
XgboostXgboost
Xgboost
 
linearprogramingproblemlpp-180729145239.pptx
linearprogramingproblemlpp-180729145239.pptxlinearprogramingproblemlpp-180729145239.pptx
linearprogramingproblemlpp-180729145239.pptx
 
Convex optmization in communications
Convex optmization in communicationsConvex optmization in communications
Convex optmization in communications
 
1 resource optimization 2
1 resource optimization 21 resource optimization 2
1 resource optimization 2
 
Linear Programing.pptx
Linear Programing.pptxLinear Programing.pptx
Linear Programing.pptx
 
Model-Based Optimization / INFORMS International
Model-Based Optimization / INFORMS InternationalModel-Based Optimization / INFORMS International
Model-Based Optimization / INFORMS International
 
Chapter 2.Linear Programming.pdf
Chapter 2.Linear Programming.pdfChapter 2.Linear Programming.pdf
Chapter 2.Linear Programming.pdf
 
Vcs slides on or 2014
Vcs slides on or 2014Vcs slides on or 2014
Vcs slides on or 2014
 

Packing Rectangles MILP

  • 2. What is packing problems  Packing problems are a class of optimization problems in mathematics that involve attempting to pack objects together into containers. The goal is to either pack a single container as densely as possible or pack all objects using as few containers as possible.
  • 3. Examples of Packing Problems  Packing Commercials into station breaks  Packing files onto floppy disks (Dvds, CDs, etc.)  Packing telemetry data into fixed size pockets  Packing News articles onto a news paper  Packing a suitcase
  • 4. Formulation of packing rectangles using MILP  A MILP general model:  𝑧 = 𝑚𝑖𝑛 𝑖=1 𝑁 (𝑚𝑖 ∗ 𝑔 ∗ 𝑦𝑖) Subject to  𝑤 𝑖 2 + 𝑥𝑖 < 𝑥𝑗 − 𝑤 𝑗 2 i = 1,…,N j = 1,…,N  𝑤 𝑗 2 + 𝑥𝑗 < 𝑥𝑖 − 𝑤 𝑖 2 i = 1,…,N j = 1,…,N  ℎ 𝑖 2 + 𝑦𝑖 < 𝑦𝑗 − ℎ 𝑗 2 i = 1,…,N j = 1,…,N  ℎ 𝑗 2 + 𝑦𝑗 < 𝑦𝑖 − ℎ 𝑖 2 i = 1,…,N j = 1,…,N  𝑎𝑖𝑗 ∗ 𝑥𝑗 ≥ 𝑏𝑖 i = 1,…,N j = 1,…,N  Coefficients:  w – width of ith rectangle  h – height of ith rectangle  A = [N,N] = {aij}, (𝑁 × 𝑁) matrix  b = [N] = N vector  g- constant variable  Variables:  x = [N] = N vector of variables  y = [N] = N vector of variables  Where 𝑥, 𝑦 = the lower left coordinate of rectangle i
  • 5. Why an MILP model  Integer and continuous variables are both considered  If i = j, z is a Integer Programming Problem (ILP)  If i = 0, z is a Linear Programming Problem (LP)  The constraints and the objective function are modeled using linear equalities/inequalities  Effective solution techniques: Branch & Bound, Branch & Cut, Branch & Price  Software available (CPLEX, XPRESS, GLPK, etc)  Huge problems can be easily solved
  • 6. MILP model explanation  MILP Constraints  The resources used in a optimization problems always limited by a set of constraints  MILP Variables  Variables reflect the resources to be allocated  MILP Objective Function  The objective function reflects the optimization aspect of the model
  • 7. What is Gurobi Optimization  The Gurobi Optimizer is a commercial optimization solver for  Linear programming (LP),  Quadratic programming (QP),  Quadratical constrained programming (QCP),  Mixed integer linear programming (MILP)  Etc
  • 8. Solving MILP using Gurobi solver  The data associated with an optimization model must be stored in a MATLAB struct.  Fields in this struct contain the different parts of the model.  A few fields are mandatory:  the constraint matrix (A),  the objective vector (obj),  the right-hand side vector (rhs),  the constraint sense vector (sense).  A model can also include optional fields (e.g., the objective sense model.sense).
  • 9. Modifying Gurobi parameters  We must create a struct variable that will be used to modify the Gurobi parameters  params.outputflag = 0;  params.resultfile = ’………’;  The Gurobi OutputFlag parameter is set to 0 in order to shut off Gurobi output.  Also the ResultFile parameter is set to request that Gurobi produce a file as output
  • 10. Solving the model  The result is where the actual optimization occurs:  result = gurobi(model, params);  We pass the model and the optional list of parameter changes to the gurobi() function.  It computes an optimal solution to the specified model and returns the computed result.
  • 11. Printing the solution  The gurobi() function returns a struct as its result  This struct contains a number of fields, where each field contains information about the computed solution  The available fields depend on the result of the optimization, the type of model that was solved,  The algorithm used to solve the model.