## Problem Description and Formulation

The problem is a linear programming optimization problem. The goal is to maximize the total number of viewers by choosing the optimal number of newspaper ads, radio ads, and television ads, given certain constraints.

### Decision Variables

- $x_1$: Number of newspaper ads
- $x_2$: Number of radio ads
- $x_3$: Number of television ads

### Objective Function

The objective is to maximize the total number of viewers. Given that:
- A newspaper ad attracts 5000 viewers.
- A radio ad attracts 1000 viewers.
- A television ad attracts 8000 viewers.

The objective function can be formulated as:
\[ \text{Maximize:} \quad 5000x_1 + 1000x_2 + 8000x_3 \]

### Constraints

1. **Budget Constraint**: The total cost of the ads should not exceed $100,000.
   - Cost of a newspaper ad: $1200
   - Cost of a radio ad: $500
   - Cost of a television ad: $2000
   \[ 1200x_1 + 500x_2 + 2000x_3 \leq 100,000 \]

2. **Radio Ad Limitation**: The number of radio ads should not exceed 10.
   \[ x_2 \leq 10 \]

3. **Television Ad Limitation**: At most a third of the total number of ads should be television ads.
   \[ x_3 \leq \frac{1}{3}(x_1 + x_2 + x_3) \]
   Simplifying:
   \[ 3x_3 \leq x_1 + x_2 + x_3 \]
   \[ 2x_3 \leq x_1 + x_2 \]

4. **Newspaper Ad Requirement**: At least 20% of the ads should be newspaper ads.
   \[ x_1 \geq 0.20(x_1 + x_2 + x_3) \]
   Simplifying:
   \[ 5x_1 \geq x_1 + x_2 + x_3 \]
   \[ 4x_1 \geq x_2 + x_3 \]

5. **Non-Negativity Constraint**: The number of ads cannot be negative.
   \[ x_1, x_2, x_3 \geq 0 \]
   And since $x_1, x_2, x_3$ represent the number of ads, they should also be integers.

## Gurobi Code

```python
import gurobi

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

    # Define the variables
    x1 = model.addVar(name="newspaper_ads", vtype=gurobi.GRB.INTEGER)
    x2 = model.addVar(name="radio_ads", vtype=gurobi.GRB.INTEGER)
    x3 = model.addVar(name="television_ads", vtype=gurobi.GRB.INTEGER)

    # Objective function: Maximize the total number of viewers
    model.setObjective(5000*x1 + 1000*x2 + 8000*x3, gurobi.GRB.MAXIMIZE)

    # Budget constraint
    model.addConstr(1200*x1 + 500*x2 + 2000*x3 <= 100000, name="budget_constraint")

    # Radio ad limitation
    model.addConstr(x2 <= 10, name="radio_limitation")

    # Television ad limitation
    model.addConstr(2*x3 <= x1 + x2, name="television_limitation")

    # Newspaper ad requirement
    model.addConstr(4*x1 >= x2 + x3, name="newspaper_requirement")

    # Non-negativity constraints (implicit for Gurobi with vtype=INTEGER)

    # Solve the model
    model.optimize()

    if model.status == gurobi.GRB.Status.OPTIMAL:
        print("Optimal Solution:")
        print(f"Newspaper Ads: {x1.varValue}")
        print(f"Radio Ads: {x2.varValue}")
        print(f"Television Ads: {x3.varValue}")
        print(f"Max Viewers: {5000*x1.varValue + 1000*x2.varValue + 8000*x3.varValue}")
    else:
        print("The model is infeasible")

solve_ads_optimization()
```