## Problem Description and Formulation

The investor has a total of $500,000 to invest in two software companies, A and B. The goal is to maximize earnings given the following constraints:

1. The investor must invest at least two times as much money in company A than in company B.
2. The investor can invest at most $200,000 in company B.
3. The total investment is $500,000.

Let's denote the investment in company A as \(x_A\) and in company B as \(x_B\). The objective is to maximize the total return, which is \(0.09x_A + 0.12x_B\).

## Constraints:

1. \(x_A \geq 2x_B\)
2. \(x_B \leq 200,000\)
3. \(x_A + x_B = 500,000\)
4. \(x_A, x_B \geq 0\)

## Gurobi Code

To solve this problem using Gurobi in Python, we will first import the necessary libraries, then set up the model, add variables and constraints, and finally solve the model.

```python
import gurobi

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

    # Define variables
    x_A = model.addVar(name="Investment_A", lb=0)
    x_B = model.addVar(name="Investment_B", lb=0)

    # Objective: Maximize earnings
    model.setObjective(0.09 * x_A + 0.12 * x_B, gurobi.GRB.MAXIMIZE)

    # Constraints
    model.addConstr(x_A >= 2 * x_B, name="At_least_twice_B")
    model.addConstr(x_B <= 200000, name="B_at_most_200k")
    model.addConstr(x_A + x_B == 500000, name="Total_investment")

    # Solve the model
    model.optimize()

    # Print the results
    if model.status == gurobi.GRB.OPTIMAL:
        print(f"Optimal investment in A: ${x_A.x:.2f}")
        print(f"Optimal investment in B: ${x_B.x:.2f}")
        print(f"Maximized earnings: ${0.09 * x_A.x + 0.12 * x_B.x:.2f}")
    else:
        print("The model is infeasible.")

solve_investment_problem()
```