Problem 1

In linear settings, i.e. linear objective function and linear constraints, it suffices to check corners for optimals. In this case the objective function \(4x + 5y\) increases in x and y, so we only need to plug in (0,20) and (30,0). (0,20) gives Max 100 points, while (30,0) gives Max 120 points. So he should eat 30 tortes to maximize his points.

Using lp() in lpSolve package to solve for optimal yields the same result.

C1 = t(c(4,5))
A1 = matrix(c(2,3),1,2)
dir1 = "<="
b = 60

solution1 <- lp(direction = "max",
                objective.in = C1,
                const.mat = A1,
                const.dir = dir1,
                const.rhs = b)
print (solution1$solution)
## [1] 30  0

Now adding in another constraints:

Follow the same logic, it suffices to check (0,20) and (12,12) to for optimal. In this case, (12,12) gives Max 108 points, which is 12 points smaller.

Problem 2

a

  • Choose x acre of wheat and y acre of corn

  • Objective:

\(max 2000x + 3000y\)

  • Subject to:

\(3x + 2y <= 1000\)

\(2x + 4y <= 1200\)

\(x,y >= 0\)

Check corners (0,0),(0,300),(200,200),(1000/3,0). (200,200) yields the largest profit of 1,000,000.

b

C1 = t(c(2000,3000))
A1 = matrix(c(3,2,2,4,1,1),nrow = 3, byrow = T)
dir1 = rep("<=",3)
b = c(1000,1200,450)

solution2 <- lp(direction = "max",
                objective.in = C1,
                const.mat = A1,
                const.dir = dir1,
                const.rhs = b)
print (solution1$solution)
## [1] 30  0
print (solution2$objval)
## [1] 1e+06

c

CASE 1

As shown in the graph below, the profit curve is represented by the blue solid line, the fertilizer constraint the red dashed line.

As the fertilizer constraint moves inward until the constraint area becomes a triangle, the farmer will stop producing corn. The cut-off value for the fertilizer is 2 * 1000/3 = 667. But fertilizer here can only take integer values. Therefore, the farmer will stop producing corn when fertilizer <= 600.

CASE 2

As the fertilizer constraint moves outwards, there will be a while when we have five corners to check for optimal. According to the relative steepness of the profit curve and constraint curves, the optimal point would be the intersection of the fertilizer constraint and the field constraint, as shown in the graph below. In this case, the farmer will produce a mix of the two products.

## [1] 100 350
## [1]  50 400

CASE 3

If the fertilizer constraint in CASE 2 keeps moving outwards, again the constraint area will become a 4-sided polygon (which will remain unchanged as the fertilizer constraint moves out farther). In this case, (0,450) yields the optimal profit when fertilizer = 1800 tons. Therefore, when fertilizer >= 1800 tons, the farmer will stop producing wheat.

In summary, the farmer will stop producing corn when the fertlizer <= 600; he will stop producing wheat when fertilizer >= 1800;

d

Yes. c) is actually solved in a shadow-price-ish fasshion.

Problem 3

Use \(a, b, c, d, e\) to repesent five investment opportunities, and footnote \(1, 2\) to represent investment at time 0 and time 1;

\(max 13(a_1 + a_2) + 16(b_1 + b_2) + 16(c_1 + c_2) + 14(d_1 + d_2) + 39(e_1 + e_2)\)

\(s.t.\)

\((1) a_1 + b_1 + c_1 + d_1 + e_1 <= 40\)

\((2) a_2 + b_2 + c_2 + d_2 + e_2 <= 20\)

\((3)-(12) Non-negative\)

C3 = t(rep(c(13,16,16,14,39),2))
A3 = matrix(c(11,53,5,5,29,rep(0,10),3,6,5,1,34),
            nrow = 2, byrow = T)
print (A3)
##      [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
## [1,]   11   53    5    5   29    0    0    0    0     0
## [2,]    0    0    0    0    0    3    6    5    1    34
dir3 = rep("<=", 2)
b3 = c(40,20)

solution3 = lp("max",C3,A3,dir3,b3)
print (solution3$solution)
##  [1]  0  0  8  0  0  0  0  0 20  0
print (solution3$objval)
## [1] 408

Problem 4

Use \(c, m, b\) to represent corn, milk, and bread respectively.

\(min 0.18c + 0.23m + 0.05b\)

\(s.t.\)

\((1-2) 2000 <= 72c + 121m + 65b <= 2250\)

\((3-4) 5000 <= 107c + 500m + 0*b <= 50000\)

\((5-7) b, m, c <= 10\)

\((8-10) Non-negative\)

C4 = t(c(0.18, 0.23, 0.05))
dir4 = rep("<=",7)
b4 = c(2250,-2000,50000,-5000,10,10,10)

A4 = matrix(0, nrow = 7,ncol=3)
A4[1,] = c(72, 121, 65)
A4[2,] = -A4[1,]
A4[3,] = c(107,500,0)
A4[4,] = -A4[3,]
A4[5:7,] = diag(1,nrow=3)
print (A4)
##      [,1] [,2] [,3]
## [1,]   72  121   65
## [2,]  -72 -121  -65
## [3,]  107  500    0
## [4,] -107 -500    0
## [5,]    1    0    0
## [6,]    0    1    0
## [7,]    0    0    1
solution4 = lp("min",C4,A4,dir4,b4)
print (solution4$solution)
## [1]  1.944444 10.000000 10.000000
print (solution4$objval)
## [1] 3.15

Problem 5

1.

##        Unfinished Tabel Unfinished Chair Table Chair
## Price                70               60   140   110
## Cost                 40               30    40    30
## Profit               30               30   100    80
## Labor                 2                2     5     4

With the assumptions listed above, use \(t_u, c_u, t, c\) to represent units of unfinished table, unfinished chair, table, and chair respectively.

\(max 30t_u + 30c_u + 100t + 80c\)

\(s.t.\)

\((1)40(t_u + t) + 30(c_u + c) <= 40000\)

\((2)2t_u + 2c_u + 5t + 4c <= 6000\)

\((3-6) Non-negative\)

C5 = t(c(30,30,100,80))
A5 = matrix(c(rep(c(40,30),2),2,2,5,4),
            nrow = 2, byrow = T)
dir5 = rep("<=",2)
b5 = c(40000,6000)

solution5 = lp("max",C5,A5,dir5,b5)
print (solution5$solution)
## [1]    0.000    0.000    0.000 1333.333
print (solution5$objval)
## [1] 106666.7

2.

Shadow price associated with labor is “how much more profit can we get by increasing 1 more unit of labor”;

Shadow price associated with money is “how much more profit can we get by increasing the budget constraint by $1”;

# Shadow price for labor
b5_labor = b5 + c(0,1)
solution5_labor = lp("max",C5,A5,dir5,b5_labor)
sp_labor = solution5_labor$objval - solution5$objval
print (sp_labor)
## [1] 0
# Shadow price for $
b5_dollar = b5 + c(1,0)
solution5_dollar = lp("max",C5,A5,dir5,b5_dollar)
sp_dollar = solution5_dollar$objval - solution5$objval
print(sp_dollar)
## [1] 2.666667

Therefore, the shadow price for labor is 0, the shadow price for dollar is $2.67.