## Problem Description and Formulation

The problem is a linear programming optimization problem. The goal is to maximize profit by determining the number of first-class and second-class seats to sell on a passenger train.

### Decision Variables

- $x_1$: Number of first-class seats to sell.
- $x_2$: Number of second-class seats to sell.

### Objective Function

The profit made from selling $x_1$ first-class seats and $x_2$ second-class seats is given by $75x_1 + 50x_2$. The objective is to maximize this profit.

### Constraints

1. **Total Passengers**: The train carries at most 500 passengers. Therefore, $x_1 + x_2 \leq 500$.
2. **First-Class Seats Reservation**: The train reserves at least 100 seats for first-class. Hence, $x_1 \geq 100$.
3. **Second-Class Preference**: At least twice as many passengers prefer to travel by second class than by first class. This implies $x_2 \geq 2x_1$.
4. **Non-Negativity**: The number of seats cannot be negative. So, $x_1 \geq 0$ and $x_2 \geq 0$.

However, given that $x_1 \geq 100$ from the second constraint, the non-negativity constraints for $x_1$ and $x_2$ are implicitly satisfied.

## Gurobi Code

```python
import gurobi

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

    # Decision Variables
    x1 = model.addVar(lb=100, name="first_class_seats")  # At least 100 first-class seats
    x2 = model.addVar(name="second_class_seats")

    # Objective Function: Maximize profit
    model.setObjective(75 * x1 + 50 * x2, gurobi.GRB.MAXIMIZE)

    # Constraints
    model.addConstr(x1 + x2 <= 500, name="total_passengers")  # Total passengers constraint
    model.addConstr(x2 >= 2 * x1, name="second_class_preference")  # Second-class preference constraint

    # Solve the model
    model.optimize()

    # Print solution
    if model.status == gurobi.GRB.OPTIMAL:
        print(f"Optimal first-class seats: {x1.varValue}")
        print(f"Optimal second-class seats: {x2.varValue}")
        print(f"Max Profit: ${75 * x1.varValue + 50 * x2.varValue}")
    else:
        print("The model is infeasible.")

if __name__ == "__main__":
    solve_train_seating_problem()
```