Docstoc

IP - PowerPoint

Document Sample
IP - PowerPoint Powered By Docstoc
					Integer Programming

Ismael Regis de Farias JR.
        Tepper, CMU
              Summary
• Integer programming models
• Solving integer programs
• Efficient formulations
   Integer Programming Models
• Sometimes the activity levels of a decision
  variable must be integer, for example
  number of staff or airplanes
• Ignoring the integrality of the variables may
  result in a LP optimal solution with an
  objective function value much different
  from the IP optimal value
   Integer Programming Models
• Worse than that, it may not be obvious how to
  obtain an integer solution from the LP optimal
  solution
• In such situations, the integrality constraints must
  be considered
• In some important exceptional applications the
  integrality constraints can be ignored without any
  harm. For example, in the assignment,
  transportation, transshipment, and max-flow
  problems
  Integer Programming Models
• Remember that integer programming (as
  well as mixed-integer programming) is NP-
  hard, while linear programming is solvable
  in polynomial time (polytime)
• In practice mixed-integer programming is
  more challenging than pure integer
  programming
   Integer Programming Models
• An integer programming model is one in
  which the variables must satisfy integrality
  constraints
• If some of the variables in the model are
  integer while others are continuous, we
  have a mixed-integer programming model
   Integer Programming Models
• When the integer variables are restricted to be 0 or
  1, we have a 0-1 or binary integer programming
  problem (0-1 or binary MIP when there are
  continuous variables also)
• The majority of the integer programming models
  coming from real applications are 0-1 mixed-
  integer programs
• Less frequent, but still important, are models
  involving continuous, 0-1, and general integer
  variables, for example in telecommunications
  network design
   Integer Programming Models
• 0-1variables are generally used to represent
  logical or combinatorial constraints, yes or
  no, or to-do-or-not-to-do-that-is-the-
  question types of constraints
• Most applications involve continuous
  decision variables and combinatorial
  constraints, which can be modeled through
  the addition of 0-1 variables in the model
An assignment problem example
• 5 servers are available to execute 5 tasks
• Server 1 is capable of performing tasks A and B,
  server 2 can perform B and C, server 3 can
  perform C and D, server 4 can perform D and E,
  and server 5 can perform A and E
• A task must be performed precisely once by a
  single server
• What is the minimum number of servers that must
  be used to perform all tasks?
An assignment problem example
• We introduce the 0-1 variables
  –   x1 = 1 if server 1 is used, 0 otherwise
  –   x2 = 1 if server 2 is used, 0 otherwise
  –   x3 = 1 if server 3 is used, 0 otherwise
  –   x4 = 1 if server 4 is used, 0 otherwise
  –   x5 = 1 if server 5 is used, 0 otherwise
• We introduce one constraint for each task to
  guarantee that all tasks will be performed
                    IP model
minimize     x1 + x2 + x3 + x4 + x5
subject to
             x1 +                 x5 = 1
             x1 + x2                 =1
                   x2 + x3           =1
                        x3 + x4      =1
                             x4 + x5 = 1
                  x1, …, x5  {0, 1}
 LP relaxation and optimal solution

• LP relaxation: replace xi  {0,1} with xi  0
  and xi  1
• optimal solution of the LP relaxation:
  x1=x2=x3=x4=x5=½ with optimal value 2.5
• optimal solution of the IP: x1=x3=x4=1,
  x2=x5=0 with optimal value 3
          Lesson learned …
• It is not obvious how to derive an optimal or
  even a feasible solution to the MIP from the
  optimal solution of the LP relaxation
• However, the LP relaxation in general
  provides useful information towards solving
  the MIP
                MIP models
•   Knapsack
•   Fixed-charge
•   Set-packing, covering, and partitioning,
•   Multiple-choice
•   Semi-continuous
•   Traveling Salesman
•   Vehicle routing
                MIP models
•   Transportation and transshipment
•   Maximum flow and minimum cut
•   Shortest path
•   Chinese postman
•   Lot-sizing
•   Network design
                   Knapsack
• A company is considering 4 projects
• Project 1 will yield a net present value (NPV) of
  $16M, project 2 a NPV of $22M, project 3 a NPV
  of $12M, and project 4 a NPV of $8M
• Project 1 requires a cash outflow of $5M at
  present, project 2 requires $7M, project 3 requires
  $4M, and project 4 requires $3M
• The company has $15M available to invest in
  projects
• How should the company invest?
                 Knapsack
Decision variables
  • x1 = 1 if the company invests on project 1, and
    0 otherwise
  • x2 = 1 if the company invests on project 2, and
    0 otherwise
  • x3 = 1 if the company invests on project 3, and
    0 otherwise
  • x4 = 1 if the company invests on project 4, and
    0 otherwise
                 Knapsack

• The total NPV yielded in millions of dollars
  is 16x1+ 22x2+ 12x3+ 8x4
• The total investment made in millions of
  dollars is 5x1+ 7x2+ 4x3+ 3x4
               Knapsack
maximize 16x1+ 22x2+ 12x3+ 8x4
subject to
           5x1+ 7x2+ 4x3+ 3x4  15
             x1, …, x4  {0, 1}
               Knapsack
maximize c1x1+ + cnxn
subject to
           w1x1+ + wnxn  w
            x1, …, xn  {0, 1}
              Fixed charge
• Many times when an activity is undertaken,
  a cost independent of the activity level
  (fixed cost or fixed charge) is incurred
• Examples include money transfer, currency
  exchange, financial charges, and production
  setup costs
• A variable charge may also be incurred
              Fixed charge
• A textile manufacturer is capable of
  manufacturing shirts, shorts, and pants
• Each clothing type requires specific
  machinery with weekly costs of $1,500 for
  shirts, $1,200 for shorts, $1,600 for pants
• There are 2,000 hours of labor and 2,500 sq.
  yards of cloth available every week
• The goal is to maximize weekly profit
               Fixed charge
         Labor    Cloth      Sales   Variable
         hours    (sq. yard) price   cost
Shirts   2.0      3.0       $35      $20

Shorts   1.0      2.5       $20      $10

Pants    6.0      4.0       $45      $25
             Fixed charge
Decision variables:
• x1 = number of shirts manufactured during
  the week
• x2 = number of shorts manufactured during
  the week
• x3 = number of pants manufactured during
  the week
              Fixed charge
To model the fixed charges:
• y1 = 1 if we manufacture shirts, and 0
  otherwise
• y2 = 1 if we manufacture shorts, and 0
  otherwise
• y3 = 1 if we manufacture pants, and 0
  otherwise
                 Fixed charge
maximize 15x1+ 10x2+ 20x3  1500y1  1200y2
          1600y3
subject to
             2x1+ x2+ 6x3  2000
             3x1+ 2.5x2+ 4x3  2500
  0  x1  M y1 , 0  x2  M y2 , 0  x3  M y3 ,
             x1, x2, x3 integers
                y1, y2, y3  {0, 1}
                Fixed charge
• A company wants to determine how many
  warehouses should be opened and their locations
  to serve 4 new customers
• There are 3 potential sites with unlimited
  capacities and annual operating costs of $40,000,
  $20,000, and $60,000, respectively
• The annual customer demands are 200, 300, 150,
  and 250 units
• This problem is known as the facility location
  problem
               Fixed charge
        Cust. 1   Cust. 2   Cust. 3   Cust. 4

Wareh. 1 $40      $80       $90       $50

Wareh. 2 $70      $40       $60       $80

Wareh. 3 $80      $30       $50       $60
               Fixed charge
Decision variables:
• x11 = amount sent from warehouse 1 to customer 1
• x12 = amount sent from warehouse 1 to customer 2
• x13 = amount sent from warehouse 1 to customer 3
• x14 = amount sent from warehouse 1 to customer 4
                 Fixed charge
•   x21 = amount sent from warehouse 2 to customer 1
•   x22 = amount sent from warehouse 2 to customer 2
•   x23 = amount sent from warehouse 2 to customer 3
•   x24 = amount sent from warehouse 2 to customer 4
                 Fixed charge
•   x31 = amount sent from warehouse 3 to customer 1
•   x32 = amount sent from warehouse 3 to customer 2
•   x33 = amount sent from warehouse 3 to customer 3
•   x34 = amount sent from warehouse 3 to customer 4
              Fixed charge
To model the fixed charges:
• y1 = 1 if warehouse 1 is open, and 0
  otherwise
• y2 = 1 if warehouse 2 is open, and 0
  otherwise
• y3 = 1 if warehouse 3 is open, and 0
  otherwise
                  Fixed charge
minimize 40x11+ 80x12+ 90x13 + 50x14 + 70x21+ 40x22+ 60x23 +
  80x24 + 80x31+ 30x32+ 50x33 + 60x34 + 40,000y1 + 20,000y2+
  60,000y3
              x11+ x21+ x31 = 200
              x12+ x22+ x32 = 300
              x13+ x23+ x33 = 150
              x14+ x24+ x34 = 250
              x11+ x12+ x13 + x14  M y1
              x21+ x22+ x23 + x24  M y2
              x31+ x32+ x33 + x34  M y3
              x11, …, x34 0, y1, y2, y3  {0, 1}
              Set-covering
• The administration of a county wants to
  determine where to build fire stations to
  serve its 6 cities
• The county wants to build the minimum
  number of stations that will guarantee at
  least one fire station within 15 minutes
  drive to each city
              Set-covering
      City 1 City 2 City 3 City 4 City 5 City 6
City 1 0     10     20     30     30     20
City 2 10    0      25     35     20     10
City 3 20    25     0      15     30     20
City 4 30    35     15     0      15     25
City 5 30    20     30     15     0      14
City 6 20    10     20     25     14     0
               Set-covering
Decision variables:
• y1 = 1 if a fire station is open in city 1, and 0
  otherwise
• y2 = 1 if a fire station is open in city 2, and 0
  otherwise
• y3 = 1 if a fire station is open in city 3, and 0
  otherwise
               Set-covering
Decision variables:
• y4 = 1 if a fire station is open in city 4, and 0
  otherwise
• y5 = 1 if a fire station is open in city 5, and 0
  otherwise
• y6 = 1 if a fire station is open in city 6, and 0
  otherwise
              Set-covering
minimize   y1+ + y6
           y1+ y2  1
           y1+ y2 + y6  1
           y3 + y4  1
           y3 + y4 + y5  1
           y4 + y5 + y6  1
           y2 + y5 + y6  1
           y1, …, y6  {0, 1}
              Set-covering
minimize c1x1+ + cnxn
subject to
                 Ax1  1
             x1, …, xn  {0, 1},
where A is a matrix with entries equal to 0 or
1
               Set-packing
maximize c1x1+ + cnxn
subject to
                 Ax1  1
             x1, …, xn  {0, 1},
where A is a matrix with entries equal to 0 or
1
            Set-partitioning
minimize c1x1+ + cnxn
subject to
                 Ax1 = 1
             x1, …, xn  {0, 1},
where A is a matrix with entries equal to 0 or
1
     Multiple-choice constraints
• There are n processors available to perform m jobs
• The capacity of processor j is bj , the capacity
  required to execute job i by processor j is aij , and
  the cost is cij
• A job is performed exactly once and by a single
  processor
• The goal is to determine the cheapest assignment
  of jobs to processors
• This problem is known as the generalized
  assignment problem
     Multiple-choice constraints
Decision variables for 3 processors and 3 jobs:
• x11 = 1 if job 1 is performed by processor 1, and 0
  otherwise
• x12 = 1 if job 1 is performed by processor 2, and 0
  otherwise
• x13 = 1 if job 1 is performed by processor 3, and 0
  otherwise
     Multiple-choice constraints
• x21 = 1 if job 2 is performed by processor 1, and 0
  otherwise
• x22 = 1 if job 2 is performed by processor 2, and 0
  otherwise
• x23 = 1 if job 2 is performed by processor 3, and 0
  otherwise
     Multiple-choice constraints
• x31 = 1 if job 3 is performed by processor 1, and 0
  otherwise
• x32 = 1 if job 3 is performed by processor 2, and 0
  otherwise
• x33 = 1 if job 3 is performed by processor 3, and 0
  otherwise
     Multiple-choice constraints
minimize c11 x11+ + c33 x33
            a11 x11+ a21 x21+ a31 x31  b1
            a12 x12+ a22 x22+ a32 x32  b2
            a13 x13+ a23 x23+ a33 x33  b3
            x11+ x12+ x13 = 1
            x21+ x22+ x23 = 1
            x31+ x32+ x33 = 1
            x11, …, x33  {0, 1}
     Semi-continuous variables
• An auto maker manufactures 3 types of car:
  compact, midsize, and large
• A compact car requires 1.5 tons of steel, 30
  hours of labor, and yields a profit of $2,000
• A midsize car requires 3 tons of steel, 25
  hours of labor, and yields a profit of $3,000
• A large car requires 5 tons of steel, 40 hours
  of labor, and yields a profit of $4,000
     Semi-continuous variables
• There are 6,000 tons of steel and 60,000
  hours available
• To be economically feasible, at least 1,000
  units of a car type must be produced
• The goal is to determine the optimal
  production mix
    Semi-continuous variables
Decision variables:
• x1 = number of compact cars manufactured
• x2 = number of midsize cars manufactured
• x3 = number of large cars manufactured
     Semi-continuous variables
A variable x is semi-continuous if it is either 0
or greater than or equal to a specified constant
    Semi-continuous variables
0-1 variables to enforce the semi-continuous
constraint:
• y1 = 1 if a compact car is manufactured, 0
  otherwise
• y2 = 1 if a midsize car is manufactured, 0
  otherwise
• y3 = 1 if a large car is manufactured, 0
  otherwise
    Semi-continuous variables
maximize 2,000 x1+ 3,000 x2 + 4,000 x3
         1.5 x1+ 3 x2+ 5 x3  6,000
         30 x1+ 25 x2+ 40 x3  60,000
         x1  1,000 y1 , x1  M y1
         x2  1,000 y2 , x2  M y2
         x3  1,000 y3 , x3  M y3
         y1, y2, y3  {0, 1}
 Traveling salesman problem (TSP)
• A salesman must leave his hometown, visit
  several cities, and then return home
• It is possible to travel directly from any city
  to any other city
• The cost to travel between any two cities is
  known
• The problem consists in determining the
  cheapest travel sequence
 Traveling salesman problem (TSP)
• A manufacturer of printed circuit boards uses
  programmable drill machines to drill 6 holes in
  each board
• The x and y coordinates of the holes are (1,2),
  (3,1), (5,3), (7,2), and (8,3)
• The time it takes for the machine to move from
  one hole to another is equal to their distance
• What drilling order minimizes the total time spent
  in a single board?
Traveling salesman problem (TSP)
Traveling salesman problem (TSP)
Traveling salesman problem (TSP)
 Traveling salesman problem (TSP)

• Optional homework exercise: Model the
  TSP example as a 0-1 integer programming
  problem
• Hint: you have to consider the following
  constraints
  – The salesman enters and leaves each city,
    including home exactly once
  – There cannot be any subtours
Traveling salesman problem (TSP)




                Two subtours
 Vehicle routing problem (VRP)
• A warehouse must make deliveries to
  several clients
• To make the deliveries the warehouse use
  its fleet of trucks, which we will assume to
  be identical
• The weight of each delivery and the
  capacity of the trucks are known
 Vehicle routing problem (VRP)
• It is possible to travel between any two
  points (customers and warehouse)
• Each truck used must leave from the
  warehouse and return to the warehouse
  upon finishing all deliveries
 Vehicle routing problem (VRP)
• Assume that each truck will travel a single
  route
• The goal is to make all deliveries using the
  smallest possible number of trucks
• VRP is a generalization of TSP
• VRP can be modeled as a 0-1 integer
  programming problem
Vehicle routing problem (VRP)
                                      40
     30        40




                    Truck capacities: 100



                                            30
30        30
Vehicle routing problem (VRP)
                       40
     30        40




                            30
30        30
Vehicle routing problem (VRP)
                       40
     30        40




                            30
30        30
 Vehicle routing problem (VRP)
• With today solvers’ state-of-the-art, VRP is
  a very difficult problem to solve to proven
  optimality
• An application of VRP is to schedule slabs
  for rolling in a steel mill
       Transportation problem
• An electricity company has 3 power plants
  that supply energy to 4 cities
• The supplies at the plants are 35 Gwh, 50
  Gwh, and 40 Gwh
• The demands of the cities are 45 Gwh, 20
  Gwh, 30 Gwh, and 30 Gwh
• The electricity is contracted in integer units
  of Gwh’s
          Transportation problem
           City 1   City 2   City 3   City 4

Plant 1    $8       $6       $10      $9

Plant 2    $9       $12      $13      $7

Plant 3    $14      $9       $16      $5
          Transportation problem
           City 1   City 2   City 3   City 4

Plant 1    25 Gwh   18 Gwh   30 Gwh   35 Gwh

Plant 2    45 Gwh   28 Gwh   30 Gwh   30 Gwh

Plant 3    40 Gwh   22 Gwh   30 Gwh   30 Gwh
          Transportation problem
min.
     8x11+6x12+10x13+9x14+9x21+12x22+13x23+7x24+14x31+9x32+16x33+5x34
s.t.                x11+x12+x13+x14  35
                    x21+x22+x23+x24  50
                    x31+x32+x33+x34  40
                    x11+x21+x31  45
                    x12+x22+x32  20
                    x13+x23+x33  30
                    x14+x24+x34  30
          25  x11  0, 18  x12  0, 30  x13  0, 35  x14  0,
          45  x21  0, 28  x22  0, 30  x23  0, 30  x24  0,
          40  x11  0, 22  x12  0, 30  x13  0, 30  x14  0
                    x11 , …, x34 are integers
       Transportation problem
In the transportation problem, the integrality
restriction can be ignored, and the problem can be
solved as an LP, as long as the RHS of the
constraints are integers. As a matter of fact, the
transportation problem can be solved very fast by
other polytime algorithms. The polytime character of
the transportation problem can be lost with
additional constraints.
         Networks (or graphs)
Consist of two disjoint entities:
  • Nodes or vertices
  • Arcs or edges (connect nodes)
        Networks (or graphs)
• In the transportation network there are two
  types of nodes: supply and demand (or
  source and sink)
• A problem more general than the
  transportation problem is the network flow
  problem, also called transshipment or
  minimum cost network flow, where there
  are transshipment nodes
 Maximum flow through a network
• Consists of a network with a single source
  and a single sink and arc capacities
• The goal is to send as much flow from the
  source to the sink as it is possible
• The maximum flow problem is polytime,
  and can be solved by an LP model (IP with
  integrality discarded) or other fast
  algorithms
 Maximum flow through a network

• A flight from San Francisco to New York
  has been cancelled
• The airline company wants to re-route as
  many passengers as possible
 Maximum flow through a network
From            To         # of seats
San Francisco   Denver     5
San Francisco   Houston    6
Denver          Atlanta    4
Denver          Chicago    2
Houston         Atlanta    5
Atlanta         New York   7
Chicago         New York   4
 Maximum flow through a network

                             C
                 2
         D                       4

     5           4
                                     NY
SF                       7
         6   H       A
                 5
                Shortest path
• Given a network, arc costs, a starting point (source
  node), and a finishing point (sink node), the
  shortest path problem consists of finding the
  shortest path in the network connecting source and
  sink
• It is a polytime problem that can be solved by
  Dijkstra’s algorithm, or a streamlined algorithm
  for minimum cost network or a streamlined
  version of the Simplex algorithm
             Shortest path
• The power sent from a plant to a city must
  pass through relay substations
• Because the power loss is proportional to
  the distance traveled, the company wants to
  minimize the distance traveled by the power
    Shortest path


           3
4                   2

               2

3         3
                        2
             Shortest path
• A machine has been purchased for $12,000
• The maintenance cost of the machine over a
  year depends on the age of the machine at
  the beginning of the year
• To avoid the high maintenance cost of an
  older machine, the machine may be traded
  towards the purchase of a new one
              Shortest path
• The trade-in price of the machine depends
  on its age
• The goal is to minimize the net cost during
  the next 5 years
              Shortest path
Machine age    Trade-in price   Maint. cost
1              $7,000           $2,000
2              $6,000           $4,000
3              $2,000           $5,000
4              $1,000           $9,000
5              $0               $12,000
              Assignment
• There are two distinct groups with the same
  number of members
• There is a cost in assigning a member of
  one group to a member of another group
• The goal is to find the cheapest 1-to-1
  assignment of members of one group to the
  members of the other group
• The assignment problem is polytime
     Chinese postman problem
• A postman must visit every street of a
  neighborhood at least once
• The goal is to walk the streets the least
  possible number of times
• Applications include garbage collection and
  routing snow pliers
• The Chinese Postman problem is polytime
Chinese postman problem
Chinese postman problem
                 Solving MIPs
• Smart enumeration scheme based on linear
  programming relaxation
• The enumeration is done through a tree structure
• LP relaxation:
   – If infeasible, then there is no need to continue the
     enumeration from the current node (fathom or prune the
     node)
   – If integer, same
   – If the optimal value is not better than the best known
     solution so far, same
            Branch-and-bound
• Smart enumeration scheme based on linear
  programming relaxation
• The enumeration is done through a tree structure
• LP relaxation:
   – If infeasible, then there is no need to continue the
     enumeration from the current node (fathom or prune the
     node)
   – If integer, same
   – If the optimal value is not better than the best known
     solution so far, same
 Branch-and-bound
                    1
          y1=0            y1=1
      2          z=57.8      3
    z=59.5                 z=65.3

0-1 MIP with minimization objective
     Branch-and-bound
                           1
              y1=0             y1=1
          2          z=57.8       3

y2=0                 y2=1       z=65.3
        z=59.5
 4                     5
 z=64     infeasible
             Branch-and-bound
                               1
                  y1 ≤ 3           y1  4
                  2
                            32.5          3
                  39.5                  41.3




General integer MIP. The value of y1 in the LP relaxation is 3.2
   Optional homework exercise
Use Branch-and-Bound to solve the following
IP:
maximize 8 x1+ 5 x2
s.t.      x1+ x2  6
          9 x1+ 5 x2 45
          x1 , x2  0
          x1 and x2 integers
          Branch-and-bound
The size of the enumeration tree depends on:
• Branching strategy
  · Node selection
  · Variable selection
• Primal heuristic
• Pre-processing
• Strength of the relaxation
          Branch-and-bound
• Primal heuristic: simple heuristic run at
  some or all nodes of the enumeration tree in
  an attempt to find an integer solution
• Pre-processing: simple and fast operations
  to simplify the problem
• Strength of the relaxation: can be improved
  with the addition of new constraints (cuts)
    Example of primal heuristic
• Suppose all constraints are ≤
• Suppose that not all variables in the optimal
  solution of the LP relaxation are integer
• Round down any non-integer variable
      Example of pre-processing
• Suppose that
  –   5 x1+ 3 x2+ x3  26 (1)
  –   x1  2
  –   x2  3
  –   x2  3
  are some of the constraints.
• Then Constraint (1) can be dropped from
  the formulation
   Strength of the LP relaxation
• By introducing additional inequalities that
  decrease the size of the feasible set of the
  LP relaxation it is usually possible to obtain
  better bounds
• With better bounds, it is usually possible to
  reduce the size of the enumeration tree
  considerably
   Strength of the LP relaxation
• The additional inequalities are called cuts
• Examples of cuts are cover inequalities,
  Gomory cuts, disjunctive cuts
    x2   Weaker LP relaxation
          B
   A            C

                      D


  O                           x1
                      E
O, A, and E are the feasible points
    x2   Stronger LP relaxation
          B
   A            C

                      D


  O                           x1
                      E
O, A, and E are the feasible points
            Branch-and-cut
• Implementation of the branch-and-bound
  algorithm in which one introduces cuts at
  some or all nodes of the branch-and-bound
  tree
• Within a node, after introducing a round of
  cuts, the new LP relaxation is re-solved, and
  the operation is repeated a few times or
  until no additional cut can be found
          Branch-and-price
Combination of column generation and
enumeration to solve huge IPs
          Efficient modeling
Since branch-and-bound is the main tool to
solve MIPs, the best models are the ones that
give the best bounds
          Efficient modeling
• Branch-and-bound without binary variables
  – Eliminate the binary variables
  – Branch on the structural variables
• For example, let x  {0}  [1,). The
  formulation with 0-1 variables is x ≤ M y,
  y  {0,1}. It is possible to not introduce y
  and branch on x as follows.
       1
x= 0       x 1
2             3

				
DOCUMENT INFO
Shared By:
Categories:
Tags:
Stats:
views:21
posted:8/5/2011
language:English
pages:106