set ASSETS; # Set of assets param mean_return{ASSETS}; # Expected returns of the assets param variance{ASSETS}; # Variance of each asset param covar{ASSETS, ASSETS}; # Covariance between the assets param min_return; # Minimum required return param total_investment = 1; # Total investment, normalized to 1 (100%) param upper_bound{ASSETS}; # Upper bound on investment in each asset
var x{ASSETS} >= 0, <= upper_bound; # Fraction invested in each asset
# Objective: Minimize portfolio variance (risk) minimize risk: sum{i in ASSETS, j in ASSETS} x[i] * covar[i,j] * x[j];
# Constraint: Achieve at least the minimum required return subject to return_constraint: sum{i in ASSETS} x[i] * mean_return[i] >= min_return;
# Constraint: The total sum of investments should equal 1 (100%) subject to budget_constraint: sum{i in ASSETS} x[i] = total_investment;
*For illustrative purposes only – used to gain understanding of AMPL syntax in action.
Start Optimizing Your Financial Decisions Today
View our price list, or speak to our team for tailored solutions and custom packages for your business.