Problem
You are the CEO of a space transport company in the year 2080, and your chief scientist comes in to tell you that one of your space probes has detected an alien artifact at the Jupiter Solar Lagrangian (L2) point.
You want to be the first to get to it! But you know that the story will leak soon and you only have a short time to make critical decisions. With standard technology available to anyone with a few billion dollars, a manned rocket can be quickly assembled and arrive at the artifact in 1,600 days. But with some nonstandard items you can reduce that time and beat the competition. Your accountants tell you that they can get you an immediate line of credit of $ billion.
You can buy:
Big Russian engines. There are only three in the world and the Russians want $ million for each of them. Buying one will reduce the trip time by days. Buying two will allow you to split your payload and will save another 100 days. NASA ion engines. There are only eight of these $ million large-scale engines in the world. Each will consume kilograms of xenon during the trip. There are kg of xenon available worldwide at a price of $ /kg, so kg costs $ million. Bottom line: For each $ million fully fueled xenon engine you buy, you can take 50 days off of the trip. Light payloads. For $ million each, you can send one of four return flight fuel tanks out ahead of the mission, using existing technology. Each time you do this, you lighten the main mission and reduce the arrival time by days. Whatβs your best strategy to get there first?
Solution
from itertools import product
#Number available
num_re = 3
num_ie = 8
num_ft = 4
num_xe = 6 #30000/5000
#Costs in millions
re_cost = 400
ie_cost = 140
ft_cost = 50
xe_cost = 10
#Savings in days
ie_saving = 50
ft_saving = 25
re_saving = {0:0, 1:200, 2:300, 3:500}
#Available loan
loan = 1000
optimal_sols =[]
for r, i, f, x in product(range(num_re+1), range(num_ie+1),
range(num_ft+1), range(num_xe+1)):
days_saved = f*ft_saving + min(x, i)*ie_saving + re_saving[r]
total_cost = f*ft_cost + i*ie_cost + r*re_cost + x*xe_cost
days_savings_avlbl = (num_ft-f)*ft_saving + \
min(num_ie-i, num_xe-x)*ie_saving + re_saving[num_re-r]
if total_cost <= loan and days_saved > days_savings_avlbl:
optimal_sols.append((days_savings_avlbl, days_saved, r, i, f, x))
for dsa, ds, r, i, f , x in optimal_sols:
print("Number of Russian Engines: ", r)
print("Number of Ion Engines: ", i)
print("Number of Fuel Tanks: ", f)
print("Number of Xenon kgs: ", x*5000)
print("Total number of days saved: ", ds)
print("Total day savings available: ", dsa)
print("\n")
Valid combinations
Number of Russian Engines: 1
Number of Ion Engines: 1
Number of Fuel Tanks: 4
Number of Xenon kgs: 30000
Total number of days saved: 350
Total day savings available: 300
Number of Russian Engines: 1
Number of Ion Engines: 2
Number of Fuel Tanks: 3
Number of Xenon kgs: 30000
Total number of days saved: 375
Total day savings available: 325
Number of Russian Engines: 1
Number of Ion Engines: 2
Number of Fuel Tanks: 4
Number of Xenon kgs: 25000
Total number of days saved: 400
Total day savings available: 350
Number of Russian Engines: 1
Number of Ion Engines: 2
Number of Fuel Tanks: 4
Number of Xenon kgs: 30000
Total number of days saved: 400
Total day savings available: 300
Number of Russian Engines: 1
Number of Ion Engines: 3
Number of Fuel Tanks: 2
Number of Xenon kgs: 30000
Total number of days saved: 400
Total day savings available: 350
Number of Russian Engines: 2
Number of Ion Engines: 0
Number of Fuel Tanks: 1
Number of Xenon kgs: 30000
Total number of days saved: 325
Total day savings available: 275
Number of Russian Engines: 2
Number of Ion Engines: 0
Number of Fuel Tanks: 2
Number of Xenon kgs: 25000
Total number of days saved: 350
Total day savings available: 300
Number of Russian Engines: 2
Number of Ion Engines: 0
Number of Fuel Tanks: 2
Number of Xenon kgs: 30000
Total number of days saved: 350
Total day savings available: 250
Number of Russian Engines: 2
Number of Ion Engines: 0
Number of Fuel Tanks: 3
Number of Xenon kgs: 20000
Total number of days saved: 375
Total day savings available: 325
Number of Russian Engines: 2
Number of Ion Engines: 0
Number of Fuel Tanks: 3
Number of Xenon kgs: 25000
Total number of days saved: 375
Total day savings available: 275
Number of Russian Engines: 2
Number of Ion Engines: 1
Number of Fuel Tanks: 0
Number of Xenon kgs: 30000
Total number of days saved: 350
Total day savings available: 300