## Step 1: Define the optimization problem and the objective function
The goal is to minimize the objective function: $7R^2 + 6RG + RM + 8RP + 3G^2 + 3GM + 4GP + 3M^2 + 6MP + 8P^2 + 2R + 3G + 5M + 4P$, where $R$, $G$, $M$, and $P$ represent the hours worked by Ringo, George, Mary, and Peggy, respectively.

## 2: List all the constraints
The constraints are as follows:
1. $11R \leq 303$
2. $R \leq 174$
3. $14R \leq 218$
4. $10G \leq 303$
5. $2G \leq 174$
6. $17G \leq 218$
7. $17M \leq 303$
8. $17M \leq 174$
9. $16M \leq 218$
10. $19P \leq 303$
11. $18P \leq 174$
12. $13P \leq 218$
13. $11R + 10G \geq 39$
14. $11R^2 + 19P^2 \geq 61$
15. $10G + 17M \geq 68$
16. $11R + 10G + 17M + 19P \geq 68$
17. $R + 2G \geq 22$
18. $R + 17M \geq 14$
19. $17M + 18P \geq 15$
20. $R^2 + G^2 + M^2 \geq 43$
21. $R + 17M + 18P \geq 43$
22. $R^2 + G^2 + M^2 \geq 25$
23. $R + 17M + 18P \geq 25$
24. $R + G + M + P \geq 25$
25. $17G + 13P \geq 24$
26. $14R^2 + 17G^2 \geq 19$
27. $14R + 17G + 16M \geq 40$
28. $14R + 16M + 13P \geq 40$
29. $14R^2 + 17G^2 + 16M^2 \geq 27$
30. $14R^2 + 16M^2 + 13P^2 \geq 27$
31. $14R + 17G + 16M + 13P \geq 27$
32. $6R - 5P \geq 0$
33. $11R + 17M + 13P \leq 299$
34. $10G + 17M + 13P \leq 247$
35. $R + 2G \leq 160$
36. $17M + 18P \leq 115$
37. $14R + 13P \leq 190$
38. $17G^2 + 16M^2 \leq 164$
39. $R$ is continuous
40. $G$ is continuous
41. $M$ is integer
42. $P$ is continuous

## 3: Implement the optimization problem using Gurobi
```python
import gurobi as gp
from gurobi import GRB

# Create a new model
m = gp.Model("optimization_problem")

# Define the variables
R = m.addVar(lb=0, name="Ringo")
G = m.addVar(lb=0, name="George")
M = m.addVar(lb=0, vtype=GRB.INTEGER, name="Mary")
P = m.addVar(lb=0, name="Peggy")

# Define the objective function
m.setObjective(7*R**2 + 6*R*G + R*M + 8*R*P + 3*G**2 + 3*G*M + 4*G*P + 3*M**2 + 6*M*P + 8*P**2 + 2*R + 3*G + 5*M + 4*P, GRB.MINIMIZE)

# Add constraints
m.addConstr(11*R <= 303)
m.addConstr(R <= 174)
m.addConstr(14*R <= 218)
m.addConstr(10*G <= 303)
m.addConstr(2*G <= 174)
m.addConstr(17*G <= 218)
m.addConstr(17*M <= 303)
m.addConstr(17*M <= 174)
m.addConstr(16*M <= 218)
m.addConstr(19*P <= 303)
m.addConstr(18*P <= 174)
m.addConstr(13*P <= 218)
m.addConstr(11*R + 10*G >= 39)
m.addConstr(11*R**2 + 19*P**2 >= 61)
m.addConstr(10*G + 17*M >= 68)
m.addConstr(11*R + 10*G + 17*M + 19*P >= 68)
m.addConstr(R + 2*G >= 22)
m.addConstr(R + 17*M >= 14)
m.addConstr(17*M + 18*P >= 15)
m.addConstr(R**2 + G**2 + M**2 >= 43)
m.addConstr(R + 17*M + 18*P >= 43)
m.addConstr(R**2 + G**2 + M**2 >= 25)
m.addConstr(R + 17*M + 18*P >= 25)
m.addConstr(R + G + M + P >= 25)
m.addConstr(17*G + 13*P >= 24)
m.addConstr(14*R**2 + 17*G**2 >= 19)
m.addConstr(14*R + 17*G + 16*M >= 40)
m.addConstr(14*R + 16*M + 13*P >= 40)
m.addConstr(14*R**2 + 17*G**2 + 16*M**2 >= 27)
m.addConstr(14*R**2 + 16*M**2 + 13*P**2 >= 27)
m.addConstr(14*R + 17*G + 16*M + 13*P >= 27)
m.addConstr(6*R - 5*P >= 0)
m.addConstr(11*R + 17*M + 13*P <= 299)
m.addConstr(10*G + 17*M + 13*P <= 247)
m.addConstr(R + 2*G <= 160)
m.addConstr(17*M + 18*P <= 115)
m.addConstr(14*R + 13*P <= 190)
m.addConstr(17*G**2 + 16*M**2 <= 164)

# Solve the model
m.optimize()

# Print the solution
if m.status == GRB.OPTIMAL:
    print("Objective: ", m.objVal)
    print("Ringo: ", R.varValue)
    print("George: ", G.varValue)
    print("Mary: ", M.varValue)
    print("Peggy: ", P.varValue)
else:
    print("The model is infeasible")
```