## Problem Description and Formulation

The problem is a linear programming optimization problem. The goal is to maximize profit by determining the number of general class tickets and sleeper class tickets to sell, given certain constraints.

### Decision Variables

- $x$: Number of general class tickets sold
- $y$: Number of sleeper class tickets sold

### Objective Function

The profit made per sleeper class ticket is $200, and per general class ticket is $80. The objective is to maximize the total profit:

Maximize: $80x + 200y$

### Constraints

1. The train can carry at most 400 passengers:
   - $x + y \leq 400$

2. The train reserves at least 50 sleeper class tickets:
   - $y \geq 50$

3. At least 1.5 times as many passengers prefer to buy general class tickets than sleeper class tickets:
   - $x \geq 1.5y$

4. Non-negativity constraints (number of tickets cannot be negative):
   - $x \geq 0$
   - $y \geq 0$

However, since $y \geq 50$ and $x \geq 1.5y$, the non-negativity constraints for $x$ and $y$ are implicitly satisfied.

## Gurobi Code

```python
import gurobi

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

    # Decision variables
    x = m.addVar(name="general_class_tickets", lb=0, vtype=gurobi.GRB.INTEGER)
    y = m.addVar(name="sleeper_class_tickets", lb=0, vtype=gurobi.GRB.INTEGER)

    # Objective function: Maximize profit
    m.setObjective(80 * x + 200 * y, gurobi.GRB.MAXIMIZE)

    # Constraints
    m.addConstr(x + y <= 400, name="total_passengers")
    m.addConstr(y >= 50, name="sleeper_class_min")
    m.addConstr(x >= 1.5 * y, name="general_vs_sleeper_ratio")

    # Solve the model
    m.optimize()

    if m.status == gurobi.GRB.Status.OPTIMAL:
        print(f"Optimal Solution: General Class Tickets = {x.varValue}, Sleeper Class Tickets = {y.varValue}")
        print(f"Maximum Profit: ${80 * x.varValue + 200 * y.varValue}")
    else:
        print("The model is infeasible.")

solve_train_ticket_problem()
```