## Problem Description and Formulation

The problem is a linear programming optimization problem. The goal is to maximize the profit from selling potatoes and pumpkins under certain constraints.

### Variables
- $x$: the number of potatoes sold
- $y$: the number of pumpkins sold

### Objective Function
The profit from selling $x$ potatoes is $1.5x$ and from selling $y$ pumpkins is $2.8y$. Therefore, the total profit $P$ to be maximized is given by:
\[ P = 1.5x + 2.8y \]

### Constraints
1. **Budget Constraint**: The total cost of potatoes and pumpkins should not exceed $1000. Given that a potato costs $0.50 and a pumpkin costs $0.90, we have:
\[ 0.50x + 0.90y \leq 1000 \]

2. **Pumpkin to Potato Ratio Constraint**: The number of pumpkins sold is at most a third of the number of potatoes sold:
\[ y \leq \frac{1}{3}x \]

3. **Potato Sales Constraints**: At least 250 but at most 800 potatoes are sold:
\[ 250 \leq x \leq 800 \]

4. **Non-Negativity Constraints**: The number of potatoes and pumpkins sold cannot be negative:
\[ x \geq 0, y \geq 0 \]

However, given the constraints on $x$, the non-negativity of $x$ and $y$ is implicitly handled.

## Gurobi Code Formulation

```python
import gurobi

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

    # Define variables
    x = model.addVar(lb=250, ub=800, name="potatoes")  # At least 250, at most 800 potatoes
    y = model.addVar(lb=0, name="pumpkins")  # Non-negative number of pumpkins

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

    # Budget constraint
    model.addConstr(0.50 * x + 0.90 * y <= 1000, name="budget_constraint")

    # Pumpkin to potato ratio constraint
    model.addConstr(y <= (1/3) * x, name="pumpkin_to_potato_ratio")

    # Solve the model
    model.optimize()

    # Check if the model is optimized
    if model.status == gurobi.GRB.OPTIMAL:
        print(f"Optimal number of potatoes: {x.varValue}")
        print(f"Optimal number of pumpkins: {y.varValue}")
        print(f"Maximal profit: {model.objVal}")
    else:
        print("The model is infeasible.")

solve_optimization_problem()
```

This code defines the optimization problem using Gurobi's Python interface, sets up the objective function and constraints according to the problem description, and solves the linear programming problem to find the optimal number of potatoes and pumpkins Cooper should sell to maximize his profit.