## Problem Description and Formulation

The problem described is a linear programming optimization problem. We need to maximize the profit by determining the number of regular speakers and portable speakers to be produced by Team A and Team B, respectively, under given constraints.

Let's define the variables:
- \(R\): Number of regular speakers produced by Team A.
- \(P\): Number of portable speakers produced by Team B.

The constraints are:
1. Team A can make at most 120 regular speakers per day: \(R \leq 120\).
2. Team B can make at most 200 portable speakers per day: \(P \leq 200\).
3. The shared testing machine can be used to make a maximum of 300 total speakers per day: \(R + P \leq 300\).
4. Non-negativity constraints: \(R \geq 0, P \geq 0\).

The objective function to maximize profit is:
\[ \text{Maximize:} \quad 40R + 60P \]

## Gurobi Code

```python
import gurobi

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

    # Define variables
    R = model.addVar(lb=0, ub=120, name="Regular_Speakers")
    P = model.addVar(lb=0, ub=200, name="Portable_Speakers")

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

    # Constraints
    model.addConstr(R <= 120, name="Team_A_constraint")
    model.addConstr(P <= 200, name="Team_B_constraint")
    model.addConstr(R + P <= 300, name="Testing_Machine_constraint")

    # Optimize the model
    model.optimize()

    # Print the results
    if model.status == gurobi.GRB.OPTIMAL:
        print(f"Optimal solution found.")
        print(f"Number of regular speakers to produce: {R.varValue}")
        print(f"Number of portable speakers to produce: {P.varValue}")
        print(f"Maximum profit: ${40*R.varValue + 60*P.varValue}")
    else:
        print("No optimal solution found.")

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