## Problem Description and Formulation

The problem is a classic example of a linear programming problem. The goal is to maximize the profit of a small grocery by determining the optimal number of containers of nuts and candy to prepare, given the available time for weighing and packaging.

Let's define the decision variables:

* $x$: number of containers of nuts
* $y$: number of containers of candy

The objective function is to maximize the profit:

* Profit per container of nuts: $5
* Profit per container of candy: $3
* Total profit: $5x + 3y

The constraints are:

* Weighing time: 10 minutes per container of nuts, 5 minutes per container of candy, and 1000 minutes available
* Packaging time: 5 minutes per container of nuts, 8 minutes per container of candy, and 1500 minutes available
* Non-negativity constraints: $x \geq 0$ and $y \geq 0$

The mathematical formulation is:

Maximize: $5x + 3y$

Subject to:

* $10x + 5y \leq 1000$ (weighing time constraint)
* $5x + 8y \leq 1500$ (packaging time constraint)
* $x \geq 0$ and $y \geq 0$ (non-negativity constraints)

## Gurobi Code

```python
import gurobi

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

    # Define the decision variables
    x = model.addVar(lb=0, name="nuts")  # number of containers of nuts
    y = model.addVar(lb=0, name="candy")  # number of containers of candy

    # Define the objective function
    model.setObjective(5 * x + 3 * y, gurobi.GRB.MAXIMIZE)

    # Define the constraints
    model.addConstr(10 * x + 5 * y <= 1000, name="weighing_time")
    model.addConstr(5 * x + 8 * y <= 1500, name="packaging_time")

    # Optimize the model
    model.optimize()

    # Print the solution
    if model.status == gurobi.GRB.OPTIMAL:
        print("Optimal solution found.")
        print(f"Number of containers of nuts: {x.varValue}")
        print(f"Number of containers of candy: {y.varValue}")
        print(f"Maximum profit: ${model.objVal:.2f}")
    else:
        print("No optimal solution found.")

# Run the optimization problem
solve_optimization_problem()
```