Download RO: Exercices Mixed Integer Programming

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Halting problem wikipedia , lookup

Transcript
RO: Exercices Mixed Integer Programming
N. Brauner
Université Grenoble Alpes
Exercice 1 : Knapsack
A hiker wants to fill up his knapsack of capacity W = 6 maximizing the utility of the
objects he takes. The objects he might take are:
A
B
C
D
E
F
a picture
a bottle
another bottle
a pullover
chocolate bars
dried fruit
utility
12
7
3
4
5
8
weight
0.2
2
2
0.8
1
1
Question 1 – Describe a feasible solution for the hiker.
Question 2 – Formulate this problem as a MIP.
The general knapsack problem is defined by
• a set of objects N = {1, 2 . . . n},
• to each object is associated a utility ui and a weight wi ,
• a hiker has a knapsack of capacity W .
The objective is to determine which objects should be taken in order to maximize the
utility while not exceeding the capacity of the knapsack.
Question 3 – Formulate this general problem as a MIP.
Exercice 2 : Bin packing
When moving to Grenoble for her studies, a student wants to pack all her objects while
minimizing the number of bins of capacity W = 6 she has to use. The objects she wants
to take are:
size
size
A a book
2
E shoes
2
B another book
2
F plates
5
C a pullover
3
G glasses
6
D socks
1
Question 1 – Describe a feasible solution for this problem.
Question 2 – Formulate this problem as a MIP.
The general bin packing problem is defined by
• objects N = {1, 2 . . . n} of size {s1 , s2 . . . sn },
1
• to be packed in bins of capacity W .
The objective is to use as few bins as possible.
Question 3 – Formulate this general problem as a MIP.
Exercice 3 : Set covering
You want to choose participants for a project in order to have all the necessary skills while
minimizing the costs. You are given the following information.
Cost (h or =
C)
Operations research
Java
Database
Graph theory
User interface
Alice
10
1
1
0
1
0
Babar
4
1
0
1
0
1
Casimir
5
1
1
1
0
0
Donald
6
0
1
1
0
0
Elmer
7
0
0
0
1
1
Question 1 – Describe a feasible solution for this problem.
Question 2 – Formulate this problem as a MIP.
The general set covering problem is defined by
• matrix A = (aij )i=1..n,j=1..m with 0 or 1 coefficients,
• cj > 0, the cost of column j.
A column j covers a line i if aij = 1. The objective is to find a subset of columns of A of
minimum cost such that each line of A is covered at least once.
Question 3 – Formulate this general problem as a MIP.
Question 4 – Modify your MIP to model a partition problem.
Exercice 4 : Minimum cost flow
We want to transport material in a network. The numbers on the vertices correspond to
supply (+X) or to demand (−X). The numbers on the arcs are the unit transportation
costs.
B -4
4
6 AQ
3 Q
6 Q 2
Q
Q
Q
s
Q
3 D -4
1
Q
3
1QQ
Q
s Q
C2
Question 1 – Describe a feasible solution for the transport.
Question 2 – Formulate this problem as a MIP.
The objective is to determine the minimum cost of transportation of the material in the
network in order to satisfy the supply and the demand. We have the following data:
2
• an oriented network G(V, A): V is the set of n vertices and A is the set of arcs,
• cij : cost per unit of flow on arc (i, j) ∈ A,
• bi : the demand or the available stock at vertex i (integer).
We suppose that the network is balanced:
P
bi = 0.
Question 3 – Formulate this general problem as a MIP.
Exercice 5 : Shortest path
The objective is to find the shortest path between two vertices, s and t of a given network.
Question 1 – Formulate this problem as a MIP.
Exercice 6 : Coloring
The objective is to find the chromatic number χ(G) of a graph G.
Question 1 – Formulate this problem as a MIP.
Exercice 7 : “Au charbon!” (D. de Wolf)
Coals are mixed in a blast furnace where a reaction takes place to produce coke. Eight
possible types of coal are available. The coal enters the oven using 4 conveyors and exactly
4 types of coals are required in the mix. If a coal is in the mix, it must be at least 5%
of the overall mix. It is also required that the mix contains at most 1.8% of Silicon (Si).
Finally if coal C1 is in the mix then C3 must be there too. Similarly if coal C4 is used
then C6 must also be used. We want to find the mix of minimum cost. The question is
therefore to know the composition of one kilogram of mix. The following table shows the
prices and the proportion of Si.
Coal
Coal 1
Coal 2
Coal 3
Coal 4
price
12
14
17
10
proportion Si
2%
2,5 %
1%
5%
Coal
Coal 5
Coal 6
Coal 7
Coal 8
price
13
9
15
11
proportion Si
1%
5%
2%
1,5 %
Question 1 – Model the problem as a mixed integer linear program.
Exercice 8 : The newspaper
The chief editor has to prepare the outline of his newspaper which has 10 pages. He has
articles organized in several topics: international news, national news, local news, sports
and culture. He estimates that each page dedicated to a given topic is likely to interest
on average a certain number of readers.
The chief editor has to choose the topics to be treated together with its number of pages
so as to attract the maximum number of readers. If he chooses to include a certain topic,
he must give it a minimal number of pages corresponding to the most interesting articles.
The table below gives the ranges of pages together with the average number of readers
interested in each topic.
3
Topic
International
National
Local news
Sport
Culture
Min nb of pages
5
4
2
2
1
max nb of pages
9
7
5
4
3
potential readers (per page)
1500
2000
1000
1500
750
Question 1 – Model this problem as a MIP.
Exercice 9 : Power plants
A power supplier has a park of power stations. For simplicity, we consider that the park
includes only a nuclear plant (N), a hydroelectric plant (H) and a thermal plant (T).
The production costs of one MW in each of the plants are denoted by cN , cH and cT .
The daily production capacities are 1000 MW for the nuclear plant, 300 MW for the
hydroelectric plant and 500 MW for the thermal plant. The company wants to plan the
power production on a horizon of n days so as to meet the estimated daily demand of its
clients, dt (in MW), at minimum cost.
Question 1 – Formulate this problem as a MIP. Explain the meaning of the decision variables
together with their domains.
We now take into account some additional constraints on the power plants. For a good
turbine performance, if the hydroelectric plant works for one day, its production must be
at least 50 MW.
Question 2 – Add this constraint to your model.
The maximal capacity of the hydroelectric plant is 300 MW. A production higher than
200 MW is said to be at high regime. To limit the wear of the turbines, it is forbidden to:
• produce 2 consecutive days at high regime,
• have more than 6 days at high regime in the horizon.
We can introduce binary variables zt that reflect the fact that the plant is producing at
high regime.
Question 3 – How to modify your model so that zt is 1 if the production on day t is greater
than 200 MW?
Question 4 – Model these high regime constraints using the variables zt .
The nuclear plant actually operates with thresholds: it produces either 0 or 1 000 MW.
Launching the production has an important setup cost evaluated at CL euros. This cost
is paid on day t if:
• there was no production on day t − 1
• there is a production on day t
Question 5 – Model the launching cost. Initially the power plant is off. You can introduce
several binary variables that express whether the plant is working and if day t corresponds to
a launching day.
4
Exercice 10 : Several Optimums and convex hull
max z = 4x1 +
x2
s.t.
7x1 +
x2 ≤ 36
x1 + 4x2 ≤ 22
x1 , x 2
≥ 0
integers
Question 1 – Find graphically the fractional optimum, its integer rounding and the integer
optimum.
Question 2 – Describe the convex hull of the integer solutions of this program.
Exercice 11 : The integer optimum
min z = x1
s.t.
x1 − 17x2 = 3
x1 − 11x3 = 4
x1 − 6x4 = 5
x1 , x2 , x3 , x4 ≥ 0
integers
Question 1 – For this Integer linear program find the fractional optimum, its integer rounding
and the integer optimum.
Exercice 12 : Sac-à-dos
We consider the knapsack problem with the capacity W = 22 and the following objects
object
weight
utility
a
3
12
b
4
12
c
3
9
d
3
15
e
13
26
Question 1 – Find the optimal solution by hand.
Question 2 – Model this problem as an integer linear program.
Question 3 – Describe how to find a solution of the linear relaxation of this program by hand
(replace xi ∈ {0, 1} by 0 ≤ xi ≤ 1).
Question 4 – Explain why the solution found in the preceding question is an upper bound to
the optimal solution.
Question 5 – Describe the branching tree for this problem by solving the linear relaxation at
each vertex of the tree and by branching on the non-integer variable if it exists (putting 1 on
the left and 0 on the right).
In each vertex of the tree, indicate a lower and an upper bound.
Question 6 – With a depth first search, left child first, indicate the order in which the vertices
are visited and which vertices are never visited.
Question 7 – Same question with a depth-first search, right child first.
Question 8 – Same question with a depth-first search, child with the better lower bound first.
Question 9 – Same question with a depth-first search, child with the better upper bound first.
Question 10 – Same question with a breadth-first search, child with the smallest gap between
the lower and the upper bound first.
5
z = 14,47
x1 = 3,71
x2 = 2,35
x2 ≥ 3
x2 ≤ 2
z = 13,5
z = 14,4
x1 = 2,25
x1 = 4,2
x2 = 3
x2 = 2
x1 ≥ 3
x1 ≤ 2
Pas de
sol
réalisable
x2 ≥ 4
x1 ≥ 5
x1 ≤ 4
z = 13,33
z = 14,29
z = 14
x1 = 2
x1 = 5
x1 = 4
x2 = 3,11
x2 = 1,43
x2 = 2
x2 ≤ 3
x2 ≥ 2
x2 ≤ 1
z = 12
z = 13
z = 14,2
x1 = 0
x1 = 2
x1 = 5,6
x2 = 4
x2 = 3
x2 = 1
x1 ≤ 5
Pas de
sol
réalisable
x1 ≥ 6
z = 13
z = 14,14
x1 = 5
x1 = 6
x2 = 1
x2 = 0,71
x2 ≥ 1
x2 ≤ 0
z = 14
Pas de
sol
réalisable
6
x1 = 7
x2 = 0
OPL User Guide: modelling integer/boolean variables
OPL User Guide: using .dat files with OPL and the Caseine editor
7