## 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 \$1 billion.

You can buy:

Big Russian engines. There are only three in the world and the Russians want \$400 million for each of them. Buying one will reduce the trip time by 200 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 \$140 million large-scale engines in the world. Each will consume 5,000 kilograms of xenon during the trip. There are 30,000 kg of xenon available worldwide at a price of \$2,000/kg, so 5,000 kg costs \$10 million. Bottom line: For each \$150 million fully fueled xenon engine you buy, you can take 50 days off of the trip. Light payloads. For \$50 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 25 days. What’s your best strategy to get there first?

## Solution

```
from itertools import product
#Number available
= 3
num_re = 8
num_ie = 4
num_ft = 6 #30000/5000
num_xe
#Costs in millions
= 400
re_cost = 140
ie_cost = 50
ft_cost = 10
xe_cost
#Savings in days
= 50
ie_saving = 25
ft_saving = {0:0, 1:200, 2:300, 3:500}
re_saving
#Available loan
= 1000
loan
=[]
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)):
= f*ft_saving + min(x, i)*ie_saving + re_saving[r]
days_saved = f*ft_cost + i*ie_cost + r*re_cost + x*xe_cost
total_cost = (num_ft-f)*ft_saving + \
days_savings_avlbl 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