## Problem Description and Formulation

The problem is a linear programming optimization problem. We need to maximize the profit from investing in two companies: a fertilizer company and a pesticide company. The constraints are as follows:

- The total investment should not exceed $5000.
- At least 50% of the investment should be in the fertilizer company.
- At least $1000 should be invested in the pesticide company.

Let's denote:
- \(x_1\) as the amount invested in the fertilizer company,
- \(x_2\) as the amount invested in the pesticide company.

The objective function to maximize profit is:
\[ \text{Maximize:} \quad 0.14x_1 + 0.15x_2 \]

Subject to:
1. \( x_1 + x_2 \leq 5000 \) (total investment not exceeding $5000)
2. \( x_1 \geq 0.5(x_1 + x_2) \) (at least 50% in the fertilizer company)
3. \( x_2 \geq 1000 \) (at least $1000 in the pesticide company)
4. \( x_1, x_2 \geq 0 \) (non-negativity constraint)

## Converting Constraints

The second constraint can be rewritten as:
\[ x_1 \geq 0.5x_1 + 0.5x_2 \]
\[ 0.5x_1 - 0.5x_2 \geq 0 \]
\[ x_1 - x_2 \geq 0 \]

## Gurobi Code

```python
import gurobi

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

    # Define variables
    x1 = model.addVar(lb=0, name="Fertilizer_Investment")
    x2 = model.addVar(lb=0, name="Pesticide_Investment")

    # Objective function: Maximize profit
    model.setObjective(0.14 * x1 + 0.15 * x2, gurobi.GRB.MAXIMIZE)

    # Constraints
    model.addConstr(x1 + x2 <= 5000, name="Total_Investment")
    model.addConstr(x1 - x2 >= 0, name="Fertilizer_Min_Investment")
    model.addConstr(x2 >= 1000, name="Pesticide_Min_Investment")

    # Optimize
    model.optimize()

    # Print solution
    if model.status == gurobi.GRB.OPTIMAL:
        print(f"Optimal investment in fertilizer company: ${x1.varValue:.2f}")
        print(f"Optimal investment in pesticide company: ${x2.varValue:.2f}")
        print(f"Maximal profit: ${0.14 * x1.varValue + 0.15 * x2.varValue:.2f}")
    else:
        print("The problem is infeasible.")

if __name__ == "__main__":
    solve_investment_problem()
```