Math Problem Statement

Solve the following problem using sagemath :

A pension fund of $42 million is available for investment across treasury notes, bonds, and stocks. Administration guidelines mandate a minimum investment of $3 million in each category, with at least half of the total funds allocated to treasury notes and bonds. Additionally, the investment in bonds must not exceed twice the investment in treasury notes. The annual yields are 7% for treasury notes, 9% for bonds, and 10% for stocks. Find how the allocation of funds should be optimized to maximize returns using the following steps:

(a) Formulate this problem as a linear programming problem and write the resulting equations (in a sagemath markdown cell).

Solution

To solve this problem using SageMath, we first need to formulate it as a linear programming problem. Here are the steps and equations:

Step-by-Step Formulation

  1. Define Variables:

    • Let xx be the amount (in million dollars) invested in treasury notes.
    • Let yy be the amount (in million dollars) invested in bonds.
    • Let zz be the amount (in million dollars) invested in stocks.
  2. Objective Function:

    • The goal is to maximize the annual yield from the investments.
    • Annual yield from treasury notes: 0.07x0.07x
    • Annual yield from bonds: 0.09y0.09y
    • Annual yield from stocks: 0.10z0.10z
    • Objective function to maximize: 0.07x+0.09y+0.10z0.07x + 0.09y + 0.10z
  3. Constraints:

    • Total investment: x+y+z=42x + y + z = 42
    • Minimum investment of $3 million in each category: x3x \geq 3, y3y \geq 3, z3z \geq 3
    • At least half of the total funds in treasury notes and bonds: x+y21x + y \geq 21
    • Investment in bonds does not exceed twice the investment in treasury notes: y2xy \leq 2x

Formulating in SageMath Markdown Cell

Below is the SageMath code to solve this linear programming problem:

sagemath
# Import the necessary library from sage.numerical.mip import MIPSolverException, MixedIntegerLinearProgram # Create a new mixed integer linear program p = MixedIntegerLinearProgram(maximization=True) # Define the variables x = p.new_variable(real=True, nonnegative=True) y = p.new_variable(real=True, nonnegative=True) z = p.new_variable(real=True, nonnegative=True) # Set the objective function p.set_objective(0.07 * x + 0.09 * y + 0.10 * z) # Add the constraints p.add_constraint(x + y + z == 42) p.add_constraint(x >= 3) p.add_constraint(y >= 3) p.add_constraint(z >= 3) p.add_constraint(x + y >= 21) p.add_constraint(y <= 2 * x) # Solve the problem try: p.solve() optimal_x = p.get_values(x) optimal_y = p.get_values(y) optimal_z = p.get_values(z) print(f"Optimal investment in treasury notes: ${optimal_x[x]} million") print(f"Optimal investment in bonds: ${optimal_y[y]} million") print(f"Optimal investment in stocks: ${optimal_z[z]} million") print(f"Maximum annual return: ${p.get_objective_value()} million") except MIPSolverException: print("No feasible solution found.")

By running this code in a SageMath environment, you can find the optimal allocation of funds to maximize the annual return.

Do you have any questions or need further details?

Here are some more questions you can ask:

  1. How can I modify this SageMath code to add more constraints?
  2. What are the key differences between linear programming and integer programming?
  3. How does SageMath handle linear programming problems internally?
  4. Can you provide an example of a linear programming problem with different constraints?
  5. What other tools or software can be used to solve linear programming problems?

Tip: When formulating linear programming problems, clearly define your variables, objective function, and constraints to ensure accuracy in modeling and solving the problem.