Professional Documents
Culture Documents
Michel Bierlaire
Practice quiz
An investment fund is trying to determine how to invest its assets for the
following year, in order to maximize its profit. Currently, the fund has 2.5
million euros that it can invest in state bonds, real estate loans, car loans or
scholarship loans. The annual interest rates of the listed investment types
are 4% for state bonds, 6% for real estate loans, 8% for car loans and 9% for
scholarship loans.
To minimize risks, the investment fund allows only the selection of a
strategy satisfying the following restrictions:
• the amount invested in car and scholarship loans must not exceed twice
the amount invested in bonds;
• the amount invested in car loans must be larger or equal than the
amount invested in scholarship loans;
• the investment in car loans should not exceed the investment in real
estate loans by more than 70%.
3. the constraint(s).
Formulation – Modeling
Michel Bierlaire
Constraints The total amount to invest is 2.5 Me. This is modeled using
the following constraint:
xsb + xre + xcℓ + xsℓ = 2′ 500′ 000
xsℓ ≤ xcℓ .
• the investment in car loans (xcℓ ) should not exceed the investment
in real estate loans (xre ) by more than 70%:
xcℓ ≤ 1.7xre .
For your information, the optimal solution (rounded to 1/10 of euros) is:
Practice quiz
f : R2 → R : f (r, h).
πr2 h = 330.
r ≥ 0,
h ≥ 0.
subject to
πr2 h = 330,
r ≥ 0,
h ≥ 0.
Practice quiz
subject to
6x1 − x22 ≥ 1,
x21 + x22 = 3,
x1 ≥ 2,
x2 ∈ R.
Transformations
Michel Bierlaire
and
max f (x) = − min −f (x).
By applying statement (a) to our problem we obtain:
6x1 − x22 ≥ 1,
x21 + x22 = 3,
x1 ≥ 2,
x2 ∈ R.
subject to
6x1 − x22 ≥1
x21 + x22 ≤3
x21 + x22 ≥3
x1 ≥2
x2 ≥ 0.
g(x) ≤ 0 ⇐⇒ −g(x) ≥ 0.
−6x1 + x22 ≤ −1
x21 + x22 ≤3
−x21 − x22 ≤ −3
x1 ≥2
x2 ∈ R.
4. If a variable x can take any real value, it can be replaced by two non
negative artificial variables denoted by x+ and x− , such that
x = x+ − x− .
−6x1 + (x+ − 2
2 − x2 ) ≤ −1
x21 + (x+ − 2
2 − x2 ) ≤3
−x21 − (x+ − 2
2 − x2 ) ≤ −3
x1 ≥2
x+
2 ≥0
x−
2 ≥ 0.
x̂ ≥ 0.
subject to
−6(x̂1 + 2) + (x+ − 2
2 − x2 ) ≤ −1
(x̂1 + 2)2 + (x+ − 2
2 − x2 ) ≤3
−(x̂1 + 2)2 − (x+ − 2
2 − x2 ) ≤ −3
x̂1 ≥0
x+
2 ≥0
x−
2 ≥ 0.
Practice quiz
min | x1 − x2 |
subject to
x1 ≥ 0,
x2 ≥ 0.
Transformations
Michel Bierlaire
To solve this exercise, we remember that if a variable x can take any real
value, it can be replaced by two non negative artificial variables denoted by
x+ and x− , such that x = x+ − x− . We also recall that the absolute value of
x is defined as
x if x ≥ 0,
|x| =
−x if x < 0.
In our case, we have that
x1 − x2 if x1 ≥ x2 ,
|x1 − x2 | =
x2 − x1 if x1 < x2 .
Since x1 and x2 are non negative real numbers, the difference x1 − x2 can
take any real value.
Let us study the absolute value by examining the two cases:
• If x1 − x2 ≥ 0, we can define the non negative quantity
(
x1 − x2 , if x1 − x2 > 0,
y+ =
0, otherwise.
|x1 − x2 | = y + + y − .
Furthermore, if we impose that y + ≥ 0 and y − ≥ 0, we have that our
minimization problem can be written as
min (y + + y − )
x1 ,x2 ,y + ,y −
subject to
y+ ≥ x1 − x2 ,
y− ≥ x2 − x1 ,
x1 ≥ 0,
x2 ≥ 0,
y+ ≥ 0,
y− ≥ 0.
Note that this formulation is not strictly equivalent to the original one
for all feasible solutions. For instance, the feasible solution x1 = 0, x2 = 0,
y + = 1, y − = 1 has objective value 2 in the transformed problem, and 0 in
the original one.
But it is equivalent at the optimal solution. Denote the optimal solution
of the original problem (x∗1 , x∗2 ).
• If x∗1 − x∗2 > 0, the lowest possible value for y + , denoted by (y + )∗ , is
x∗1 −x∗2 (because of the constraint y + ≥ x1 −x2 ), and the lowest possible
value for y − , denoted by (y − )∗ , is 0 (because of the constraint y − ≥ 0).
Therefore, the objective function of the transformed problem at the
optimal solution is
(y + )∗ + (y − )∗ = x∗1 − x∗2 + 0 = |x∗1 − x∗2 |.
Practice quiz
Can a function have both a global and a local minimum? If so, provide
an example. If not, explain why.
Problem definition
Michel Bierlaire
f (x) = −2x2 + x4 − x3 .
6
f (x)
4
x
−3 −2 −1 1 2 3
−2
−4
We use the optimality conditions to identify the maxima and minima of the
function. The first derivative of f (x) is
x1 = 0, x2 = −0.693, x3 = 1.443.
This can also be verified using the second derivative of the function f (x):
Therefore, the function has no global maximum. Its global minimum is the
local minimum associated with the lowest value of f . We can conclude that
the function has
Practice quiz
1. f1 (x) = x2 .
2. f2 (x) = 1/|x|.
3. f3 (x) = 1/x.
For each function, provide its infimum on R, or show that it does not
exist. Provide also its minimum on R, or show that it does not exist.
Answer the same question if the decision variable is constrained as follows:
−1 ≤ x ≤ 2.
Problem definition
Michel Bierlaire
x
0
−3 −2 −1 0 1 2 3
The infimum of x2 on R is 0:
inf x2 = 0.
x∈R
When the constraints are introduced, the same arguments can be used to
reach the same conclusions: the infimum is 0, and x∗ = 0 is an optimum.
We now analyze the function f2 .
6
f2 (x) = 1/|x|
x
0
−2 0 2 4
f2 (x) = 1/x 2
−2
−4
−6
−4 −2 0 2 4
x
Practice quiz
·105
0
0 200
100
200
300 0
The set A = (x1 , x2 ) ∈ R2 |(x1 − 1)2 + (x2 − 2)2 ≤ 1 is a compact set:
6 x
2
2 A
x1
−4 −3 −2 −1 1 2 3
Weierstrass’s theorem guarantees that the given function has both a max-
imum and a minimum when optimized on the feasible set A.