## Problem Description and Formulation

The problem is a classic example of a linear programming problem. John needs to meet his daily nutritional requirements for calcium, potassium, and magnesium by consuming pears and broccoli while minimizing his cost.

Let's define the decision variables:
- \(x\): pounds of pears to eat
- \(y\): pounds of broccoli to eat

The objective is to minimize the total cost:
\[ \text{Minimize:} \quad 6x + 8y \]

Subject to the constraints for the daily nutritional requirements:
- Calcium: \(2x + 4y \geq 15\)
- Potassium: \(5x + 3y \geq 20\)
- Magnesium: \(3x + 6y \geq 17\)
- Non-negativity: \(x \geq 0, y \geq 0\)

## Gurobi Code

```python
import gurobi

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

    # Define the decision variables
    x = model.addVar(lb=0, name="pears")  # pounds of pears
    y = model.addVar(lb=0, name="broccoli")  # pounds of broccoli

    # Objective: Minimize the total cost
    model.setObjective(6*x + 8*y, gurobi.GRB.MINIMIZE)

    # Constraints for the daily nutritional requirements
    model.addConstr(2*x + 4*y >= 15, name="calcium_requirement")
    model.addConstr(5*x + 3*y >= 20, name="potassium_requirement")
    model.addConstr(3*x + 6*y >= 17, name="magnesium_requirement")

    # Optimize the model
    model.optimize()

    # Check if the model is optimized
    if model.status == gurobi.GRB.OPTIMAL:
        print("Optimal Solution:")
        print(f"Pears (pounds): {x.varValue}")
        print(f"Broccoli (pounds): {y.varValue}")
        print(f"Total Cost: ${model.objVal:.2f}")
    else:
        print("The model is infeasible or unbounded.")

# Run the function
solve_nutrition_problem()
```

This code defines the optimization problem using Gurobi's Python interface, solves it, and prints out the optimal amounts of pears and broccoli John should eat to minimize his cost while meeting his nutritional requirements. If the problem is infeasible or unbounded, it will indicate so.