You are on page 1of 14

Notes

Slides adopted from Prof. Gesualdo Scutari (SP 2016)

Lessons 3 & 4: Graphical solution method for


two-variable optimization problems
IE 335: Operations Research - Optimization

Instructor: Professor Chris Quinn

August 25, 2016

Notes

Announcements

Midterm 1: Tuesday Oct. 18 from 6:30-7:30pm in CL50 rm 224


I have a list of students with conflicts, and will send an email out to set up
a make-up. The make-up will be earlier on that Tuesday.

Notes

Review
Steps to building an optimization problem
1

Determine the decision variables.

Write the objective function (and goal) in terms of the decision


variables.

Write the constraints in terms of the decision variables:


I
I

Main constraints
Variable-type constraints

An optimization problem looks like this:


minimize or maximize
subject to

(objective function)
(main constraints)
(variable-type constraints)

A bit of terminology: feasible set, feasible point, etc.


3

Notes

Recall Anteater-Bugss Optimization Problem

maximize
subject to

1W + 2L

(total profit)

10W + 3L 1000

(malt capacity)

20W + 12L 2000

(hops capacity)

3W + 3L 1500

(labor capacity)

W 0,

L0
W integer

(nonnegativity)
(integrality)

L integer

Notes

Today...
Graphical solution method for two-variable optimization models
I

Gives helpful intuition on properties and solution methods for


optimization models

For two-variable cases, with x1 and x2 , we need the third


dimension to plot function values f (x1 , x2 ). This can be
challenging to plot well. An alternative is to depict value using
contours, like those depicting altitude on maps.

Notes

Warm up: linear contours


Draw the following equations on the xy-plane:
2x + 5y = 0
2x + 5y = 6
2x + 5y = 8
Without drawing anything, where are the following equations located
on the xy-plane with respect to the equations you drew above?
2x + 5y = 18
2x + 5y = 23
What are we doing when we draw the equations? We are marking
the set of all points that satisfy the equation. (thinking of drawings
this way will be important for us later on.)
6

Notes

Warm up: linear contours


y

2x + 5y = 0
2x + 5y = 6
2x + 5y = 8

2x

+5

y=
18
x

2x
+
2x
+

2x + 5y = 18
2x + 5y = 23

2x
+

2x
+

5y
5y

5y

5y

=6
=0

=
8

=
23
7

Notes

Lines in R2
The equation
a1 x1 + a2 x2 = c
defines a line in R2 (the set of points satisfying the equation)


H , (x1 , x2 ) R2 : a1 x1 + a2 x2 = c .

Note: A linear function is a different mathematical object than a line.


A linear function is a mapping from one domain/set to another (such
as f (x) : R R). A line is a set of points satisfying a linear
equation. The two are relatable (given a linear function, we can
define a line and vice versa), but be aware of the difference.

Notes

Level set (or contour curve) of a function in R2

Given a function of two variables z = f (x, y) plotted in 3D, the


cross-section between the surface f (x, y) and the horizontal (flat)
xy-plane is called a level set or a contour curve.
Thus, contour curves have algebraic equations of the form
f (x, y) = k for all possible values of k.
A contour diagram or map of a function f (x, y) is a 2-dimensional
graph showing several level curves in the xy-plane corresponding to
several values of k.

Notes

Level set (or contour line) of a function in R2


Example 1: Draw the contour plot of z = f (x, y) =

p
x2 + y 2

10

Notes

Level set (or contour line) of a function in R2

Example 2: Draw the contour plot of z = f (x, y) = 2x + 3y + 6

11

Notes

Level set (or contour line) of a function in R2

Example 3: Draw the contour plot of z = f (x, y) = x2 + y 2

12

Notes

Solving two-variable optimization problems graphically


Main steps

Draw the feasible set.

Avoid drawing a third dimension. Draw contour lines of the objective


function (on the plane of the feasible set).

Determine the optimal solution graphically. Optimal solutions are


points lying on the best objective function contour that intersects the
feasible region.

13

Notes

Drawing the feasible set: hyperplanes and halfspaces in R2


The equation
a1 x1 + a2 x2 = c
defines a line in R2


H , (x1 , x2 ) R2 : a1 x1 + a2 x2 = c
dividing R2 in two half-planes:


H+ , (x1 , x2 ) R2 : a1 x1 + a2 x2 c
and


H , (x1 , x2 ) R2 : a1 x1 + a2 x2 c

14

Notes

Drawing the feasible set: hyperplanes and halfspaces in R2

How to identify the right half-plane?


1 Draw H
2 Pick a point x
= (
x1 , x
2 ) R (e.g., x
= (0, 0))
3 If a x
2 c x
H+
1 1 + a2 x
otherwise x
H
15

Notes

Drawing feasible regions (in 2D)


(3

(1

2x1 + 3x2 10

(1)

x1 + 3x2 8

(2)

x1 + x2 5

(3)

(4)

x2 3

(5)

(6)

x2 0

(7)

x1

(4)
5

Feasible region:

x1

x2

(2)

4
(5)
3

x1

16

Notes

Drawing contour lines of the objective function


Optimal solution: (2,2)
max

(1

2x1 + 3x2 10
(1)

(2)

x1 + 3x2 8 (2)
x1 + x2 5 (3)

(4)

x2

(3

s.t.

3x1 + 5x2

(5)
3

4 (4)

x1

x2 3 (5)

0 (6)

x1

x2 0 (7)

x1

3x1 + 5x2 = 16

3x1 + 5x2 = 14

3x1 + 5x2 = 12

3x1 + 5x2 = 10

3x1 + 5x2 = 8

3x1 + 5x2 = 6

3x1 + 5x2 = 4

3x1 + 5x2 = 2

3x1 + 5x2 = 0

17

Notes

What happens if...


Multiple optimal solutions
(1

x2

2x1 + 3x2 10
(1)
x1 + 3x2 8 (2)
x1 + x2 5 (3)
x1

(5)
3

4 (4)
x2 3 (5)

x1

(2)

(4)

s.t.

2x1 + 3x2

(3

max

0 (6)
x2 0 (7)

x1

5
2x1 + 3x2 = 10

2x1 + 3x2 = 8

2x1 + 3x2 = 6

2x1 + 3x2 = 4

2x1 + 3x2 = 2

2x1 + 3x2 = 0

18

Notes

Unique and multiple optimal solutions


An optimization problem may have
I

a unique optimal solution, or

multiple optimal solutions


(alternative optimal solutions)

All optimal solutions must have the same optimal value.


Graphically in 2D:
I

Unique optimal solution: the optimal objective function contour


intersects feasible set at exactly one point.

Multiple optimal solutions: optimal objective function contour


intersects feasible set at more than one point.

19

Notes

What happens if...


(3

x2
(4)

No feasible solutions!
5

Feasible region:
(1

2x1 + 3x2 10

(1)

x1 + 3x2 8

(2)

x1 + x2 5

(3)

(4)

x2 3

(5)

(6)

x2 0

(7)

x1
x1

(2)

3
(5)
2

x1

20

Notes

Infeasible problems

An optimization problem is infeasible if its feasible set is empty (i.e.,


no choice of decision variables satisfies all constraints).
Graphically, in 2D, a model is infeasible if no point falls within
feasible region for all constraints.

21

Notes

What about this case?

s.t.

3x1 + x2
x1 + x2 1

(1)

(2)

(1
)

x2
max

x1 2x2 4 (2)
x1

(3)

x2 0

(4)

2
1

x1

3x1 + x2 = 18

3x1 + x2 = 16

3x1 + x2 = 14

3x1 + x2 = 12

3x1 + x2 = 10

3x1 + x2 = 8

3x1 + x2 = 6

3x1 + x2 = 4

3x1 + x2 = 2

The problem is
unbounded from
above.

3x1 + x2 = 0

The contour lines grow


to infinity!

22

Notes

Unbounded problems

An optimization problem is unbounded when feasible choices of


values for the decision variables can produce arbitrarily good objective
function values.
Graphically, in 2D, unbounded problems have points in the feasible
region lying on ever-better objective function contours.
Even though we can do arbitrarily well, there is no optimal solution by
definition of optimality (since for any value we can do better).
Unbounded problems are not realistic. If you formulate an unbounded
problem, most likely you forgot a constraint.

23

Notes

What happens if we change the objective function?

s.t. x1 + x2 1

(1)

(2)

(1
)

x2
max 3x1 x2
3

x1 2x2 4 (2)
x1

(3)

x2 0

(4)

2
1

x1

3x1 x2 = 18

3x1 x2 = 16

3x1 x2 = 14

3x1 x2 = 12

3x1 x2 = 10

3x1 x2 = 8

3x1 x2 = 6

3x1 x2 = 4

3x1 x2 = 2

The problem has a


unique optimal solution.

3x1 x2 = 0

The contour lines grow


to zero.

24

Notes

Outcomes of optimization problems

An optimization model can:


I

have a unique optimal solution, or

have multiple optimal solutions, or

be infeasible, or

be unbounded

25

Notes

Graphical solution of nonlinear optimization problems


Your turn

min

(x1 2)2 + (x2 1)2

s.t.

x1 0
x2 0
x21

x2 1 0

x1 R, x2 R
Plot the feasible set.
Recall that x21 x2 1 = 0 is a parabola in the (x1 , x2 ) plane.
Plot the contour curves of the objective functions.
Recall that (x1 2)2 + (x2 1)2 = k 2 is a circle in the (x1 , x2 )
plane, centered in (2,1) and having radius equal to k.
The optimal solution is at the intersection between the smallest
contour curve and the feasible set.
26

Notes

Your Turn ...


Consider the following optimization
problem. Note that c1 and c2 are
unspecified.
[A]

min c1 x1 + c2 x2

x1 + x2 1

(1)

2x1 + x2 9

(2)

x1 x2 1

(3)

x2 3

(4)

(4)

(3

d
f

(1

x2

(2)

s.t.

Feasible region of [A]:

x1

x1 0, x2 0
Suppose [A] has a unique optimal solution. Which points could it be,
if any?

Suppose e is an optimal solution to [A]. Which other points must also


be optimal, if any?

Suppose f and h are both optimal solutions to [A]. Which other


points must also be optimal, if any?

27

Notes

Next time...

Classification of optimization models


Local and global optima

28

You might also like