|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.akutan.optimization.InteriorPointsSolver
public class InteriorPointsSolver
| Field Summary | |
|---|---|
protected cern.colt.matrix.DoubleMatrix1D |
_er
Expected returns of the assets |
protected java.util.List<double[]> |
_path
|
protected boolean |
_savePath
Manages the path of the solution across iterations |
protected cern.colt.matrix.DoubleMatrix2D |
_V
Covariance matrix for the assets |
protected java.text.DecimalFormat |
df
Format for formatting output |
| Constructor Summary | |
|---|---|
InteriorPointsSolver(cern.colt.matrix.DoubleMatrix1D er,
cern.colt.matrix.DoubleMatrix2D V)
Constructs |
|
| Method Summary | |
|---|---|
protected void |
addPoint(java.util.List<SolvedPoint> l,
double ra,
cern.colt.matrix.DoubleMatrix1D x)
Helper function called to build the finished point object and add it to the mean variance frontier. |
protected double |
algorithm(int maxMin,
IPVector w_p,
IPMatrix Q,
IPMatrix QC,
IPConsVector cons,
double mu,
cern.colt.matrix.DoubleMatrix2D AV,
cern.colt.matrix.DoubleMatrix1D d,
double threshold)
Performs the actual algorithmic calculations of a single iteration. |
protected double |
computeAlpha(IPVector w_p,
cern.colt.matrix.DoubleMatrix2D C,
cern.colt.matrix.DoubleMatrix1D d,
IPVector X)
|
protected java.lang.String |
formatOutput(int n,
double ra,
IPVector x,
int ct)
Called to write out a line into the standard output for this iteration of the solver |
protected cern.colt.matrix.DoubleMatrix1D |
generate_b(java.util.List<Constraint> constraints)
Given the list of constraints, builds the vector b (Ax = b) for the equality constraints. |
protected cern.colt.matrix.DoubleMatrix1D |
generate_d(java.util.List<Constraint> constraints)
Given the list of constraints, builds the matrix of inequality constraints constants d (Cx >= d). |
protected cern.colt.matrix.DoubleMatrix2D |
getEqualityConstraints(java.util.List<Constraint> constraints)
Given the list of constraints, builds the matrix of equality constraints A given the form Ax = b |
protected cern.colt.matrix.DoubleMatrix2D |
getInequalityConstraints(java.util.List<Constraint> constraints)
Given the list of constraints, builds the matrix of inequality constraints C (Cx >= d) |
protected IPVector |
initialGuess(int maxMin,
double mu,
int n,
int m1,
cern.colt.matrix.DoubleMatrix2D AV,
cern.colt.matrix.DoubleMatrix1D d)
Called to compute the initial guess for a solution of the portfolio optimization problem |
cern.colt.matrix.DoubleMatrix2D |
make2D(cern.colt.matrix.DoubleMatrix1D input)
Helper function to convert a vector into a single column 2d matrix for Colt. |
protected double |
maxReturn(cern.colt.matrix.DoubleMatrix1D er,
java.util.List<Constraint> constraints)
Called to solve the linear problem of max return portfolio in the presence of equality constraints. |
protected java.lang.String |
prettyPrint(int n,
cern.colt.matrix.DoubleMatrix1D x,
int ct,
double eRet,
double eSigma,
double utility)
Can be called to generate a pretty formatted string/line for output |
void |
savePath(boolean savePath)
Enables "save path" mode which saves each solution along the path into a list so it could be plotted or reviewed. |
IPVector |
solvePoint(int maxMin,
cern.colt.matrix.DoubleMatrix1D E_rx,
java.util.List<Constraint> constraints,
double ra,
cern.colt.matrix.DoubleMatrix2D Vx,
double threshold)
Called to solve for a single point using the Interior Points method with logarithmic barriers. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected cern.colt.matrix.DoubleMatrix1D _er
protected cern.colt.matrix.DoubleMatrix2D _V
protected boolean _savePath
protected java.util.List<double[]> _path
protected java.text.DecimalFormat df
| Constructor Detail |
|---|
public InteriorPointsSolver(cern.colt.matrix.DoubleMatrix1D er,
cern.colt.matrix.DoubleMatrix2D V)
er - Vector of asset expected returnsV - Matrix of covariance between assets| Method Detail |
|---|
public void savePath(boolean savePath)
savePath - public cern.colt.matrix.DoubleMatrix2D make2D(cern.colt.matrix.DoubleMatrix1D input)
input - Input vector
protected cern.colt.matrix.DoubleMatrix2D getEqualityConstraints(java.util.List<Constraint> constraints)
constraints - List of constraints
protected cern.colt.matrix.DoubleMatrix1D generate_b(java.util.List<Constraint> constraints)
constraints - List of constraints
protected cern.colt.matrix.DoubleMatrix2D getInequalityConstraints(java.util.List<Constraint> constraints)
constraints - List of constraints
protected cern.colt.matrix.DoubleMatrix1D generate_d(java.util.List<Constraint> constraints)
constraints - List of constraints
public IPVector solvePoint(int maxMin,
cern.colt.matrix.DoubleMatrix1D E_rx,
java.util.List<Constraint> constraints,
double ra,
cern.colt.matrix.DoubleMatrix2D Vx,
double threshold)
maxMin - Indicates whether the solution is maximizing the objective, or
minimizing the objective.E_rx - The vector of expected returnsconstraints - List of constraints to be appliedra - The risk aversionVx - The covariance matrixthreshold - Controls the number of iterations, terminates processing when
the distance between two solutions (n, n-1) is less than this
value as measured by the formula (x(n) - x(n-1))'((x(n) -
x(n-1))
protected double algorithm(int maxMin,
IPVector w_p,
IPMatrix Q,
IPMatrix QC,
IPConsVector cons,
double mu,
cern.colt.matrix.DoubleMatrix2D AV,
cern.colt.matrix.DoubleMatrix1D d,
double threshold)
maxMin - Indicates whether we are maximizing or minimizing the objective
function.w_p - Solution vector to previous iteration.Q - Matrix of coefficients for lhs (dX)QC - Matrix of coefficients for rhs (X)cons - Constant vectormu - Coefficient of ?? Measures distance between ??AV - Matrix of inequality constraint coefficients used in determining
the step size along the direction computed.d - Constant vector from inequality constraints used in determining
the step size.threshold - Distance between two successive solutions before the iterations
will stop.
protected void addPoint(java.util.List<SolvedPoint> l,
double ra,
cern.colt.matrix.DoubleMatrix1D x)
l - List of solutions (points on the efficient frontier)ra - Risk aversion used in evaluating the objective functionx - Solution vector
protected IPVector initialGuess(int maxMin,
double mu,
int n,
int m1,
cern.colt.matrix.DoubleMatrix2D AV,
cern.colt.matrix.DoubleMatrix1D d)
maxMin - Indicates whether we are maximizing or minimizing the objective
function.mu - Coefficient of ?? Used to measure distance between ??n - Number of assetsm1 - Number of equality constraintsAV - Coefficients of inequality constraintsd - Constant values for inequality constraints.
protected double computeAlpha(IPVector w_p,
cern.colt.matrix.DoubleMatrix2D C,
cern.colt.matrix.DoubleMatrix1D d,
IPVector X)
protected double maxReturn(cern.colt.matrix.DoubleMatrix1D er,
java.util.List<Constraint> constraints)
er - Vector of expected returnsconstraints - List of constraints
protected java.lang.String prettyPrint(int n,
cern.colt.matrix.DoubleMatrix1D x,
int ct,
double eRet,
double eSigma,
double utility)
n - Number of assetsx - Solution vectorct - Number of iterations to reach solutioneRet - Expected return for this solutioneSigma - Expected standard deviation for this solution
protected java.lang.String formatOutput(int n,
double ra,
IPVector x,
int ct)
n - Number of assetsra - Risk aversionx - Solution vectorct - Number of iterations so far
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||