## Problem Description and Formulation

The Curious electronics business wants to determine the level of production of its two hottest digital keyboards: A400 and P500. The goal is to maximize profit given certain constraints.

- Let \(x\) be the number of A400 keyboards produced.
- Let \(y\) be the number of P500 keyboards produced.

## Objective Function

The profit from one A400 keyboard is $35, and from one P500 keyboard is $80. Therefore, the total profit \(P\) can be represented as:
\[ P = 35x + 80y \]

## Constraints

1. **Labour Hours Constraint**: Making one A400 keyboard requires 5 hours of labour, and one P500 keyboard requires 9 hours. The business can spend up to 45 hours a week manufacturing these keyboards. Therefore:
\[ 5x + 9y \leq 45 \]

2. **Demand Forecast Constraint**: The business decides to produce at least three times as many A400 keyboards as P500 ones. Thus:
\[ x \geq 3y \]

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

## Gurobi Code

To solve this linear programming problem using Gurobi in Python, we can use the following code:

```python
import gurobipy as gp

def solve_production_problem():
    # Create a new model
    model = gp.Model("production_problem")

    # Define variables
    x = model.addVar(name="A400", lb=0, vtype=gp.GRB.INTEGER)  # Number of A400 keyboards
    y = model.addVar(name="P500", lb=0, vtype=gp.GRB.INTEGER)  # Number of P500 keyboards

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

    # Constraints
    model.addConstr(5 * x + 9 * y <= 45, name="labour_hours")  # Labour hours constraint
    model.addConstr(x >= 3 * y, name="demand_forecast")  # Demand forecast constraint

    # Solve the model
    model.optimize()

    # Print solution
    if model.status == gp.GRB.OPTIMAL:
        print(f"Optimal production levels: A400 = {x.varValue}, P500 = {y.varValue}")
        print(f"Maximum profit: ${model.objVal:.2f}")
    else:
        print("The problem is infeasible.")

if __name__ == "__main__":
    solve_production_problem()
```

This code defines the problem using Gurobi's Python interface, sets up the objective function and constraints, solves the optimization problem, and prints out the optimal production levels and maximum profit if a feasible solution exists.