## Problem Description and Formulation

The TrainAcrossCanada (TAC) problem is a linear programming optimization problem. The goal is to maximize the profit by determining the number of sleeper class and regular tickets to sell.

Let's define the decision variables:

- $x_s$: Number of sleeper class tickets sold
- $x_r$: Number of regular tickets sold

The objective function to maximize the profit is:
\[ \text{Maximize:} \quad 500x_s + 200x_r \]

Subject to the following constraints:

1. Total capacity constraint: $x_s + x_r \leq 400$
2. Preference constraint: $x_r \geq 5x_s$
3. Sleeper class reservation constraint: $x_s \geq 50$
4. Non-negativity constraints: $x_s \geq 0, x_r \geq 0$

## Gurobi Code

```python
import gurobi

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

    # Define the decision variables
    x_s = model.addVar(lb=0, name="Sleeper_Class_Tickets")
    x_r = model.addVar(lb=0, name="Regular_Tickets")

    # Objective function: Maximize profit
    model.setObjective(500 * x_s + 200 * x_r, gurobi.GRB.MAXIMIZE)

    # Total capacity constraint
    model.addConstr(x_s + x_r <= 400, name="Total_Capacity")

    # Preference constraint
    model.addConstr(x_r >= 5 * x_s, name="Preference_Constraint")

    # Sleeper class reservation constraint
    model.addConstr(x_s >= 50, name="Sleeper_Class_Reservation")

    # Optimize the model
    model.optimize()

    # Check if the model is optimized
    if model.status == gurobi.GRB.OPTIMAL:
        print(f"Optimal Solution:")
        print(f"Sleeper Class Tickets: {x_s.varValue}")
        print(f"Regular Tickets: {x_r.varValue}")
        print(f"Maximum Profit: {model.objVal}")
    else:
        print("The model is infeasible.")

train_across_canada()
```