## Problem Description and Formulation

The problem is a linear programming optimization problem. The goal is to maximize earnings from investments in two vaccine companies, M and P, given certain constraints.

### Variables
- \(x_M\): The amount of money invested in company M.
- \(x_P\): The amount of money invested in company P.

### Objective Function
The objective is to maximize the total earnings from both investments. The earnings from company M are 9% of \(x_M\), and from company P are 12% of \(x_P\). Therefore, the objective function can be written as:
\[ \text{Maximize:} \quad 0.09x_M + 0.12x_P \]

### Constraints
1. **Total Investment Limit:** The total investment in both companies cannot exceed $100,000.
\[ x_M + x_P \leq 100,000 \]
2. **Investment Ratio:** The investment in company M must be at least three times the investment in company P.
\[ x_M \geq 3x_P \]
3. **Company M Investment Limit:** The investment in company M cannot exceed $80,000.
\[ x_M \leq 80,000 \]
4. **Non-Negativity:** Investments in both companies must be non-negative.
\[ x_M \geq 0, \quad x_P \geq 0 \]

## Gurobi Code

```python
import gurobi

def solve_investment_problem():
    # Create a new model
    model = gurobi.Model()

    # Define variables
    x_M = model.addVar(lb=0, name="Investment_M")
    x_P = model.addVar(lb=0, name="Investment_P")

    # Objective function: Maximize earnings
    model.setObjective(0.09 * x_M + 0.12 * x_P, gurobi.GRB.MAXIMIZE)

    # Constraints
    model.addConstr(x_M + x_P <= 100000, name="Total_Investment")
    model.addConstr(x_M >= 3 * x_P, name="Investment_Ratio")
    model.addConstr(x_M <= 80000, name="Company_M_Limit")

    # Optimize
    model.optimize()

    # Print solution
    if model.status == gurobi.GRB.OPTIMAL:
        print(f"Optimal investment in M: ${x_M.x:.2f}")
        print(f"Optimal investment in P: ${x_P.x:.2f}")
        print(f"Max earnings: ${0.09 * x_M.x + 0.12 * x_P.x:.2f}")
    else:
        print("No optimal solution found.")

solve_investment_problem()
```