## Problem Description and Formulation

The hiker needs to purchase two types of berry mixes, A and B, to meet the requirements of at least 150 g of blueberries and 125 g of blackberries while minimizing the cost. Berry mix A contains 30 g of blueberries and 45 g of blackberries per bag, costing $5 per bag. Berry mix B contains 20 g of blueberries and 15 g of blackberries per bag, costing $3 per bag.

## Decision Variables

Let \(x\) be the number of bags of berry mix A and \(y\) be the number of bags of berry mix B that the hiker should purchase.

## Objective Function

The objective is to minimize the total cost, which is \(5x + 3y\).

## Constraints

1. Blueberry constraint: \(30x + 20y \geq 150\)
2. Blackberry constraint: \(45x + 15y \geq 125\)
3. Non-negativity constraints: \(x \geq 0, y \geq 0\)
4. Since the hiker cannot buy a negative number of bags, \(x\) and \(y\) should be integers.

## Gurobi Code

We will use Gurobi's Python interface to model and solve this problem. Note that Gurobi can handle integer programming problems directly, but for simplicity and because the problem doesn't explicitly require integer solutions, we'll first solve it as a linear program and check if the solution is integer-friendly.

```python
import gurobi

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

    # Define variables
    x = model.addVar(name="berry_mix_A", lb=0)  # Number of bags of berry mix A
    y = model.addVar(name="berry_mix_B", lb=0)  # Number of bags of berry mix B

    # Objective function: minimize cost
    model.setObjective(5 * x + 3 * y, gurobi.GRB.MINIMIZE)

    # Constraints
    model.addConstr(30 * x + 20 * y >= 150, name="blueberry_constraint")
    model.addConstr(45 * x + 15 * y >= 125, name="blackberry_constraint")

    # Solve the model
    model.optimize()

    # Print solution
    if model.status == gurobi.GRB.OPTIMAL:
        print(f"Optimal cost: {model.objVal}")
        print(f"Bags of berry mix A: {x.varValue}")
        print(f"Bags of berry mix B: {y.varValue}")
    else:
        print("No optimal solution found")

# Run the function
solve_berry_mix_problem()
```

## Additional Note

For problems requiring integer solutions, you would need to add `model.setParam(gurobi.GRB.Param.Integrality, 1)` before solving, or specifically make `x` and `y` integer variables using `x = model.addVar(name="berry_mix_A", lb=0, vtype=gurobi.GRB.INTEGER)` and similarly for `y`. However, since the problem here does not explicitly state that only integer bags can be bought and solving as an integer program can be computationally more expensive, the above formulation is provided first. If integer solutions are required, adjust the code accordingly.