+ All Categories
Home > Documents > 1 . Linear Programming Problem - UCCS Home . Linear Programming Problem Complete the blending...

1 . Linear Programming Problem - UCCS Home . Linear Programming Problem Complete the blending...

Date post: 08-Apr-2018
Category:
Upload: lamkhue
View: 219 times
Download: 1 times
Share this document with a friend
12
1 . Linear Programming Problem Complete the blending problem from the in-class part [included below] An oil company makes two blends of fuel by mixing three oils. Figures on the costs and daily availability of the oils are given in Table 1 below. Table 1. Costs and daily availability of the oils Also, the requirements of the blends of fuel are given in Table 2 below. Table 2. Requirements of the blends of fuel Each litre of blend 1 can be sold for $1.10 and each litre of blend 2 can be sold for $1.20. Long-term contracts require at least 10,000 litres of each blend to be produced. Formulate this blending problem as a linear programming problem: (a) Find the optimal solution (use both the Large Scale Method and the Medium Scale Method in MATLAB) (b) Determine the shadow prices for each of the constraints and interpret your results. Solution The problem wants to maximize the profit obtained from making and selling the two types of blends of fuel. Define the (decision) variables: x 1 = amount of A oil used in blend 1 x 2 = amount of B oil used in blend 1 x 3 = amount of C oil used in blend 1 x 4 = amount of A oil used in blend 2 x 5 = amount of B oil used in blend 2 x 6 = amount of C oil used in blend 2 The total revenue and cost is given by Revenue =1.1(x 1 + x 2 + x 3 )+1.2(x 4 + x 5 + x 6 ) Cost =0.3(x 1 + x 4 )+0.4(x 2 + x 5 )+0.48(x 3 + x 6 ) and the objective function to be maximized is the linear function Profit = Revenue - Cost Next we identify the constrains: Amount of oil available: x 1 + x 4 6, 000 x 2 + x 5 10, 000 x 3 + x 6 12, 000
Transcript

1 . Linear Programming Problem

Complete the blending problem from the in-class part [included below]

An oil company makes two blends of fuel by mixing three oils. Figures on the costs and daily availability of the oils are givenin Table 1 below.

Table 1. Costs and daily availability of the oils

Also, the requirements of the blends of fuel are given in Table 2 below.

Table 2. Requirements of the blends of fuel

Each litre of blend 1 can be sold for $1.10 and each litre of blend 2 can be sold for $1.20. Long-term contracts require at least10,000 litres of each blend to be produced. Formulate this blending problem as a linear programming problem:(a) Find the optimal solution (use both the Large Scale Method and the Medium Scale Method in MATLAB)

(b) Determine the shadow prices for each of the constraints and interpret your results.

Solution

The problem wants to maximize the profit obtained from making and selling the two types of blends of fuel.Define the (decision) variables:

x1 = amount of A oil used in blend 1

x2 = amount of B oil used in blend 1

x3 = amount of C oil used in blend 1

x4 = amount of A oil used in blend 2

x5 = amount of B oil used in blend 2

x6 = amount of C oil used in blend 2

The total revenue and cost is given by

Revenue = 1.1(x1 + x2 + x3) + 1.2(x4 + x5 + x6)

Cost = 0.3(x1 + x4) + 0.4(x2 + x5) + 0.48(x3 + x6)

and the objective function to be maximized is the linear function

Profit = Revenue− Cost

Next we identify the constrains:

Amount of oil available:x1 + x4 ≤ 6, 000

x2 + x5 ≤ 10, 000

x3 + x6 ≤ 12, 000

Long term contract requirements:x1 + x2 + x3 ≥ 10, 000

x4 + x5 + x6 ≥ 10, 000

Requirement on the composition of the fuels:

x1/(x1 + x2 + x3) ≥ 0.3

x2/(x1 + x2 + x3) ≤ 0.5

x3/(x1 + x2 + x3) ≥ 0.3

x4/(x4 + x5 + x6) ≤ 0.4

x5/(x4 + x5 + x6) ≥ 0.35

x6/(x4 + x5 + x6) ≤ 0.4

Each of the inequalities above need to be rewritten in linear form ak1x1 + . . . ak6x6 ≤ bk, for example the first onebecomes:

x1 ≥ 0.3(x1 + x2 + x3), or, equivanently, − 0.7x1 + 0.3x2 + 0.3x3 ≤ 0.

We then setup this linear programming problem in MATLAB, recalling that the standard form of the constraints inthe linprog command is

min fTx, subject to Ax ≤ b

R=[1.1; 1.1; 1.1; 1.2; 1.2; 1.2];

C=[0.3; 0.4; 0.48; 0.3; 0.4; 0.48];

f=R-C;

A=[1 0 0 1 0 0;

0 1 0 0 1 0;

0 0 1 0 0 1;

-1 -1 -1 0 0 0;

0 0 0 -1 -1 -1;

-0.7 0.3 0.3 0 0 0;

-0.5 0.5 -0.5 0 0 0;

0.3 0.3 -0.7 0 0 0;

0 0 0 0.6 -0.4 -0.4;

0 0 0 0.35 -0.65 0.35;

0 0 0 -0.4 -0.4 0.6];

b=[6000; 10000; 12000; -10000; -10000; 0; 0; 0; 0; 0; 0];

lb=zeros(6,1);

We employ first the Large Scale Method (default in MATLAB):

[x,fval,exitflag,output,lambda] = linprog(-f,A,b,[],[],lb);

x, fmax=-fval

slack=b-A*x

shadowprice=lambda.ineqlin

Optimization terminated.

x =

3414.41

1483.99

5101.60

2585.59

8516.01

6898.40

fmax =

21040.00

slack =

0.00

0.00

0.00

0.00

8000.00

414.41

3516.01

2101.60

4614.41

2216.01

301.60

shadowprice =

0.90

0.80

0.72

0.10

0.00

0.00

0.00

0.00

0.00

0.00

-0.00

This shows the maximum profit is $21,040, obtained when x1 = 3414.41, x2 = 1483.99, x3 = 5101.60, x4 = 2585.59,x5 = 8516.01 and x6 = 6898.40. In making these blends, the first 4 constrains are binding. The shadow pricesindicate that if one can make additional A oil available at a cost of less than .90 ($ per litre) then one would makean additional profit. Similarly for B and C oil. More over, if one would relax the long-term contract from 10,000litres to less for blend 1, at a cost of less than 0.72 ($ per litre), then one could make additional profit. Notice thatthe 5th constraint is not binding, with a slack of 8,000, which means that blend 2 is produced in a larger quantity(18,000 litres).Next, we employ the Medium Scale (simplex method) and compare with the previous results:

options = optimset(’LargeScale’,’off’,’Simplex’,’on’);

[x,fval,exitflag,output,lambda] = ...

linprog(-f,A,b,[],[],lb,[],[],options);

x, fmax=-fval

slack=b-A*x

shadowprice=lambda.ineqlin

Optimization terminated.

x =

3000.00

0

7000.00

3000.00

10000.00

5000.00

fmax =

21040.00

slack =

0

0

0

0

8000.00

0.00

5000.00

4000.00

4200.00

3700.00

2200.00

shadowprice =

0.90

0.80

0.72

0.10

0

0

0

0

0

0

0

Again, the maximum profit is $ 21,040, but with a different values of the decision variables. The shadow prices beingthe same, the only difference between the two methods are the slacks for the constraints indicating the requirementson the composition of each blend. For example, in the second method, the percentage of A oil in Blend 1 is exactly30%, whereas in the first method is more. So the choice of the method should be dictated by other factors (whichare not specified in this problem).

2. Predator-Prey Problem

Consider the following model for a two-species interaction (one predator, one prey).

dx

dt= rx

(1− x

K

)+

qxy

x+ y

dy

dt= sy

(1− y

L

)− α qxy

x+ y

Here x = x(t) is the predator population at time t, y = y(t) is the prey population at time t. We assume the environmentalcarrying capacity of predator population K = 150, 000 and the environmental carrying capacity of the prey L = 400, 000;r = 0.05 is the intrinsic growth rate of the predator and s = 0.08 is the intrinsic growth rate of the prey. q = 0.1 is maximalrelative increase rate of the predator population due to prey. α is models the ratio of the mass of a prey individual to the mass ofa predator individual, and is used to account for how much of the biomass of the prey is transformed to the predator population]

(a) For the value α = 0.5, determine the equilibria of the system and determine the stability of the equilibria using the eigenvalue

method.

(b) Plot a complete phase portrait of the dynamical system.

(c) Perform a sensitivity analysis to the parameter α. For which values of α is there a stable coexistence equilibrium?

(d) Indicate what happens to an initial population of 100,000 predators and 400,000 prey for various values of α.

Solutions: Part (a)

syms x y

f=0.05*x*(1-x/150000)+0.1*x*y/(x+y);

g=0.08*y*(1-y/400000)-0.5*0.1*x*y/(x+y);

[xsteady,ysteady]=solve(f,g);

xsteady=double(xsteady);

ysteady=double(ysteady);

disp(’The equilibrium points are’)

disp([xsteady, ysteady])

The equilibrium points are

0 400000.00

150000.00 0

293625.85 269688.21

-20898.58 7584.52

Since we are only interested in steady states in the first quadrant, we will discard the 4th steady state.

Eigenvalue method

for i=1:3

G=[f; g];

DG=[diff(f,x) diff(g,x);

diff(f,y) diff(g,y)];

A=subs(DG,[x y],[xsteady(i) ysteady(i)]);

lambda=eig(A);

lambda=double(lambda);

fprintf(’The eigenvalues for the equilibrium (’)

fprintf(’%1.0f, %1.0f’,xsteady(i), ysteady(i)); fprintf(’) are \n’)

fprintf(’%1.2f %1.2f\n\n’,lambda(1), lambda(2));

end

The eigenvalues for the equilibrium (0, 400000) are

0.15 -0.08

The eigenvalues for the equilibrium (150000, 0) are

0.03 -0.05

The eigenvalues for the equilibrium (293626, 269688) are

-0.12 -0.05

By the criterium for stability for continuous time dynamical systems (<λ < 0 for asymptotic stability) we concludethat the coexistence equilibrium is asymptotically stable, the other equilibria being unstable.

Part (b)

We use pplane8.m to generate the complete phase portrait

Part (c)

syms alpha

f=x*(0.05*(1-x/150000)+0.1*y/(x+y));

g=y*(0.08*(1-y/400000)-alpha*0.1*x/(x+y));

[xsteady,ysteady]=solve(f,g,x,y)

ezplot(xsteady(4),[0 1]), hold on

ezplot(ysteady(4),[0 1]), hold off

title(’The coexistence equilibrium’)

DG=[1+diff(f,x) diff(g,x);

diff(f,y) 1+diff(g,y)];

A=subs(DG,[x y],[xsteady(4) ysteady(4)]);

lambda=eig(A);

ezplot(lambda(1),[0 1]), hold on

ezplot(lambda(2),[0 1]), hold off

axis([0 1 0.8 1.05])

title(’the two eigevalues of DG vs a’)

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 10.8

0.85

0.9

0.95

1

1.05

!

the two eigevalues of DG vs a

Conclusion: For α between 0 and the critical value 0.868..., one has an unique stable coexistence equilibrium,otherwise not.

Part (d)

syms x y

for alpha=[0.1, 0.3, 0.5, 0.7, 0.9]

figure

M=10; % number of samples points

xmin=0; xmax=400000; % domain specification

ymin=0; ymax=500000;

[x,y]=meshgrid(xmin:(xmax-xmin)/M:xmax,ymin:(ymax-ymin)/M:ymax);

dx=x.*(0.05*(1-x/150000)+0.1*y./(x+y)); % x1-component

dy=y.*(0.08*(1-y/400000)-alpha*0.1*x./(x+y)); % x2-component

quiver(x,y,dx,dy); % matlab routine

axis([xmin xmax ymin ymax]);

xlabel(’Predator’); ylabel(’Prey’);

hold on

X=[100000; 400000];

N = 1000;

F= @(x1,x2) [x1*(0.05*(1-x1/150000)+0.1*x2/(x1+x2));

x2*(0.08*(1-x2/400000)-alpha*0.1*x1/(x1+x2))];

for n=1:N

Xnew = X + F(X(1),X(2));

plot([X(1),Xnew(1)], [X(2),Xnew(2)],’--ro’,...

’MarkerFaceColor’,’k’,’MarkerSize’,2)

axis([0 400000 0 500000])

X = Xnew;

end

title(strcat(’Dynamics for alpha =’,num2str(alpha)))

hold off

end

0 0.5 1 1.5 2 2.5 3 3.5 4x 105

0

0.5

1

1.5

2

2.5

3

3.5

4

4.5

5x 105

Predator

Prey

Dynamics for alpha =0.1

0 0.5 1 1.5 2 2.5 3 3.5 4x 105

0

0.5

1

1.5

2

2.5

3

3.5

4

4.5

5x 105

Predator

Prey

Dynamics for alpha =0.3

0 0.5 1 1.5 2 2.5 3 3.5 4x 105

0

0.5

1

1.5

2

2.5

3

3.5

4

4.5

5x 105

Predator

Prey

Dynamics for alpha =0.5

0 0.5 1 1.5 2 2.5 3 3.5 4x 105

0

0.5

1

1.5

2

2.5

3

3.5

4

4.5

5x 105

Predator

Prey

Dynamics for alpha =0.7

0 0.5 1 1.5 2 2.5 3 3.5 4x 105

0

0.5

1

1.5

2

2.5

3

3.5

4

4.5

5x 105

Predator

Prey

Dynamics for alpha =0.9

Conclusion: for values of α between 0 and 0.87... we have a stable coexistence equilibrium and the initial populationof 100,000 predators and 400,000 prey will converge to that equilibrium. For values of α above the critical value0.868... , there are no stable equilibria and population of prey eventually gets extinct.

3. Logistic Model with Harvesting

Consider the one-species population model, where P = P (t) governed by the differential equation

dP

dt= rP

(1− P

M

)− hP

where r > 0,M > 0 are the intrinsic growth rate and maximum sustainable population in absence of harvesting and h > 0 isthe rate of harvesting. Assume that the initial population is P (0) = P0

(a) Find the general solution P = P (t);(b) For T > 0, compute the total yield

YT (h) =

∫ T

0

hP (t) dt

as a function of h, then find the optimal hT for which the total yield YT (h) is maximized.

(c) What is the limit limT→+∞

hT ?

Solution:

The solution of the logistic equation

dP

dt= rP

(1− P

M

), P (0) = P0

is given by (see lecture 10)

P (t) =MP0

P0 + (M − P0)e−rt

In presence of harvesting, the dynamical system remains a logistic equation, but with different parameters:

dP

dt= rP

(1− P

M

)− hP = (r − h)P − r

MP 2 = (r − h)P

(1− P

M(r − h)/r

)or

dP

dt= r̃P

(1− P

), P (0) = P0

where r̃ = r − h and M̃ = M(r − h)/r. Hence the solution is

Ph(t) =M̃P0

P0 + (M̃ − P0)e−r̃t=

M(r − h)/rP0

P0 + (M(r − h)/r − P0)e−(r−h)t

Part(b)

The total yield is

YT (h) =

∫ T

0

hPh(t) dt = h

∫ T

0

M̃P0

P0 + (M̃ − P0)e−r̃tdt = h

∫ T

0

M̃P0er̃t

P0er̃t + (M̃ − P0)dt

After making a substitution , one gets

YT (h) =h

r̃M̃[ln(P0e

r̃T + (M̃ − P0))− ln(M̃)

]=h

r̃M̃ ln

[P0

(er̃T − 1

)+ 1

]Replacing r̃ = r − h and M̃ = M(r − h)/r we get

YT (h) = Mh

rln

[P0

M(r − h)/r

(e(r−h)T − 1

)+ 1

]To find the optimal harvesting rate hT , we use MATLAB to maximize total yield. Since symbolically one cannotfind an explicit solution, we plug in values for M , r, P0 and T :

syms h

M=1000;

r=0.5;

P0=500;

T=50;

Y=h*M/r*log(P0/(M*(r-h)/r)*(exp((r-h)*T)-1)+1);

ezplot(Y,[0 2*r])

dYdh=diff(Y,h);

solve(dYdh, h)

ans =

0.25532530521461221271496007209301

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

0

500

1000

1500

2000

2500

h

2000 h log(1 (500 (exp(10 20 h) 1))/(2000 h 1000))

If we repeat this with increasingly larger values of T , we see that hT approaches r/2.

hT=zeros(1,10);

for j=1:10

T=20*j;

Y=h*M/r*log(P0/(M*(r-h)/r)*(exp((r-h)*T)-1)+1)

dYdh=diff(Y,h);

hT(j)=solve(dYdh, h);

end

plot(hT)

0 20 40 60 80 100 120 140 160 180 2000

0.05

0.1

0.15

0.2

0.25

0.3

0.35

0.4

0.45

0.5

T

h T

4. Newton’s Method in 2D as a Discrete Time Dynamical System

Consider the Newton’s Method for approximating zeros of a vector function F (X): say X = [x1, x2]T has two variables and

F = [f1, f2]T :

To approximate X∗ such that, F (X∗) = 0, start with an initial guess X(0), then iterate

X(n+1) = G(X(n)) := X(n) − [DF (X(n))]−1F (X(n))]

(a) Determine the steady states X∗ of this discrete dynamical system.

(b) Determine whether X∗ is asymptotically stable or not.(c) Apply Newton’s method for the system {

x21 + x22 = 1

x1 + x2 = 1

by choosing the initial guess X(0) = [2; 0]. Plot the trajectory of the solution. Redo this with 3 other initial guesses. What cango wrong in the Newton’s Method?(d) The method of steepest descent for minimizing a function of 2 variables h(x1, x2) is given by the discrete time dynamicalsystem

X(n+1) = X(n) − t∇h(X(n))

where t > 0 is chosen such that h(X(n+1)) is the smallest possible. Use this method for minimizing the function

h(x1, x2) = (x21 + x22 − 1)2 + (x1 + x2 − 1)2

and compare it with the Newton’s method in part (c). Which method gives a better approximation to the solution when using

the same number of iterations?

Solutions:

(a) X∗ is a steady state meansX∗ = G(X∗) = X∗ − [DF (X∗)]−1F (X∗)

which is equivalent toF (X∗) = 0 and DF (X∗) invertible

So the steady states of this discrete time dynamical system are precisely the zeros of F (X) = 0 where the Jacobianmatrix DF (X) is nonsingular.(b) We need to compute the eigenvalues of the Jacobian matrix DG(X∗): Using the product rule,

DG(X) = I−D([DF (X)]−1

)F (X)− [DF (X)]−1DF (X) = I−D

([DF (X)]−1

)F (X)−I = −D

([DF (X)]−1

)F (X)

so, at X = X∗,

DG(X∗) = −D([DF (X∗)]−1

)F (X∗) = 0

since F (X∗) = 0. so all the eigenvalues of DG(X∗) are zero, hence |λ| < 1, which shows that the steady state isasymptotically stable!(c), (d) coming soon

5. Fixed Interest Reinvestment Problem (discrete model)

Bank ”X” offers you to open fee-free savings and checking accounts for a period of T = 10 years. The savings account hasr = 5% annual interest rate, while the checking account has zero (nada!) interest rate. Money in the savings account cannotbe withdrawn (as a bulk sum) during the entire period T = 10 years, but the account rules allow for a fraction of the interestaccrued at any given time to be moved to the checking account. Money in the checking account can be accessed at any time, soyou can spend it as you wish, or leave it to accumulate. You decide to deposit an initial amount x0 = $10, 000 in the savingsaccount, but want to maximize the return, measured by the total amount moved into the checking account throughout the entireperiod (and available for spending)Assume that the interest is compounded n times a year (say, quarterly n = 4) and that you decide on a fixed fraction u ofthe interest accrued during each quarter to be reinvested (left in the savings account) ( 0 ≤ u ≤ 1.)Let xk be the amount of money in the savings account at the end of the kth quarter. The discrete dynamical system thatdescribes how money grows in the savings account is

xk+1 = xk +r

nuxk, k = 0, . . . , N − 1 (1)

(N is the number of times interest is computed during the entire period, N = nT ).

(a) Express xk as a function of the initial deposit x0.

(b) Find an expression (as a function of u) for the total amount accumulated in the checking account throughout the entire

period (assuming none was spent). [Use the identity 1 + α+ α2 + . . .+ αN−1 = αN−1α−1

, if α 6= 1.]

(c) What value of the fixed fraction u ∈ [0, 1] maximizes the total amount of money accumulated in the checking account

throughout the period (found in part (b)).

Solution

(a) For a fixed u ∈ [0, 1] we have

x1 = x0(1 +r

nu), x2 = x1(1 +

r

nu) = x+ 0(1 +

r

nu)2

Inductively,

xk = x0(1 +r

nu)k, for k = 1, 2, . . .

(b) The accumulated amount (available int he checking account at the end of the year) is

A = a1 + a2 + . . .+ aN , where ak =r

n(1− u)xk−1

ak is the fraction of interest moved to checking. So,

A =r

n(1− u)[x0 + x1 + . . . xN−1]

=r

n(1− u)x0[1 + (1 +

r

nu) + . . .+ (1 +

r

nu)N−1]

=r

n(1− u)x0

(1 + rnu)N − 1

(1 + rnu)− 1

=1− uu

x0

[((1 +

r

nu)N − 1

](c) Since the amount found in (b) A = A(u) is a function of (u), highly nonlinear, we use MATLAB to maximizeA(u) on the set u ∈ [0, 1] to get u∗ = 0.In conclusion, to maximize the total amount of money accumulated in the checking account one should not reinvestany portion of the interest.


Recommended