To solve the given problem, we first need to define the decision variables and the objective function. Let's denote:
- \(x_1\) as the number of days farm 1 operates.
- \(x_2\) as the number of days farm 2 operates.

The objective is to minimize the total cost of operating both farms, which can be represented by the equation:
\[ \text{Minimize} \quad 500x_1 + 400x_2 \]

Given the constraints:
- Farm 1 yields 10 apples, 15 oranges, and 5 pears per day.
- Farm 2 yields 7 apples, 8 oranges, and 9 pears per day.
- The farmer must provide at least 50 apples, 60 oranges, and 55 pears to the market.

We can formulate the following constraints:
1. Apple production constraint: \(10x_1 + 7x_2 \geq 50\)
2. Orange production constraint: \(15x_1 + 8x_2 \geq 60\)
3. Pear production constraint: \(5x_1 + 9x_2 \geq 55\)

Since the farms cannot operate for a negative number of days, we also have:
\[ x_1 \geq 0 \]
\[ x_2 \geq 0 \]

Now, let's translate this formulation into Gurobi code in Python:

```python
from gurobipy import *

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

# Define the decision variables
x1 = m.addVar(lb=0, name="farm1_days")
x2 = m.addVar(lb=0, name="farm2_days")

# Set the objective function
m.setObjective(500*x1 + 400*x2, GRB.MINIMIZE)

# Add constraints
m.addConstr(10*x1 + 7*x2 >= 50, name="apple_constraint")
m.addConstr(15*x1 + 8*x2 >= 60, name="orange_constraint")
m.addConstr(5*x1 + 9*x2 >= 55, name="pear_constraint")

# Optimize the model
m.optimize()

# Print the results
if m.status == GRB.OPTIMAL:
    print("Optimal solution found:")
    print(f"Farm 1 operates for {x1.x} days")
    print(f"Farm 2 operates for {x2.x} days")
    print(f"Total cost: ${m.objVal}")
else:
    print("No optimal solution found")

```