SharedChap2.1.ipynbOpen in CoCalc

TV Manufactoring Problem Unconstraint

Variables

x=x = number of 19 in sets

y=y = number of 21-in sets

cx=c_x = cost of manufacturing 19 in sets

cy=c_y = cost of manufacturing 21 in sets

ctot=c_{tot} = total cost

sx=s_x = selling price of 19 in sets

sy=s_y = selling price of 21 in sets

R=R = revenue

P= P = profit

Assumptions

x0,y0x\geq 0, y\geq 0

cx=195xc_x = 195x

cy=225yc_y = 225y

ctot=400,000+cx+cyc_{tot} = 400,000 + c_x +c_y

sx=3390.01x0.003ys_x = 339-0.01x -0.003y

sy=3990.01y0.004xs_y = 399 - 0.01y - 0.004x

R=xsx+ysyR = x\cdot s_x + y\cdot s_y

P=RctotP = R - c_{tot}

Objective

Maximize P

cx(x, y) = 195*x
cy(x, y) = 225*y
ctot(x,y) = 400000 + cx(x,y) + cy(x,y)
sx(x, y) = 339 - 0.01*x -0.003*y# sellin price of 19-inch
sy(x, y) = 399 -0.01*y - 0.004*x
R(x, y) = x*sx(x, y) + y*sy(x, y)
P(x, y) = R(x,y) - ctot(x,y)

contour_plot(P(x,y),(x, 0, 10000),(y,0, 10000))

We find all points (x,y)(x,y) with dPdx=0\frac{dP}{dx} =0 and dPdy=0\frac{dP}{dy} =0

eq = solve([diff(P(x,y),x)==0, diff(P(x,y),y)==0],x,y)
show(eq)
[[x=(554000117),y=(824000117)]]\left[\left[x = \left(\frac{554000}{117}\right), y = \left(\frac{824000}{117}\right)\right]\right]
n(eq[0][0].rhs())
4735.04273504274
n(eq[0][1].rhs())
7042.73504273504

Maximum Profit

P(eq[0][0].rhs(),eq[0][1].rhs())
553641.025641026

sensitivity of xx and yy to the elasticity of the 19 in sets and 21 inch sets


sxa(x,y,a) = 339 - a*x -0.003*y
Ra(x,y,a) = x*sxa(x, y,a) + y*sy(x, y)
Pa(x,y,a) = Ra(x,y,a) - ctot(x,y)

eq_1 = solve([diff(Pa(x,y,a),x)==0,diff(Pa(x,y,a),y)==0,],x,y)
show(eq_1)
[[x=166200040000a49,y=48000(7250a21)40000a49]]\left[\left[x = \frac{1662000}{40000 \, a - 49}, y = \frac{48000 \, {\left(7250 \, a - 21\right)}}{40000 \, a - 49}\right]\right]
xa = eq_1[0][0].rhs()
show(xa)
166200040000a49\frac{1662000}{40000 \, a - 49}
sxa(a)= xa.diff(a)*a/xa
show(sxa(.01))
1.13960113960114-1.13960113960114

Our computations suggest that we should expect a 1.14% decrease in manufacturing of 19 in monitors for every 1% increase in the elasticity coefficient for 19 in monitors.

ya = eq_1[0][1].rhs()
show(ya)


48000(7250a21)40000a49\frac{48000 \, {\left(7250 \, a - 21\right)}}{40000 \, a - 49}
sya(a)= ya.diff(a)*a/ya
show((sya(.01)))
0.2681658506901230.268165850690123

Our computations suggest that we should expect a 2.7% decrease in manufacturing of 21 in monitors for every 1% increase in the elasticity coefficient for 21 in monitors.

Computing the sensitivity of the maximum profit with respect to the elasticity of the 19 inch monitors

pmax(a) = Pa(xa,ya,a)
show(pmax)
a  144000.000000000(7250a21)(160.000000000000(7250a21)40000a49+2216.0000000000040000a49133.000000000000)40000a4910800000(7250a21)40000a494.98600000000000×106(48.0000000000000(7250a21)40000a49+554000.000000000a40000a49113.000000000000)40000a4932409000040000a49400000a \ {\mapsto}\ -\frac{144000.000000000 \, {\left(7250 \, a - 21\right)} {\left(\frac{160.000000000000 \, {\left(7250 \, a - 21\right)}}{40000 \, a - 49} + \frac{2216.00000000000}{40000 \, a - 49} - 133.000000000000\right)}}{40000 \, a - 49} - \frac{10800000 \, {\left(7250 \, a - 21\right)}}{40000 \, a - 49} - \frac{4.98600000000000 \times 10^{6} \, {\left(\frac{48.0000000000000 \, {\left(7250 \, a - 21\right)}}{40000 \, a - 49} + \frac{554000.000000000 \, a}{40000 \, a - 49} - 113.000000000000\right)}}{40000 \, a - 49} - \frac{324090000}{40000 \, a - 49} - 400000
spmax = pmax.diff(a)*a/pmax
spmax(0.01)
-0.404966912932827

Sensitivity of the maximum profit using the chain rule (Alternate method)

diff(Pa(x,y,a),a)
-x^2
-eq[0][0].rhs()^2*0.01/(553641.025)
-0.404966913401712
#Lagrange Multipliers Problem
#We reconsider the color TV problem (Example 2.1) introduced in the previous section. There we assumed that the company has the potential to produce any number of TV sets per year. Now we introduce constraints based on the available production capacity. 
Consideration of these two products came about because the company plans to discontinue manufacture of some older models,
#thus providing excess capacity at its assembly plant. This excess capacity could be used to increase production of other existing product lines, but the company feels that the new products will be more profitable. It is estimated that the available
production capacity will be sufficient to produce 10,000 sets per year. The company has an ample supply of 19-inch and 21-inch LCD panels and other standard components; however, the circuit boards necessary for constructing the sets are currently in short supply. Also, the 19-inch TV requires a different board than the 21-inch models because of the internal configuration, which cannot be changed without a major redesign, which the company is not prepared to undertake at this time. The supplier is able to
supply 8,000 boards per year for the 21-inch model and 5,000 boards per year for the 19-inch model.
#1. Taking this information into account, how should the company set production levels?
#2.2 Lagrange Multiplier
cx(x, y) = 195*x
cy(x, y) = 225*y
ctot(x,y) = 400000 + cx(x,y) + cy(x,y)
sx(x, y) = 339 - 0.01*x -0.003*y
sy(x, y) = 399 -0.01*y - 0.004*x
R(x, y) = x*sx(x, y) + y*sy(x, y)
P(x, y) = R(x,y) - ctot(x,y)

p1 = contour_plot(P(x,y),(x, 0, 10000), (y,0,10000))
p2 = implicit_plot(x==5000,(x,0,10000),(y,0,10000),color='red')
p3 = implicit_plot(y ==8000,(x,0,10000),(y,0,10000), color = 'blue')
p4 = implicit_plot(x+y ==10000,(x,0,10000),(y,0,10000),color='green')
show(p1 + p2+ p3 + p4)

Maximize pp subject to the constraint x = 5000.

L1 = var('L1')
solve([P.diff(x)==L1,P.diff(y)==0,x==5000],x,y,L1)
[[x == 5000, y == 6950, L1 == (-93/20)]]

The above point is outside of the feasible region and should not be used.

L2 = var('L2')
solve([P.diff(x)==0,P.diff(y)==L2,y==8000],x,y,L2)
[[x == 4400, y == 8000, L2 == (-84/5)]]

The above point is outside of the feasible region and should not be used.

L3 = var('L3') # Lambda values have an important meaning.
solve([P.diff(x)==L3,P.diff(y)==L3, x+y ==10000],x,y,L3)
[[x == (50000/13), y == (80000/13), L3 == 24]]

The above point is a candidate for max

Maximize PP subject to the constraint x = 0
L4 = var('L4')
solve([P.diff(x)==L4, P.diff(y)==0, x== 0],x,y,L4)
[[x == 0, y == 8700, L4 == (831/10)]]

The above point is outside of the feasible point

Maximize P subject to the constraint y = 0.

L5 = var('L5')
solve([P.diff(x)==0, P.diff(y)==L5, y==0],x,y,L5)
[[x == 7200, y == 0, L5 == (618/5)]]

The solution to the unconstraint problem is outside of the feasible region

Test Points

(5000,0)

(5000, 5000)

(50,000/13, 80,000/13)

(2000, 8000)

(0, 8000)

(0,0)

show(P(50000/13, 80000/13))
532307.692307692532307.692307692
P(5000,0)
70000.0000000000
P(5000,5000)
515000.000000000
P(2000, 8000)
488000.000000000
P(0, 8000)
352000.000000000
P(0,0)
-400000.000000000


sxa(x, y,a) = 339 - a*x -0.003*y
sy(x, y) = 399 -0.01*y - 0.004*x
Ra(x, y,a) = x*sxa(x, y,a) + y*sy(x, y)
Pa(x, y,a) = Ra(x,y,a) - ctot(x,y)

La = var('La')
solve([Pa.diff(x)==La,Pa.diff(y)==La, x+y ==10000],x,y,La)
[[x == 50000/(1000*a + 3), y == 20000*(500*a - 1)/(1000*a + 3), La == -52*(500*a - 11)/(1000*a + 3)]]
xa(a)=50000/(1000*a + 3)
Sxa(a)= xa.diff(a)*a/xa

The result below suggests that if aa increases by 10%, xx decreases by 7.7%

Sxa(0.01) # If a goes up by 10%, x decreases by 7,7% 
-0.769230769230769
ya(a)=20000*(500*a - 1)/(1000*a + 3) 
optimalP(a) = Pa(xa,ya,a)
Spa(a) = optimalP.diff(a)*a/optimalP

The rsult below suggests that if aa increases by 10%, the maximum profit decreases by 2.8%

Spa(0.01) # If "a" goes up 10%, profit will go down by 2.8%.
-0.277901289461984

Sensitivity of the profit with respect to the condition x+y=10000 x+y =10000

L= var('L')
c = var('c')
sol = solve([P.diff(x)==L,P.diff(y)==L, x+y ==c],x,y,L)
pmaxc(c) = P(sol[0][0].rhs(), sol[0][1].rhs())
SPc(c) = pmaxc.diff(c)*c/pmaxc
SPc(10000)
0.450867052023121
L3 = var('L3')
solve([P.diff(x)==L3,P.diff(y)==L3, x+y ==10001],x,y,L3)
[[x == (100013/26), y == (160013/26), L3 == (47973/2000)]]
P(100013/26, 160013/26)
532331.685557693
pmaxc(10001)pmaxc(10000)/1=dpmaxc/dcpmaxc(10001)-pmaxc(10000)/1 =dpmaxc/dc
pmaxcdiff(c)= pmaxc.diff(c)

pmaxcdiff(10000)# How much you're willing to pay to increase production?
24.0000000000000

Suppose now that we have the constraint x<= 3000

P(3000, 7000)


523000.000000000
P(2000, 8000)
488000.000000000

Shadow price is to increase the c by one

to increase 19-inch by 1, you should'nt pay more than 22 dollars, to increase total production by one , you shouldn't pay more than $13.

solve([P.diff(x)==L1 + L2, P.diff(y)==L2, x==3000, x+y==10000],x,y,L1,L2)
[[x == 3000, y == 7000, L1 == 22, L2 == 13]]