## Problem Description and Formulation

The problem is a linear programming optimization problem. Andy wants to invest $10 million in two sectors: energy and travel. The energy sector offers a 32% total return, while the travel sector offers a 20% total return. There are constraints on the investment amounts:

- At least 25% of the investment must be in the energy sector.
- At most 50% of the investment can be in the travel sector.

The goal is to maximize the return on investment.

## Symbolic Representation

Let's denote:
- \(E\) as the amount invested in the energy sector.
- \(T\) as the amount invested in the travel sector.

The objective function to maximize the total return is:
\[ \text{Maximize:} \quad 0.32E + 0.20T \]

Subject to:
1. \( E + T = 10,000,000 \) (Total investment is $10 million)
2. \( E \geq 0.25 \times 10,000,000 \) (At least 25% in the energy sector)
3. \( T \leq 0.50 \times 10,000,000 \) (At most 50% in the travel sector)
4. \( E \geq 0, T \geq 0 \) (Non-negativity constraints)

## Converting to Gurobi Code

```python
import gurobipy as gp

# Create a new model
m = gp.Model("Investment_Optimization")

# Define variables
E = m.addVar(name="Energy", lb=0)  # Investment in energy sector
T = m.addVar(name="Travel", lb=0)  # Investment in travel sector

# Objective function: Maximize return
m.setObjective(0.32 * E + 0.20 * T, gp.GRB.MAXIMIZE)

# Constraints
m.addConstr(E + T == 10_000_000, name="Total_Investment")  # Total investment constraint
m.addConstr(E >= 2_500_000, name="Min_Energy")  # Minimum energy sector investment
m.addConstr(T <= 5_000_000, name="Max_Travel")  # Maximum travel sector investment

# Solve the model
m.solve()

# Output solution
if m.status == gp.GRB.OPTIMAL:
    print(f"Optimal investment in energy sector: ${E.varValue}")
    print(f"Optimal investment in travel sector: ${T.varValue}")
    print(f"Max return: ${0.32 * E.varValue + 0.20 * T.varValue}")
else:
    print("The model is infeasible")
```