## Problem Description and Formulation

The problem is a linear programming optimization problem. The goal is to maximize the profit of a keyboard factory that produces regular and mechanical keyboards. The factory faces several constraints:

1. **Demand Constraints:**
   - At least 165 regular keyboards must be made each day.
   - At least 70 mechanical keyboards must be made each day.

2. **Production Constraints:**
   - At most 300 regular keyboards can be made each day.
   - At most 150 mechanical keyboards can be made each day.

3. **Contract Constraint:**
   - At least 250 keyboards of either type must be made each day.

4. **Profit per Unit:**
   - The profit per regular keyboard is $30.
   - The profit per mechanical keyboard is $60.

## Symbolic Representation

Let:
- \(R\) be the number of regular keyboards produced.
- \(M\) be the number of mechanical keyboards produced.

The objective function to maximize profit (\(P\)) is:
\[ P = 30R + 60M \]

Subject to:
1. \( R \geq 165 \)
2. \( M \geq 70 \)
3. \( R \leq 300 \)
4. \( M \leq 150 \)
5. \( R + M \geq 250 \)

## Gurobi Code

```python
import gurobi

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

    # Define variables
    R = model.addVar(lb=0, ub=300, name="Regular_Keyboard")
    M = model.addVar(lb=0, ub=150, name="Mechanical_Keyboard")

    # Objective function: Maximize profit
    model.setObjective(30*R + 60*M, gurobi.GRB.MAXIMIZE)

    # Constraints
    model.addConstr(R >= 165, name="Regular_Demand")
    model.addConstr(M >= 70, name="Mechanical_Demand")
    model.addConstr(R <= 300, name="Regular_Capacity")
    model.addConstr(M <= 150, name="Mechanical_Capacity")
    model.addConstr(R + M >= 250, name="Contract_Requirement")

    # Optimize
    model.optimize()

    # Print solution
    if model.status == gurobi.GRB.OPTIMAL:
        print(f"Optimal Solution:")
        print(f"Regular Keyboards: {R.varValue}")
        print(f"Mechanical Keyboards: {M.varValue}")
        print(f"Max Profit: {model.objVal}")
    else:
        print("No optimal solution found.")

solve_keyboard_factory_problem()
```