## Problem Description and Formulation

The farmer has 80 acres of land and wants to maximize profit by growing apple trees and orange trees. The requirements and profits for each type of tree are as follows:

- Apple trees: 30 kg of special soil per acre, profit of $500 per acre
- Orange trees: 25 kg of special soil per acre, profit of $450 per acre

The farmer only has 2200 kg of special soil available.

## Decision Variables

Let \(A\) be the number of acres for apple trees and \(O\) be the number of acres for orange trees.

## Objective Function

The objective is to maximize profit: \(500A + 450O\)

## Constraints

1. Land constraint: \(A + O \leq 80\)
2. Soil constraint: \(30A + 25O \leq 2200\)
3. Non-negativity constraints: \(A \geq 0, O \geq 0\)

## Gurobi Code

```python
import gurobi

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

    # Define the decision variables
    A = model.addVar(lb=0, name="Apple_acres")
    O = model.addVar(lb=0, name="Orange_acres")

    # Objective function: Maximize profit
    model.setObjective(500*A + 450*O, gurobi.GRB.MAXIMIZE)

    # Land constraint
    model.addConstr(A + O <= 80, name="Land_constraint")

    # Soil constraint
    model.addConstr(30*A + 25*O <= 2200, name="Soil_constraint")

    # Optimize the model
    model.optimize()

    # Check if the model is optimized
    if model.status == gurobi.GRB.OPTIMAL:
        print(f"Optimal acres for Apple trees: {A.varValue}")
        print(f"Optimal acres for Orange trees: {O.varValue}")
        print(f"Maximal profit: {model.objVal}")
    else:
        print("The model is infeasible")

# Run the function
solve_farmers_problem()
```