To solve this optimization problem, we need to define the decision variables, objective function, and constraints. Let's denote the number of red bean bags as $r$ and the number of blue bean bags as $b$. The objective is to maximize the total points earned from throwing these bean bags.

The objective function can be written as:
\[ \text{Maximize:} \quad 5r + 8b \]

We have several constraints based on the problem description:

1. Throw at least 3 red bean bags and 2 blue bean bags:
\[ r \geq 3 \]
\[ b \geq 2 \]

2. Throw at most 8 of either type:
\[ r \leq 8 \]
\[ b \leq 8 \]

3. In total, throw 12 bean bags:
\[ r + b = 12 \]

Given these constraints and the objective function, we can formulate this as a linear programming problem.

Here is how you can represent this problem in Gurobi using Python:

```python
from gurobipy import *

# Create a new model
m = Model("Bean_Bags_Optimization")

# Define variables
r = m.addVar(vtype=GRB.INTEGER, name="red_bean_bags", lb=3, ub=8)
b = m.addVar(vtype=GRB.INTEGER, name="blue_bean_bags", lb=2, ub=8)

# Set the objective function
m.setObjective(5*r + 8*b, GRB.MAXIMIZE)

# Add constraints
m.addConstr(r + b == 12, "total_bean_bags")

# Optimize model
m.optimize()

# Print solution
if m.status == GRB.OPTIMAL:
    print("Optimal solution found:")
    print(f"Red Bean Bags: {r.x}")
    print(f"Blue Bean Bags: {b.x}")
    print(f"Total Points: {5*r.x + 8*b.x}")
else:
    print("No optimal solution found")
```