You are on page 1of 8

2 Lecture 2

Modeling
Given a practical problem, the very first task is to express it as an mpp. This is called modeling.

To model a problem.
a) Identify the variables.
b) Write the objective function.
c) Write the constraints.

[2.1] Example (A linear model) Doctors advice me to take a minimum of 10mg of vitamin A, 10mg of
vitamin B and 18mg of vitamin C, daily. There are two type of pills available in the market.
pill A content B content C content cost
red 4 2 2 1
blue 2 4 18 2
What amount (real number) of pills do I take to meet the requirements while minimizing the cost?

Answer. To model this, suppose that we take r red pills and b blue pills every day. This costs r + 2b and
gives 4r + 2b mg of vitamin A, 2r + 4b mg of vitamin B, and 2r + 18b mg of vitamin C.

Thus our problem is min r + 2b It is an lpp.


s.t. 4r + 2b ≥ 10, 2r + 4b ≥ 10
2r + 18b ≥ 18, r ≥ 0, b ≥ 0.

[2.2] Example (A nonlinear model) A gambler has Rs. 2000 to play. There are 3 places for stake. There
are 3 outcomes. Depending on the outcome the return per unit is shown in the table. In what way the gambler
Outcomes Place 1 Place 2 Place 3
1 -5 1 1
should play in order to maximize the minimum return?
2 -7 6 10
3 13 -2 -6

7
Answer. To model it, let xi be the amount (real number) to be invested in place i. Then the problem is

max z = min{−5x1 + x2 + x3 , −7x1 + 6x2 + 10x3 , 13x1 − 2x2 − 6x3 }


s.t. x1 + x2 + x3 = 2000, x1 , x2 , x3 ≥ 0.

This is a nlpp as the objective function is not linear (how?). This can be converted into an lpp by bringing
the objective function into the constraints.

max z
z ≤ −5x1 + x2 + x3 , z ≤ −7x1 + 6x2 + 10x3 , z ≤ 13x1 − 2x2 − 6x3 ,
s.t.
x1 + x2 + x3 = 24000, x1 , x2 , x3 ≥ 0, z ∈ R.

Notice that for the nlpp, T ⊆ R3 , however for the lpp, T ⊆ R4 .

[2.3] Example We want to find out the maximum area of a rectangle in the closed unit disc. Formulate the
problem.

8
Some exercises
[2.4] Exercise(M) A shop supplies card boards of length 1 meter and of any ordered width between 1cm
and 1m (in multiples of 1cm). It has a machine which produces square card boards of side 1 meter. The
shopkeeper has to cut the card boards to meet the demand. On a particular day the shop receives an order of
30 boards of width 65cm, 50 boards of width 55cm and 70 boards of width 22cm. The shopkeeper is interested
in using minimum possible square boards to reduce the production cost.

1. Formulate the problem.


2. A piece of card board which is cut but is not supplied for the order is a waste. Formulate the problem
if the shopkeeper wants to minimize the waste.
3. Will these two give different solutions?

[2.5] Exercise(E) Country A has P pi ships P


at ith port, i = 1, . . . , n and country B requires qj ships at jth
port, j = 1, . . . , m. It is given that pi = qj . It takes dij number of days for a ship from ith port in A
reach the jth port in B. The ships are to be moved so that the total number of days is minimum. Formulate
the problem.

[2.6] Exercise(H) (Optimal location) There are m shops in a city (a map in R2 ). Suppose that the roads
in the city are such that any two roads are either parallel or perpendicular. You want to build a supply center
in a place so that the maximum distance of a shop from the center is minimum. Formulate this problem.
This is easy. It is challenging to simplify the problem.

[2.7] Exercise(M) There are 5 jobs and 5 persons. We have to pay a price cij (positive number) to make
the ith person do the jth job.

1. We want to get all our jobs done with minimum price. Model it.
2. We want to get all our jobs done with minimum price such that each person gets only one job. Model
it.
3. Our boss will be happy even if we get 3 jobs done. So we want to get three of our jobs done with
minimum price. Model it.
4. There are 5 jobs and 5 persons. We have to pay a price cij to make the ith person do the jth job. Our
boss will be happy even if we get 3 jobs done. So we want to get three of our jobs done with minimum
price such that no persons gets more than on job. Model it.

[2.8] Exercise(M) Suppose that n machines are available and each machine can do any of the two types
of jobs in unit time. If x machines are used to do the ith (i = 1, 2) job, goods worth gi (x) can be produced.
The machines are subject to attrition so that after doing the ith job only ai (x) machines become useless. The
process gets repeated with the remaining machines and it is required to maximize the total worth of goods
produced in N unit time. Formulate the problem.

9
Graphical method
We can solve some problems that involve only two (or three) variables in this method. (Sometimes, we
can also solve specific problems of higher dimensions.) The method is relatively unimportant, if we want to
develop an algorithm so that the computer can deal with it. However, the method is illustrative in nature
and it adds to understanding of the subject. It is described below.

Graphical method to minimize f (x) over a feasible region T .


a) Plot the feasible region T .
b) Draw the graph of f (x) = k.
c) Observe the minimum value of k for which both graphs overlap.
d) Justify.

[2.9] Example Solve using graphical method max x1 + x2


s.t. x21 + x22 = 1, x ≥ 0.

Answer. Feasible region is the part of the unit


circle in the first quadrant. Graph of
f (x) = k is the straight line x + y√= ( √12 , √12 )
k. The maximum value of k is 2
attained at ( √12 , √12 ).

Argument: For large positive k the line x1 + x2 = k lies out side the circle and as we decrease k the line
comes closer to the circle. So for the maximum value k = k0 , the line x1 + x2 = k will touch the circle. As
the slope of the line is −1, the normal (which is the radius) must have slope 1. That is, the equation of the
normal is x1 = x2 . As x ≥ 0, we see that the point is ( √12 , √12 ).

Alternate argument: If (x1 , x2 ) is any point on the circle, then (|x1 |, |x2 |) is also a point on the circle. So
the maximum
p value of x1 + x2 will occur at a point in the arc of the circle lying in√the first quadrant. There
x2 = 1 − x21 and 1 ≥ x1 ≥ 0. So the problem reduces to maximize g(x) = x h+ 1 − x2 where 0i ≤ x ≤ 1.
√ x √1 x2 √ 1
We have g′ (x) = 1 − 1−x2
, so x = 2
is a critical point. Further g′′ (x) = − (1−x2 )3/2
+ 1−x2
, which is

10
negative at x = √1 .
2

[2.10] Example Use graphical method to maximize x1 +2x2 +3x3 +4x4 on the unit sphere x21 +x22 +x23 +x24 = 1.

Answer. Wait till we discuss about hyperplanes.

Some exercises
[2.11] Exercise(E) Solve min x1 + x2 by graphical method.
s.t. x1 ≤ 1, x2 ≤ 1, xi ≥ 0

[2.12] Exercise(E) Solve using graphical method: max x1 x2


s.t. x1 + x2 = 5, x ≥ 0.

(0, 1)

(0, .45) (.5, .5)

[2.13] Exercise(E) Find the maximum value of xy on the shaded


region in the figure. (.2, 0)
(0, 0) (1, 0)
[2.14] Exercise(E) Solve by graphical method: max x1 + 2x2
s.t. x21 + 2x22 = 2, xi ≥ 0.

[2.15] Exercise(E) Solve by graphical method: opt x2 + y


s.t. x2 + y 2 = 1.

Conversion of lpp to slpp


We need a standard form, as we want to use the computer. The idea is to develop an algorithm so that
the computer can solve the problem in the standard form. Problems in other forms can be converted to the
standard form. Different texts adopt different definitions of a standard form of an lpp. For us, a standard
lpp is of the form
(slpp) min z = ct x
s.t. Ax = b, x ≥ 0, b ≥ 0.
We can convert an lpp it to a slpp using the following techniques. But before that we need to recall a fact.

[2.16] Fact Let f : S → R be a function. Then there exists to nonnegative functions g, h : S → R+ := [0, ∞)
such that f = g − h. That is, every real valued function on S is the difference of two nonnegative functions.

11
[2.17] Converting lpp to slpp.

a) Convert a constraint of the form ai1 x1 + · · · + ain xn ≤ bi to ai1 x1 + · · · + ain xn + si = bi with a nonnegative
variable si . Such variables are called slack variables.
b) Convert a constraint of the form ai1 x1 + · · · + ain xn ≥ bi to ai1 x1 + · · · + ain xn − si = bi with a nonnegative
variable si . Such variables are called surplus variables.
c) If bi ≤ 0, then multiply the corresponding constraint by −1.
d) If a variable xi is unrestricted then replace it by xi1 − xi2 , in the whole problem, where xi1 and xi2 are
two new nonnegative variables.
e) If a variable xi is nonpositive replace it with −yi , where yi ≥ 0, in the whole problem.
f) If xi ≥ k replace it with yi + k, where yi ≥ 0, in the whole problem.
g) Maximize f (x) can be converted to minimize −f (x) as max f (x) = − min −f (x).
x∈T x∈T

[2.18] Example Write the slpp for the lpp: max x1 + 2x2
s.t. −x1 + 2x2 ≥ −4, x1 + x2 = 2, x1 ≥ 2, x2 ∈ R.

Answer. First, convert to minimization problem and then replace x2 by x21 − x22 .

min −x1 − 2x21 + 2x22


s.t. −x1 + 2x21 − 2x22 ≥ −4, x1 + x21 − x22 = 2, x1 ≥ 2, x21 , x22 ≥ 0.

Then replace the first inequation by an equation using a surplus variable.

min −x1 − 2x21 + 2x22


s.t. −x1 + 2x21 − 2x22 − s1 = −4, x1 + x21 − x22 = 2, x1 ≥ 2, x21 , x22 , s1 ≥ 0.

Next write x1 = x′1 + 2 as x1 ≥ 2.

min −x′1 − 2x21 + 2x22 − 2


s.t. −x′1 + 2x21 − 2x22 − s1 = −2, x′1 + x21 − x22 = 0, x′1 , x21 , x22 , s1 ≥ 0.

Next, make the constant in all the equations nonnegative.

slpp: min −x′1 − 2x21 + 2x22 − 2


s.t. x′1 − 2x21 + 2x22 + s1 = 2, x′1 + x21 − x22 = 0, x′1 , x21 , x22 , s1 ≥ 0.

12
[2.19] Matrix form When the variables and the constants are nonnegative, the conversion looks like

 x
" #
t
 t
min c x 7→ min c 0 0 y (1)
z
Am×n x = b1
A 0 0 x b1
" #" # " #
Bk×n x ≤ b2 B Ik 0 y = b2
s.t.
Cr×n x ≥ b3 s.t. C 0 −I z b3
r
x ≥ 0, bi ≥ 0 x, y, z ≥ 0, bi ≥ 0.

We shall refer to the form on the rhs as the matrix form. Notice that one feasible set is in Rn whereas the
other is in Rn+k+r . Does a minimum solution of the rhs give us a minimum solution of the lhs? Yes. Are we
creating a larger set by this conversion? No. Both the sets are in bijection, as shown below.

[2.20] Theorem In (1), let T and T ′ be the feasible sets for the lpp and slpp, respectively. Define f : T → T ′
as f (x) = (x, b2 − A2 x, A3 x − b3 ). It is a bijection. Moreover, the values of the objective functions at x and
f (x) are the same. In particular, the minimum values of the objective functions are the same.!!

[2.21] Favorite example Consider min x1 + x2


s.t. x1 ≤ 1, x2 ≤ 1, xi ≥ 0.
 
x1
x2 
The slpp is min [1 1 0 0]x 
3
x4
 
  x1  
s.t. 1 0 1 0  x2  1
0 1 0 1 x3  = 1 , xi ≥ 0.
x4

13
Some exercises
[2.22] Exercise(E) Write the slpp of max x1 − 2x2 + 3x3 in the matrix form.
s.t. x1 + x2 ≤ 5, 2x2 + 3x3 ≥ 2, x1 ≥ 0, x2 ≤ 0

[2.23] Exercise(E) Convert max dt x to slpp. Write in matrix


n
s.t. Ax ≥ a, Bx ≤ b, Cx = c, x ∈ R , a, b, c ≥ 0
form.

[2.24] NoPen (Feasible regions under addition of a new constraint) Suppose that α is the min-
imal value of min ct x . Assume that a new constraint is added. What happens to the feasible
s.t. Ax ≤ b, x ≥ 0
region? What can happen to the new optimal value, assuming it exists?

14

You might also like