Here's the formulation of the linear program and the Gurobi code to solve it:

**Decision Variables:**

*  `x`: Number of batches of chocolate chip cookies
*  `y`: Number of batches of oatmeal cookies

**Objective Function:**

Maximize profit: `12x + 15y`

**Constraints:**

* Ingredient gathering: `10x + 8y <= 1000`
* Mixing: `20x + 15y <= 1200`
* Baking: `50x + 30y <= 3000`
* Non-negativity: `x >= 0`, `y >= 0`


```python
import gurobipy as gp

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

# Create variables
x = m.addVar(vtype=gp.GRB.CONTINUOUS, name="chocolate_chip")
y = m.addVar(vtype=gp.GRB.CONTINUOUS, name="oatmeal")

# Set objective
m.setObjective(12*x + 15*y, gp.GRB.MAXIMIZE)

# Add constraints
m.addConstr(10*x + 8*y <= 1000, "ingredient_gathering")
m.addConstr(20*x + 15*y <= 1200, "mixing")
m.addConstr(50*x + 30*y <= 3000, "baking")

# Optimize model
m.optimize()

# Print results
if m.status == gp.GRB.OPTIMAL:
    print(f"Optimal profit: {m.objVal}")
    print(f"Chocolate Chip Cookies: {x.x}")
    print(f"Oatmeal Cookies: {y.x}")
elif m.status == gp.GRB.INFEASIBLE:
    print("The problem is infeasible.")
else:
    print(f"Optimization terminated with status {m.status}")

```
