23
Optimizing Design, Planning and Operation Problems with Discrete Decisions Using Integer Programming Jim Luedtke Industrial & Systems Engineering, Wisconsin Institute for Discovery University of Wisconsin–Madison MaGIC 2018 Jim Luedtke (UW–Madison) Integer Programming December 4, 2018 1 / 23

Optimizing Design, Planning and Operation Problems with ...€¦ · Examples of yes/no decisions Facility location: x j = 1 if build a facility in location j Vehicle routing: x

  • Upload
    others

  • View
    3

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Optimizing Design, Planning and Operation Problems with ...€¦ · Examples of yes/no decisions Facility location: x j = 1 if build a facility in location j Vehicle routing: x

Optimizing Design, Planning and Operation Problemswith Discrete Decisions Using Integer Programming

Jim Luedtke

Industrial & Systems Engineering, Wisconsin Institute for DiscoveryUniversity of Wisconsin–Madison

MaGIC 2018

Jim Luedtke (UW–Madison) Integer Programming December 4, 2018 1 / 23

Page 2: Optimizing Design, Planning and Operation Problems with ...€¦ · Examples of yes/no decisions Facility location: x j = 1 if build a facility in location j Vehicle routing: x

Mathematical optimization

Components of a mathematical optimization model1 Decision variables: values we are trying to find2 Objective function: what we want to maximize or minimize3 Constraints: limits on the allowed values of the decision variables

Constraints and objective funtion are usually written using algebraicfunctions of the decision variables

Optimization problemFind the values of the decision variables that satisfy the constraints, andgive the best value of the objective function.

Jim Luedtke (UW–Madison) Integer Programming December 4, 2018 2 / 23

Page 3: Optimizing Design, Planning and Operation Problems with ...€¦ · Examples of yes/no decisions Facility location: x j = 1 if build a facility in location j Vehicle routing: x

Example: Economic dispatch of powerPower Grid Operation Problem

Generators are connected to customers via power gridHow much power to produce from each generator to meet customerdemands at minimum cost?

Jim Luedtke (UW–Madison) Integer Programming December 4, 2018 3 / 23

Page 4: Optimizing Design, Planning and Operation Problems with ...€¦ · Examples of yes/no decisions Facility location: x j = 1 if build a facility in location j Vehicle routing: x

Example: Economic dispatch of power

Decision variables:xi: Amount of power to produce from generator iθi: Voltage at bus i in the networkfij : Flow on line ij in the network

Objective function:Minimize sum of generation costs

Constraints (all can be written as linear equations and inequalities):Net flow out/in of each node equals its supply/demand (Kirchoff’sfirst law)Flow on a line is proportional to voltage difference of endpointsThermal limits of power flow on each line (fij ≤ Uij)

Jim Luedtke (UW–Madison) Integer Programming December 4, 2018 4 / 23

Page 5: Optimizing Design, Planning and Operation Problems with ...€¦ · Examples of yes/no decisions Facility location: x j = 1 if build a facility in location j Vehicle routing: x

Solving a continuous optimization model

Continuous optimization modelsDecision variables can take on any fractional valuesE.g., flow on a power line can be 2.4325

Solution methods depend on the form of the objective function andconstraints

Best case scenario: all are linear functions of the decision variables ⇒Linear ProgrammingRunner-up: all functions are convex ⇒ Convex ProgrammingHUGE linear programming problems (millions of decision variablesand constraints) can be solved routinely with modern software

Jim Luedtke (UW–Madison) Integer Programming December 4, 2018 5 / 23

Page 6: Optimizing Design, Planning and Operation Problems with ...€¦ · Examples of yes/no decisions Facility location: x j = 1 if build a facility in location j Vehicle routing: x

Mixed-integer programmingMany design, planning, and operational problems involve discrete decisions

Turn a generator on or not?How many chillers to include in a chemical processing plant?Build a warehouse at a candidate location or not?

These types of decisions can be modeled with mixed-integerprogramming

An optimization model in which some variables are required to takeon integer values

minx=(x1,x2,...,xn)

f(x)

subject to: Ax ≤ bxj ∈ Z, j ∈ I

Most important case: Binary variables, xj is 0 or 1 ⇒ Can be used tomodel yes/no decisions

Jim Luedtke (UW–Madison) Integer Programming December 4, 2018 6 / 23

Page 7: Optimizing Design, Planning and Operation Problems with ...€¦ · Examples of yes/no decisions Facility location: x j = 1 if build a facility in location j Vehicle routing: x

Examples of yes/no decisions

Facility location: xj = 1 if build a facility in location jVehicle routing: xij = 1 if travel from i to j in a routePortfolio optimization with fixed transaction costs: xi = 1 if invest inasset iSparse regression: xi = 1 if use feature i in regression modelMachine assignment: xij = 1 if machine i does job jNetwork design: xij = 1 if location i and location j are connectedScheduling: xit = 1 if task i starts at (discrete-time) t

Jim Luedtke (UW–Madison) Integer Programming December 4, 2018 7 / 23

Page 8: Optimizing Design, Planning and Operation Problems with ...€¦ · Examples of yes/no decisions Facility location: x j = 1 if build a facility in location j Vehicle routing: x

Economic dispatch revisited

Suppose turning on a generator incurs a fixed cost – How to model thiscost in objective function?

Add new binary variable: yj = 1 if generator j is switched onAdd FixedCostj × yj to the objective functionAdd constraints: xj ≤ Ujyj (if yj = 0, produce nothing)

Binary variables also useful for modeling “weird’ physical constraintsE.g., if a generator is switched on, it must produce at least Lj unitsUse same model as above, but add: xj ≥ Ljyj

Binary variables can also be used to model “switching” lines (i.e.,disconnecting them)

Changes the physics constraints that are used

Jim Luedtke (UW–Madison) Integer Programming December 4, 2018 8 / 23

Page 9: Optimizing Design, Planning and Operation Problems with ...€¦ · Examples of yes/no decisions Facility location: x j = 1 if build a facility in location j Vehicle routing: x

Scheduling using binary variables

Unit commitment problemGiven a set of time periods t = 1, . . . , T (e.g., next 168 hours) planwhen all generators should be turned on and off

Binary decision variables:yjt = 1 if generator j is on during period tzjt = 1 if generator j “is switched on” at beginning of period t

Can then model minimum up/down constraints:When a generator is turned on, it must stay on a minimum number ofperiodsWhen a generator is turned off, it must stay off a minimum numberof periods

Jim Luedtke (UW–Madison) Integer Programming December 4, 2018 9 / 23

Page 10: Optimizing Design, Planning and Operation Problems with ...€¦ · Examples of yes/no decisions Facility location: x j = 1 if build a facility in location j Vehicle routing: x

How we don’t solve integer programs

Consider a integer program with n binary variables“Simple” algorithm: Just try all 2n possible solutions

Suppose we can check 1 billion solutions per second:n = 20 =⇒ enumerate all solutions in 0.001 secondsn = 30 =⇒ 1 secondn = 50 =⇒ 13 daysn = 60 =⇒ 37 yearsn = 75 =⇒ 1,197,962 yearsn = 100 =⇒ 40,196,936,841,332 years

Real problems have thousands of binary decision varaibles ⇒ We needsmarter algorithms

Jim Luedtke (UW–Madison) Integer Programming December 4, 2018 10 / 23

Page 11: Optimizing Design, Planning and Operation Problems with ...€¦ · Examples of yes/no decisions Facility location: x j = 1 if build a facility in location j Vehicle routing: x

Another approach: Heuristics

Heuristic AlgorithmAn algorithm that is designed to find a good solution, but which hasno guarantee that it will find the best solution, or even find a feasiblesolution at all.Popular examples:

Genetic algorithmsTabu searchSimulated annealing

Pros and Cons of Heuristic Algorithms+ Typically run fast enough, and in many cases can find near-optimal

solutions- Heuristics need to be specialized for each different problem type- Might give bad solutions (or none at all), and do not provide any

information on how bad your solution might be

Jim Luedtke (UW–Madison) Integer Programming December 4, 2018 11 / 23

Page 12: Optimizing Design, Planning and Operation Problems with ...€¦ · Examples of yes/no decisions Facility location: x j = 1 if build a facility in location j Vehicle routing: x

Exact algorithms

Exact AlgorithmAn algorithm that is guaranteed to find a true optimal solution for anyproblem instance.

Modern mixed-integer programming software implements exact algorithmsfor solving general MIP problems

Any problem that can be written with mix of integer and continuousvariables, and linear (or even convex quadratic) constraints andobjectiveAlgorithm does not need to be specialized to the problem

Key question: Does an exact algorithm find an optimal solution fastenough? (e.g., not true for enumeration)

Jim Luedtke (UW–Madison) Integer Programming December 4, 2018 12 / 23

Page 13: Optimizing Design, Planning and Operation Problems with ...€¦ · Examples of yes/no decisions Facility location: x j = 1 if build a facility in location j Vehicle routing: x

Exact algorithms

Many special types of mixed-integer programming problems can be solvedexactly very efficiently with specialized algorithms

Shortest path between two nodes in a networkMaximum weight matching (selection of pairs) of nodes in a networkMinimum cost assignment of workers to tasks

Commercial MIP solvers: CPLEX,Gurobi, Xpress

Capable of solving general MIPmodels with thousands ofdecision variables andconstraints, within seconds orminutesDark magic?

Jim Luedtke (UW–Madison) Integer Programming December 4, 2018 13 / 23

Page 14: Optimizing Design, Planning and Operation Problems with ...€¦ · Examples of yes/no decisions Facility location: x j = 1 if build a facility in location j Vehicle routing: x

Ingredient 1 of Dark magic: Branch-and-bound

Linear programming relaxationIf we ignore the integer restrictions, MIP becomes a linear program ⇒Can be solved very quicklyMore feasible solutions in LP ⇒ Optimal value at least as good asMIP optimal value

After solving LP relaxation:If optimal solution satisfies integer restrictions ⇒ It’s optimal to MIP!Otherwise, some integer variable has a fractional value in LP solution(e.g., xj = 0.5)Then branch: Create two new subproblems

In one: Add constraint xj ≤ 0In other: Add constraint xj ≤ 1

Every solution to MIP is feasible to one of the two subproblems (Butnot the LP solution!)

Jim Luedtke (UW–Madison) Integer Programming December 4, 2018 14 / 23

Page 15: Optimizing Design, Planning and Operation Problems with ...€¦ · Examples of yes/no decisions Facility location: x j = 1 if build a facility in location j Vehicle routing: x

Branch-and-bound (cont’d)

Process of dividing solution set is applied recursivelyCreates a list of subproblems: Every solution is feasible to one of themIf repeated like this, it is just enumeration!

Dark Magic 1: BoundingEvery time we find a feasible solution, obtain an uppper bound onbest known solutionFor every subproblem, solve the LP relaxation ⇒ lower boundIf lower bound > best upper bound ⇒ No need to subdivide!

“Good” bounding ⇒ Avoid explicitly checking almost all solutionsGood ≡ LP relaxation value ≈ true optimal valueUnfortunately, this isn’t always true!

Jim Luedtke (UW–Madison) Integer Programming December 4, 2018 15 / 23

Page 16: Optimizing Design, Planning and Operation Problems with ...€¦ · Examples of yes/no decisions Facility location: x j = 1 if build a facility in location j Vehicle routing: x

Ingredient 2 of dark magic: Cutting planes

Cutting PlanesCutting planes are constraints added to a MIP problem that do notchange the set of solutions, but cut off solutions from the LP relaxation.

Theoretically, mixed-integer programcan be solved as a linear program withthe right cutting planes addedIn practice, cutting planes improvelinear program bound ⇒ Explore (far)fewer subproblemsFinding cutting planes is challenging ⇒Decades of researchMIP solvers have leveraged these resultsvery effectively

Jim Luedtke (UW–Madison) Integer Programming December 4, 2018 16 / 23

Page 17: Optimizing Design, Planning and Operation Problems with ...€¦ · Examples of yes/no decisions Facility location: x j = 1 if build a facility in location j Vehicle routing: x

Limitation of dark magic

MIP solvers work extremely well for mixed-integer linear problemsObjective function and all constraints are linear functins of decisionvariablesLimited types of nonlinearity also OK (e.g., convex, separable)

Definitely not always true!But, with clever modeling, many problems that do not seem linearcan be formulated (or closely approximated) with linear constraints

Jim Luedtke (UW–Madison) Integer Programming December 4, 2018 17 / 23

Page 18: Optimizing Design, Planning and Operation Problems with ...€¦ · Examples of yes/no decisions Facility location: x j = 1 if build a facility in location j Vehicle routing: x

Modeling with linear constraints (1)

q

f(q) = sgn(q)|q|c2

For arbitrary function of one variable:Approximate it as a piecewise-linear functionUse binary variables to choose which “piece” argument lies inCan then model function as linear function of new variables

Jim Luedtke (UW–Madison) Integer Programming December 4, 2018 18 / 23

Page 19: Optimizing Design, Planning and Operation Problems with ...€¦ · Examples of yes/no decisions Facility location: x j = 1 if build a facility in location j Vehicle routing: x

Modeling with linear constraints (2)

Choosing a discrete pipe sizesa: Decision variable represents area of piper: Decision variable represents radius of pipeBinary variables to choose among discrete types:

e.g., y1 = 1 if radius = 4, y2 = 1 if radius = 5, y3 = 1 if radius = 6Choose one size: y1 + y2 + y3 = 1

Radius equation: r = 4y1 + 5y2 + 6y3

Nonlinear area equation!a = πr2

Linear reformulation:

a = π(16y1 + 25y2 + 36y2)

Jim Luedtke (UW–Madison) Integer Programming December 4, 2018 19 / 23

Page 20: Optimizing Design, Planning and Operation Problems with ...€¦ · Examples of yes/no decisions Facility location: x j = 1 if build a facility in location j Vehicle routing: x

Another example problem MIP can help solve

Current Kaggle Competition: Traveling Santa ProblemSanta has to visit every house in his list (198,000)What sequence should Santa visit them in to minimize total distance?Same type of problem appears in many real routing problems (UPS,chip manufacturing,...)

Formulation as MIP?Binary decision variables: xij = 1 if city i immediately follows city jObjective is then linear function (sum over all possible connections)Linear constraints ensure every city visited exactly once, and no“subtours”Competition includes an extra ‘tricky’ cost to make it harder(!!)

Jim Luedtke (UW–Madison) Integer Programming December 4, 2018 20 / 23

Page 21: Optimizing Design, Planning and Operation Problems with ...€¦ · Examples of yes/no decisions Facility location: x j = 1 if build a facility in location j Vehicle routing: x

Current leaderboard

Jim Luedtke (UW–Madison) Integer Programming December 4, 2018 21 / 23

Page 22: Optimizing Design, Planning and Operation Problems with ...€¦ · Examples of yes/no decisions Facility location: x j = 1 if build a facility in location j Vehicle routing: x

Tips for using mixed-integer programming

Use a good solverCPLEX, Gurobi, Xpress, SCIPTry them out free at neos-server.org

Use a good modeling interfaceDescribes model to solver, connects your dataAMPL, GAMS, JuliaOpt, PuLP (Python), Gurobi (Python)

Use a good modelerHire one of our graduates!Or talk to us about collaborations (us=Me, Laura Albert, Alberto DelPia, Jeff Linderoth, Carla Michini)

Just try it!

Jim Luedtke (UW–Madison) Integer Programming December 4, 2018 22 / 23

Page 23: Optimizing Design, Planning and Operation Problems with ...€¦ · Examples of yes/no decisions Facility location: x j = 1 if build a facility in location j Vehicle routing: x

Questions?

[email protected]

Jim Luedtke (UW–Madison) Integer Programming December 4, 2018 23 / 23