## Problem Description and Formulation

The problem is a linear programming optimization problem. The goal is to maximize the profit of a hostel by determining the number of heated and unheated rooms to sell, given certain constraints.

### Decision Variables

- $x$: Number of heated rooms sold
- $y$: Number of unheated rooms sold

### Objective Function

The profit per heated room is $50, and the profit per unheated room is $35. The objective is to maximize the total profit:

Maximize: $50x + 35y$

### Constraints

1. **Total Rooms Available**: The hostel has 40 rooms available.
   - $x + y \leq 40$

2. **Minimum Heated Rooms**: The hostel reserves at least 15 rooms to be heated.
   - $x \geq 15$

3. **Preference for Unheated Rooms**: At least 4 times as many people prefer unheated rooms to heated rooms.
   - $y \geq 4x$

4. **Non-Negativity**: The number of rooms cannot be negative.
   - $x \geq 0, y \geq 0$

Since $x \geq 15$ is given, the non-negativity constraint for $x$ is implicitly satisfied.

## Gurobi Code

```python
import gurobi

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

    # Decision variables
    x = model.addVar(lb=0, name="heated_rooms")
    y = model.addVar(lb=0, name="unheated_rooms")

    # Objective function: Maximize profit
    model.setObjective(50 * x + 35 * y, gurobi.GRB.MAXIMIZE)

    # Constraints
    model.addConstr(x + y <= 40, name="total_rooms")
    model.addConstr(x >= 15, name="min_heated_rooms")
    model.addConstr(y >= 4 * x, name="preference_unheated")

    # Optimize
    model.optimize()

    # Print solution
    if model.status == gurobi.GRB.OPTIMAL:
        print(f"Optimal profit: ${model.objVal:.2f}")
        print(f"Heated rooms: {x.varValue:.0f}")
        print(f"Unheated rooms: {y.varValue:.0f}")
    else:
        print("No optimal solution found.")

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

This code defines the optimization problem using Gurobi's Python interface, solves it, and prints out the optimal solution if one exists.