To solve this problem, we first need to define the decision variables and the objective function. Let's denote the number of heated rooms as \(H\) and the number of unheated rooms as \(U\). The profit per heated room is $50, and the profit per unheated room is $35. We want to maximize the total profit, which can be represented as \(50H + 35U\).

The constraints are:
1. The total number of rooms is 40: \(H + U = 40\)
2. At least 15 rooms must be heated: \(H \geq 15\)
3. At least 4 times as many people prefer unheated rooms to heated rooms: \(U \geq 4H\)

Given these constraints, we aim to find the values of \(H\) and \(U\) that maximize the profit.

Here's how we can translate this into Gurobi code in Python:

```python
from gurobipy import *

# Create a model
m = Model("Hostel_Rooms")

# Define variables
H = m.addVar(lb=0, vtype=GRB.INTEGER, name="Heated_Rooms")
U = m.addVar(lb=0, vtype=GRB.INTEGER, name="Unheated_Rooms")

# Objective function: Maximize profit
m.setObjective(50*H + 35*U, GRB.MAXIMIZE)

# Constraints
m.addConstr(H + U == 40, "Total_Rooms")
m.addConstr(H >= 15, "Min_Heated_Rooms")
m.addConstr(U >= 4*H, "Unheated_vs_Heated")

# Optimize the model
m.optimize()

# Print results
if m.status == GRB.OPTIMAL:
    print("Optimal solution found:")
    print(f"Heated Rooms: {H.x}")
    print(f"Unheated Rooms: {U.x}")
    print(f"Total Profit: ${50*H.x + 35*U.x:.2f}")
else:
    print("No optimal solution found")
```