packing problems using gurobi

12
Packing Problems Using Gurobi

Upload: terrance-smith

Post on 13-Apr-2017

108 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Packing Problems Using Gurobi

Packing Problems Using Gurobi

Page 2: 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.

Page 3: Packing Problems Using Gurobi

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

Page 4: Packing Problems Using Gurobi

Formulation of packing rectangles using MILP

A MILP general model:

Subject to i = 1,…,N j = 1,…,N i = 1,…,N j = 1,…,N i = 1,…,N j = 1,…,N 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

Page 5: Packing Problems Using Gurobi

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

Page 6: Packing Problems Using Gurobi

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

Page 7: Packing Problems Using Gurobi

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

Page 8: Packing Problems Using Gurobi

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).

Page 9: Packing Problems Using Gurobi

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

Page 10: Packing Problems Using Gurobi

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.

Page 11: Packing Problems Using Gurobi

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.

Page 12: Packing Problems Using Gurobi

Questions???????