## Problem Description and Formulation

The problem is a linear programming optimization problem. The goal is to maximize the points scored by throwing red and blue bean bags at a target. The scoring system awards 5 points for each red bean bag that hits the target and 8 points for each blue bean bag that hits the target.

## Decision Variables

Let \(R\) be the number of red bean bags thrown and \(B\) be the number of blue bean bags thrown.

## Objective Function

The objective is to maximize the total points scored, which can be represented as:
\[ \text{Maximize:} \quad 5R + 8B \]

## Constraints

1. **Minimum Number of Bean Bags**: At least 3 red bean bags and 2 blue bean bags must be thrown.
\[ R \geq 3 \]
\[ B \geq 2 \]

2. **Maximum Number of Bean Bags**: At most 8 of either type of bean bag can be thrown.
\[ R \leq 8 \]
\[ B \leq 8 \]

3. **Total Number of Bean Bags**: Exactly 12 bean bags must be thrown in total.
\[ R + B = 12 \]

## Gurobi Code

Here is the Gurobi code in Python that captures the problem description and provides a solution:

```python
import gurobi

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

    # Define the decision variables
    R = model.addVar(lb=3, ub=8, name="Red_Bean_Bags", vtype=gurobi.GRB.INTEGER)
    B = model.addVar(lb=2, ub=8, name="Blue_Bean_Bags", vtype=gurobi.GRB.INTEGER)

    # Objective function: Maximize 5R + 8B
    model.setObjective(5 * R + 8 * B, gurobi.GRB.MAXIMIZE)

    # Constraint: R + B = 12
    model.addConstr(R + B == 12, name="Total_Bean_Bags")

    # Solve the model
    model.optimize()

    # Check if the model is optimized
    if model.status == gurobi.GRB.OPTIMAL:
        print(f"Optimal solution: Red Bean Bags = {R.varValue}, Blue Bean Bags = {B.varValue}")
        print(f"Maximum points: {5 * R.varValue + 8 * B.varValue}")
    else:
        print("The model is infeasible.")

solve_bean_bag_problem()
```

This code defines the optimization problem using Gurobi's Python interface, sets up the objective function and constraints, and solves the model. If the model is feasible, it prints out the optimal number of red and blue bean bags to throw and the maximum points that can be scored.