public class MCLNiedermayer extends Object implements MarkowitzCriticalLine
By default, this implementation computes the turning points along a critical line and returns the optimal weights once a given lambda or target return is reached. This ensures the best performance for one-off usage. However, if the critical line is known to be reused for many thousands of times, it might be more time-saving to compute and cache the whole critical line by calling setCachingCriticalLine(boolean) before computing weights.
Constructor and Description |
---|
MCLNiedermayer(Vector gain,
Matrix covariance)
Creates the critical line for given gain vector and covariance matrix,
with non-negativity constraint.
|
MCLNiedermayer(Vector gain,
Matrix covariance,
Vector lower,
Vector upper)
Creates the critical line for given gain vector and covariance matrix,
with given lower and upper bounds for weights.
|
Modifier and Type | Method and Description |
---|---|
Vector |
getOptimalWeightForSetLambda(double lambda) |
Vector |
getOptimalWeightForTargetReturn(double target) |
List<TurningPoint> |
getTurningPoints() |
void |
setCachingCriticalLine(boolean toCache)
Sets the algorithm to compute and cache the whole critical line, so that
optimal weights can be computed as quick as a linear search for turning
points on the line.
|
public MCLNiedermayer(Vector gain, Matrix covariance)
gain
- the gain vectorcovariance
- the covariance matrixpublic MCLNiedermayer(Vector gain, Matrix covariance, Vector lower, Vector upper)
gain
- the gain vectorcovariance
- the covariance matrixlower
- the lower bounds for asset weightsupper
- the upper bounds for asset weightspublic void setCachingCriticalLine(boolean toCache)
Caution: computation of the whole critical line may be thousand times time-consuming than finding the optimal weights for a single lambda or return.
toCache
- true
if the whole critical line needs to be
computed and cachedpublic List<TurningPoint> getTurningPoints() throws Exception
getTurningPoints
in interface MarkowitzCriticalLine
Exception
public Vector getOptimalWeightForSetLambda(double lambda) throws Exception
getOptimalWeightForSetLambda
in interface MarkowitzCriticalLine
Exception
public Vector getOptimalWeightForTargetReturn(double target) throws Exception
getOptimalWeightForTargetReturn
in interface MarkowitzCriticalLine
Exception
Copyright © 2010-2020 NM FinTech Ltd.. All Rights Reserved.