## Problem Description and Formulation

The company aims to maximize viewership by purchasing ads in three locations: airports, malls, and movie theatres. Each location has a different cost and expected viewership:

- Airports: $10,000 per ad, 100,000 viewers per ad
- Malls: $3,000 per ad, 40,000 viewers per ad
- Movie Theatres: $2,000 per ad, 10,000 viewers per ad

There are several constraints:
1. The airport authority limits the number of ads from a single company to 5.
2. At most half of the total number of ads should be at movie theatres.
3. At least 30% of the ads should be at malls.
4. The company has a budget of $100,000.

## Decision Variables

Let \(A\), \(M\), and \(T\) be the number of ads placed in airports, malls, and movie theatres, respectively.

## Objective Function

Maximize the total viewership: \(100,000A + 40,000M + 10,000T\).

## Constraints

1. \(A \leq 5\)
2. \(T \leq 0.5(A + M + T)\) or \(T \leq A + M + T - 2T\) which simplifies to \(T \leq A + M\)
3. \(M \geq 0.3(A + M + T)\)
4. \(10,000A + 3,000M + 2,000T \leq 100,000\)
5. \(A, M, T \geq 0\) and are integers.

## Gurobi Code

```python
import gurobipy as gp

# Create a new model
m = gp.Model("Ad_Placement")

# Decision variables
A = m.addVar(lb=0, ub=5, vtype=gp.GRB.INTEGER, name="Airports")
M = m.addVar(lb=0, vtype=gp.GRB.INTEGER, name="Malls")
T = m.addVar(lb=0, vtype=gp.GRB.INTEGER, name="Movie_Theatres")

# Objective: Maximize viewership
m.setObjective(100000*A + 40000*M + 10000*T, gp.GRB.MAXIMIZE)

# Constraints
m.addConstr(A <= 5, name="Airport_Limit")
m.addConstr(T <= A + M, name="Movie_Theatre_Limit")
m.addConstr(M >= 0.3*(A + M + T), name="Mall_Minimum")
m.addConstr(10000*A + 3000*M + 2000*T <= 100000, name="Budget")

# Solve the model
m.optimize()

# Print the results
if m.status == gp.GRB.OPTIMAL:
    print("Optimal Solution:")
    print(f"Airports: {A.varValue}")
    print(f"Malls: {M.varValue}")
    print(f"Movie Theatres: {T.varValue}")
    print(f"Max Viewership: {m.objVal}")
else:
    print("No optimal solution found")
```