## Problem Description and Formulation

The problem is a classic example of a linear programming problem. The factory has two types of fabric packages to sell: Package 1 and Package 2. The goal is to maximize profit given the constraints on the availability of blue and red fabrics.

Let's denote:
- \(x_1\) as the number of Package 1 to sell.
- \(x_2\) as the number of Package 2 to sell.

The profit per Package 1 is $50, and per Package 2 is $70. Therefore, the objective function to maximize profit (\(P\)) is:
\[ P = 50x_1 + 70x_2 \]

The constraints are based on the availability of blue and red fabrics:
- Package 1 contains 20 meters of blue fabric and 30 meters of red fabric.
- Package 2 contains 40 meters of blue fabric and 40 meters of red fabric.
- There are 10000 meters of blue fabric and 12000 meters of red fabric available.

So, the constraints are:
\[ 20x_1 + 40x_2 \leq 10000 \] (blue fabric constraint)
\[ 30x_1 + 40x_2 \leq 12000 \] (red fabric constraint)
\[ x_1 \geq 0, x_2 \geq 0 \] (non-negativity constraints, as the number of packages cannot be negative)

## Gurobi Code

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

```python
import gurobi

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

    # Define variables
    x1 = model.addVar(name="Package_1", lb=0, vtype=gurobi.GRB.CONTINUOUS)
    x2 = model.addVar(name="Package_2", lb=0, vtype=gurobi.GRB.CONTINUOUS)

    # Objective function: Maximize profit
    model.setObjective(50 * x1 + 70 * x2, gurobi.GRB.MAXIMIZE)

    # Constraints
    model.addConstr(20 * x1 + 40 * x2 <= 10000, name="blue_fabric_constraint")
    model.addConstr(30 * x1 + 40 * x2 <= 12000, name="red_fabric_constraint")

    # Optimize
    model.optimize()

    # Print solution
    if model.status == gurobi.GRB.OPTIMAL:
        print(f"Optimal solution found. Package 1: {x1.varValue}, Package 2: {x2.varValue}")
        print(f"Max Profit: {model.objVal}")
    else:
        print("No optimal solution found.")

solve_fabric_problem()
```

This code defines a linear programming problem with Gurobi, solves it, and prints out the optimal number of packages to sell and the maximum profit achievable.