Star Oil Company is considering five different investment opportunities. The cash outflows and net present values (in millions of dollars) are given in Table. Star Oil has $40 million available for investment now (time 0); it estimates that one year from now (time 1) $20 million will be available for investment. Star Oil may purchase any fraction of each investment. In this case, the cash outflows and NPV are adjusted accordingly. For example, if Star Oil purchases one-fifth of investment 3, then a cash outflow of π/π (π)=$π million would be required at time 0, and a cash outflow of π/π (π)=$π million would be required at time 1. The one-fifth share of investment 3 would yield an NPV of π/π (ππ)=$π.π million. Star Oil wants to maximize the NPV that can be obtained by investing in investments 1β5. Formulate an LP that will help achieve this goal. Assume that any funds left over at time 0 cannot be used at time 1.
1 | 2 | 3 | 4 | 5 | |
---|---|---|---|---|---|
Time 0 Cash outflow | 11 | 53 | 5 | 5 | 29 |
Time 1 Cash outflow | 3 | 6 | 5 | 1 | 34 |
NPV | 13 | 16 | 16 | 14 | 39 |
InΒ [1]:
from gurobipy import *
investments_targets = ["i1", "i2", "i3", "i4", "i5"]
expected_npv = [13,16,16,14,39]
cash_outflow = [
[11,53,5,5,29],
[3,6,5,1,34]
]
cash_budget = [40,20]
# Model
m = Model("project_selection")
invesestment_assignment = []
for i in range(len(investments_targets)):
invesestment_assignment.append(
m.addVar(
vtype=GRB.CONTINUOUS,
obj = expected_npv[i],
name="(%s)" % (investments_targets[i])))
m.modelSense = GRB.MAXIMIZE
m.update()
for time in range(len(cash_outflow)):
m.addConstr(
quicksum(cash_outflow[time][c] * invesestment_assignment[c]
for c in range(len(investments_targets))) <= cash_budget[time],
"day requirment %s" % investments_targets[time])
for index in range(len(investments_targets)):
m.addConstr(
invesestment_assignment[index] <= 1, "varaible %s" % investments_targets[index])
m.optimize()
for v in m.getVars():
print (v.varName, v.x)
print (m.getObjective().getValue())
InΒ [Β ]: