Class ConstrainedPortfolioOptimizer
java.lang.Object
com.quantfinlib.optimization.ConstrainedPortfolioOptimizer
Constrained long-only optimiser: per-asset weight bounds (position caps
and floors) and an optional turnover penalty against current holdings,
adjusted return = μ'w − τ·Σ|w − w_current|, so the optimiser
trades expected gain against the cost of getting there. Both problems are
solved exactly with QuadraticProgram; turnover is linearised by
the split w − w_current = u − v, u, v ≥ 0.
maxSharpe(double):max (μ'w − τ·T(w) − r_f)/√(w'Σw)over the bounded simplex, through the homogenisationy = κ·wof the linear-fractional program (Cornuéjols and Tütüncü 2007, §8.2):min y'Σys.t.μ'y − τ·1'(u+v) − r_f·κ = 1,1'y = κ,y − u + v = κ·w_current,κ·lo ≤ y ≤ κ·hi,u, v, κ ≥ 0.minVolatility():min √(w'Σw) + τ·T(w). Without a penalty this is the minimum-variance QP. With one, the optimum solves the QPmin ½w'Σw + η·T(w)atη = τ·σ(w*)(equal first-order conditions); η is found by bisection.
-
Constructor Summary
ConstructorsConstructorDescriptionConstrainedPortfolioOptimizer(double[] expectedReturns, double[][] covariance) -
Method Summary
Modifier and TypeMethodDescriptionmaxSharpe(double riskFreeRate) withBounds(double[] min, double[] max) Per-asset weight bounds; must admit a fully-invested portfolio.withTurnoverPenalty(double[] currentWeights, double penaltyPerUnitTurnover) Adds a turnover penalty relative to the current weights.
-
Constructor Details
-
ConstrainedPortfolioOptimizer
public ConstrainedPortfolioOptimizer(double[] expectedReturns, double[][] covariance)
-
-
Method Details
-
withBounds
Per-asset weight bounds; must admit a fully-invested portfolio. -
withTurnoverPenalty
public ConstrainedPortfolioOptimizer withTurnoverPenalty(double[] currentWeights, double penaltyPerUnitTurnover) Adds a turnover penalty relative to the current weights.- Parameters:
penaltyPerUnitTurnover- expected-return units charged per unit of one-way turnover (e.g. transaction cost), ≥ 0
-
maxSharpe
-
minVolatility
-