To solve this optimization problem, we first need to define the decision variables and the objective function. Let's denote:

- \(x_f\) as the amount invested in the fertilizer company.
- \(x_p\) as the amount invested in the pesticide company.

The objective is to maximize profit, given by \(0.14x_f + 0.15x_p\), subject to several constraints:

1. The total investment cannot exceed $5000: \(x_f + x_p \leq 5000\).
2. At least 50% of the total investment must be in the fertilizer company: \(x_f \geq 0.5(x_f + x_p)\) or equivalently, \(x_f \geq 0.5x_f + 0.5x_p\), which simplifies to \(x_f \geq x_p\).
3. At least $1000 must be invested in the pesticide company: \(x_p \geq 1000\).

However, upon closer examination, we see that the constraint \(x_f \geq x_p\) derived from ensuring at least 50% investment in fertilizer might not fully capture the intent if the total investment is less than $2000 (since investing exactly 50% or more in fertilizer under such conditions could violate other constraints). The correct formulation should ensure that if Fred invests \(x\) dollars, then \(0.5x \leq x_f\), but given he must invest at least $1000 in pesticides, the constraint essentially becomes ensuring that the portion invested in fertilizers is at least 50% of the total amount invested, considering the minimum pesticide investment.

Let's proceed to formulate this problem correctly and then translate it into Gurobi code:

Given:
- Decision variables: \(x_f\) (amount invested in fertilizer), \(x_p\) (amount invested in pesticide)
- Objective function: Maximize \(0.14x_f + 0.15x_p\)

Constraints:
1. \(x_f + x_p \leq 5000\)
2. \(x_f \geq 0.5(x_f + x_p)\) simplifies to \(x_f \geq x_p\) but should be understood in the context of total investment.
3. \(x_p \geq 1000\)

The constraint that at least 50% of the investment goes into fertilizer can also be represented as \(x_f \geq 0.5 \times 5000 = 2500\) when considering the maximum possible investment, but this overlooks the dynamic nature based on \(x_p\). So, we stick with \(x_f + x_p \leq 5000\) and ensure \(x_p \geq 1000\), recognizing that to satisfy both the 50% condition and the minimum pesticide investment, our feasible region will be constrained further.

Now, translating this into Gurobi code in Python:

```python
from gurobipy import *

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

# Define decision variables
x_f = m.addVar(name='fertilizer_investment', lb=0)
x_p = m.addVar(name='pesticide_investment', lb=0)

# Objective function: Maximize profit
m.setObjective(0.14*x_f + 0.15*x_p, GRB.MAXIMIZE)

# Constraints
m.addConstr(x_f + x_p <= 5000, name='total_investment_limit')
m.addConstr(x_f >= 0.5*(x_f + x_p), name='fertilizer_percentage_minimum')
m.addConstr(x_p >= 1000, name='pesticide_minimum_investment')

# Optimize the model
m.optimize()

# Print results
for v in m.getVars():
    print(f"{v.varName}: {v.x}")

print(f"Objective Function Value: {m.objVal}")
```