## Symbolic Representation

Let's denote:
- $x_1$ as the number of regular machines
- $x_2$ as the number of advanced machines

The objective is to minimize the total cost. The cost of a regular machine is $1000, and the cost of an advanced machine is $10000. Therefore, the objective function can be represented as:

Minimize $1000x_1 + 10000x_2$

The constraints are:
1. The factory wants to complete at least 120 tasks per hour. Given that a regular machine can perform 5 tasks per hour and an advanced machine can perform 25 tasks per hour, we have:

$5x_1 + 25x_2 \geq 120$

2. The factory has a maximum of 20 workers. Since a regular machine requires 2 workers and an advanced machine requires 5 workers, we have:

$2x_1 + 5x_2 \leq 20$

3. The number of machines cannot be negative:

$x_1 \geq 0, x_2 \geq 0$

$x_1, x_2$ should be integers (though Gurobi can handle this, it's good to note that in a real-world scenario, you might need to enforce integer solutions).

## Symbolic Representation in JSON

```json
{
    'sym_variables': [('x1', 'regular machines'), ('x2', 'advanced machines')],
    'objective_function': '1000*x1 + 10000*x2',
    'constraints': [
        '5*x1 + 25*x2 >= 120',
        '2*x1 + 5*x2 <= 20',
        'x1 >= 0',
        'x2 >= 0'
    ]
}
```

## Gurobi Code in Python

```python
import gurobi

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

    # Define variables
    x1 = model.addVar(name="regular_machines", lb=0, vtype=gurobi.GRB.INTEGER)
    x2 = model.addVar(name="advanced_machines", lb=0, vtype=gurobi.GRB.INTEGER)

    # Objective function: Minimize 1000*x1 + 10000*x2
    model.setObjective(1000*x1 + 10000*x2, gurobi.GRB.MINIMIZE)

    # Constraints
    model.addConstr(5*x1 + 25*x2 >= 120, name="tasks_per_hour")
    model.addConstr(2*x1 + 5*x2 <= 20, name="workers")

    # Solve the model
    model.optimize()

    # Print the solution
    if model.status == gurobi.GRB.OPTIMAL:
        print(f"Optimal Solution: {x1.varName} = {x1.x}, {x2.varName} = {x2.x}")
        print(f"Objective: {model.objVal}")
    else:
        print("The model is infeasible")

solve_optimization_problem()
```