To solve the optimization problem described, we need to maximize the profit from selling AA and D batteries under the given budget constraint and demand limits. The decision variables will be the number of AA batteries (let's call this \(x\)) and the number of D batteries (let's call this \(y\)). 

The objective function to maximize is the total profit, which can be calculated as \(0.50x + 1y\), given that each AA battery contributes $0.50 to the profit and each D battery contributes $1.

The constraints are:
1. Budget constraint: The cost of purchasing AA batteries at $1 each and D batteries at $3 each must not exceed $1000. This can be represented as \(x + 3y \leq 1000\).
2. Demand constraint for AA batteries: \(x \leq 1000\), since the monthly demand will not exceed 1000.
3. Demand constraint for D batteries: \(y \leq 1000\), for the same reason as above.
4. Non-negativity constraints: Both \(x\) and \(y\) must be non-negative, since you cannot sell a negative number of batteries.

Now, let's formulate this problem in Gurobi code:

```python
from gurobipy import *

# Create a new model
m = Model("Battery_Profit_Optimization")

# Define the decision variables
x = m.addVar(lb=0, vtype=GRB.INTEGER, name="AA_Batteries")
y = m.addVar(lb=0, vtype=GRB.INTEGER, name="D_Batteries")

# Set the objective function: Maximize profit
m.setObjective(0.50*x + 1*y, GRB.MAXIMIZE)

# Add constraints
m.addConstr(x + 3*y <= 1000, "Budget_Constraint")
m.addConstr(x <= 1000, "Demand_AA_Batteries")
m.addConstr(y <= 1000, "Demand_D_Batteries")

# Optimize the model
m.optimize()

# Print the results
if m.status == GRB.OPTIMAL:
    print(f"Optimal solution: x = {x.x}, y = {y.x}")
    print(f"Maximum profit: {m.objVal}")
else:
    print("The model is infeasible")
```