## Problem Description and Formulation

The record company has a budget of $400,000 to invest in two artists: a pop artist and a rapper. The investment is subject to the following constraints:

1. The total investment is $400,000.
2. The amount invested in the pop artist must be at least three times the amount invested in the rapper.
3. The amount invested in the pop artist can be at most $250,000.

The earnings from the investments are as follows:

- The money invested in the rapper earns 5%.
- The money invested in the pop artist earns 3%.

The goal is to maximize the total earnings from the investments.

## Symbolic Representation

Let's denote:
- \(x\) as the amount invested in the rapper.
- \(y\) as the amount invested in the pop artist.

The problem can be formulated as follows:

### Objective Function
Maximize the total earnings: \(0.05x + 0.03y\)

### Constraints
1. \(x + y \leq 400,000\) (Total investment constraint)
2. \(y \geq 3x\) (Pop artist investment constraint)
3. \(y \leq 250,000\) (Pop artist maximum investment constraint)
4. \(x \geq 0\) and \(y \geq 0\) (Non-negativity constraints)

## Gurobi Code

```python
import gurobi

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

    # Define variables
    x = model.addVar(lb=0, name="rapper_investment")  # Investment in rapper
    y = model.addVar(lb=0, name="pop_artist_investment")  # Investment in pop artist

    # Objective function: Maximize earnings
    model.setObjective(0.05 * x + 0.03 * y, gurobi.GRB.MAXIMIZE)

    # Constraints
    model.addConstr(x + y <= 400000, name="total_investment_constraint")
    model.addConstr(y >= 3 * x, name="pop_artist_min_investment_constraint")
    model.addConstr(y <= 250000, name="pop_artist_max_investment_constraint")

    # Optimize model
    model.optimize()

    # Print solution
    if model.status == gurobi.GRB.OPTIMAL:
        print(f"Optimal investment in rapper: ${x.varValue:.2f}")
        print(f"Optimal investment in pop artist: ${y.varValue:.2f}")
        print(f"Total earnings: ${0.05 * x.varValue + 0.03 * y.varValue:.2f}")
    else:
        print("No optimal solution found.")

solve_investment_problem()
```