## Problem Description and Formulation

The problem is a linear programming optimization problem. The goal is to maximize the profit from selling AA and D batteries given certain constraints.

### Variables:
- \(x\): The number of AA batteries to stock.
- \(y\): The number of D batteries to stock.

### Objective Function:
The profit per AA battery is $0.50, and the profit per D battery is $1. The objective function to maximize profit (\(P\)) is:
\[ P = 0.50x + 1y \]

### Constraints:
1. **Budget Constraint**: The store has a budget of $1000. Each AA battery costs $1, and each D battery costs $3. Therefore:
\[ 1x + 3y \leq 1000 \]

2. **Demand Constraint**: The monthly demand for both batteries will not exceed 1000:
\[ x + y \leq 1000 \]

3. **Non-Negativity Constraints**: The number of batteries cannot be negative:
\[ x \geq 0, y \geq 0 \]

## Gurobi Code

To solve this problem using Gurobi in Python, we will use the following code:

```python
import gurobipy as gp

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

# Define variables
x = model.addVar(name="AA_Batteries", lb=0, ub=1000, vtype=gp.GRB.INTEGER)
y = model.addVar(name="D_Batteries", lb=0, ub=1000, vtype=gp.GRB.INTEGER)

# Objective function: Maximize profit
model.setObjective(0.50 * x + 1 * y, gp.GRB.MAXIMIZE)

# Budget constraint
model.addConstr(x + 3 * y <= 1000, name="Budget_Constraint")

# Demand constraint
model.addConstr(x + y <= 1000, name="Demand_Constraint")

# Solve the model
model.optimize()

# Print the solution
if model.status == gp.GRB.OPTIMAL:
    print(f"Optimal solution: AA Batteries = {x.varValue}, D Batteries = {y.varValue}")
    print(f"Max Profit: {model.objVal}")
else:
    print("The model is infeasible")
```