## Problem Description and Formulation

The young entrepreneur has a budget of $1000 to buy t-shirts and sweaters. The goal is to maximize profit by determining how many of each item to buy and sell, given the following constraints:

- Each t-shirt costs $20 and each sweater costs $30.
- Each t-shirt is sold for a profit of $15 and each sweater is sold for a profit of $20.
- At least 20 but at most 40 t-shirts are sold.
- The number of sweaters sold is at most half the number of t-shirts sold.

## Symbolic Representation

Let's denote:
- \(x\) as the number of t-shirts bought and sold.
- \(y\) as the number of sweaters bought and sold.

The objective function to maximize profit is:
\[ \text{Maximize:} \quad 15x + 20y \]

Subject to:
1. Budget constraint: \( 20x + 30y \leq 1000 \)
2. T-shirt sales constraint: \( 20 \leq x \leq 40 \)
3. Sweater sales constraint: \( y \leq \frac{1}{2}x \)
4. Non-negativity constraint: \( x \geq 0, y \geq 0 \)

Since \(x\) and \(y\) represent the number of items, they should also be integers.

## Gurobi Code

```python
import gurobi

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

    # Define variables
    x = model.addVar(lb=0, ub=40, vtype=gurobi.GRB.INTEGER, name="t-shirts")
    y = model.addVar(lb=0, vtype=gurobi.GRB.INTEGER, name="sweaters")

    # Objective function: Maximize profit
    model.setObjective(15*x + 20*y, gurobi.GRB.MAXIMIZE)

    # Budget constraint
    model.addConstr(20*x + 30*y <= 1000, name="budget_constraint")

    # T-shirt sales constraint: at least 20
    model.addConstr(x >= 20, name="min_tshirts_constraint")

    # Sweater sales constraint: at most half the number of t-shirts
    model.addConstr(y <= 0.5*x, name="sweaters_vs_tshirts_constraint")

    # Solve the model
    model.optimize()

    # Print the solution
    if model.status == gurobi.GRB.OPTIMAL:
        print(f"Optimal solution: Buy and sell {x.varValue} t-shirts and {y.varValue} sweaters.")
    else:
        print("No optimal solution found.")

solve_optimization_problem()
```