org.akutan.optimization.diversified
Class DivInteriorPointsSolver

java.lang.Object
  extended by org.akutan.optimization.diversified.DivInteriorPointsSolver
Direct Known Subclasses:
DiversifiedReturn

public class DivInteriorPointsSolver
extends java.lang.Object


Field Summary
protected  java.text.DecimalFormat df
           
 
Constructor Summary
DivInteriorPointsSolver(cern.colt.matrix.DoubleMatrix1D e_r, cern.colt.matrix.DoubleMatrix2D V, double f)
           
 
Method Summary
protected  void addPoint(java.util.List<SolvedPoint> l, double ra, DVector w_p)
          Helper function called to build the finished point object and add it to the mean variance frontier.
protected  double algorithm(int maxMin, cern.colt.matrix.DoubleMatrix2D Vx, DVector w_p, DMatrix Q, DMatrix QC, DConsVector 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(double mu, DVector w_p, cern.colt.matrix.DoubleMatrix2D C, cern.colt.matrix.DoubleMatrix1D d, DVector X)
          Computes the step size in the step direction X by finding the maximum step size that won't violate any constraints.
protected  java.lang.String formatOutput(int n, cern.colt.matrix.linalg.Algebra alg, double ra, DVector w_p, 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 matrix of equality constraints rhs.
protected  cern.colt.matrix.DoubleMatrix1D generate_d(java.util.List<Constraint> constraints)
          Given the list of constraints, builds the matrix of inequality constraints rhs.
protected  cern.colt.matrix.DoubleMatrix2D getEqualityConstraints(java.util.List<Constraint> constraints)
          Given the list of constraints, builds the matrix of equality constraints A.
protected  cern.colt.matrix.DoubleMatrix2D getInequalityConstraints(java.util.List<Constraint> constraints)
          Given the list of constraints, builds the matrix of inequality constraints C.
protected  DVector initialGuess(int maxMin, double mu, 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
protected  java.lang.String prettyPrint(int n, cern.colt.matrix.DoubleMatrix1D w_p, int ct, double eRet, double eSigma, double utility)
           
protected  DVector 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

df

protected java.text.DecimalFormat df
Constructor Detail

DivInteriorPointsSolver

public DivInteriorPointsSolver(cern.colt.matrix.DoubleMatrix1D e_r,
                               cern.colt.matrix.DoubleMatrix2D V,
                               double f)
Method Detail

getEqualityConstraints

protected cern.colt.matrix.DoubleMatrix2D getEqualityConstraints(java.util.List<Constraint> constraints)
Given the list of constraints, builds the matrix of equality constraints A.

Parameters:
constraints - List of constraints
Returns:
The matrix of coefficients for the equality constraints

generate_b

protected cern.colt.matrix.DoubleMatrix1D generate_b(java.util.List<Constraint> constraints)
Given the list of constraints, builds the matrix of equality constraints rhs.

Parameters:
constraints -
Returns:
vector of constants from equality constraints

getInequalityConstraints

protected cern.colt.matrix.DoubleMatrix2D getInequalityConstraints(java.util.List<Constraint> constraints)
Given the list of constraints, builds the matrix of inequality constraints C.

Parameters:
constraints -
Returns:
Matrix of coefficients for inequality constraints

generate_d

protected cern.colt.matrix.DoubleMatrix1D generate_d(java.util.List<Constraint> constraints)
Given the list of constraints, builds the matrix of inequality constraints rhs.

Parameters:
constraints - List of constraints
Returns:
Constant vector for inequality constraints

solvePoint

protected DVector 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.

Parameters:
maxMin - Minimize or maximize the objective function
E_rx - Vector of returns
constraints - List of constraints
ra - Risk aversion parameter
Vx - Covariance matrix
threshold -
Returns:
The point which optimizes the objective subject to the constraints

algorithm

protected double algorithm(int maxMin,
                           cern.colt.matrix.DoubleMatrix2D Vx,
                           DVector w_p,
                           DMatrix Q,
                           DMatrix QC,
                           DConsVector cons,
                           double mu,
                           cern.colt.matrix.DoubleMatrix2D AV,
                           cern.colt.matrix.DoubleMatrix1D d,
                           double threshold)
Performs the actual algorithmic calculations of a single iteration.

Parameters:
maxMin - Maximize or minimize the objective
Vx - Covariance matrix
w_p - Solution vector
Q - lhs matrix
QC - rhs matrix
cons - vector of rhs constants
mu - convergence coefficient
AV - Matrix of inequality constraint coefficients
d -
threshold -
Returns:
Updated value of mu, mu = 0 when done.

addPoint

protected void addPoint(java.util.List<SolvedPoint> l,
                        double ra,
                        DVector w_p)
Helper function called to build the finished point object and add it to the mean variance frontier.

Parameters:
l - List of previous solutions
ra - Risk aversion coefficient
w_p - Solution vector

initialGuess

protected DVector initialGuess(int maxMin,
                               double mu,
                               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

Parameters:
maxMin - Maximize or minimize the objective function
mu - Convergence coefficient
m1 - Width of inequality constraints
AV - Matrix of coefficients of inequality constraints
d -
Returns:
Vector containing an initial guess at the solution

computeAlpha

protected double computeAlpha(double mu,
                              DVector w_p,
                              cern.colt.matrix.DoubleMatrix2D C,
                              cern.colt.matrix.DoubleMatrix1D d,
                              DVector X)
Computes the step size in the step direction X by finding the maximum step size that won't violate any constraints.

Parameters:
mu - Convergence coefficient
w_p - Potential solution vector
C -
d -
X -
Returns:
step size

prettyPrint

protected java.lang.String prettyPrint(int n,
                                       cern.colt.matrix.DoubleMatrix1D w_p,
                                       int ct,
                                       double eRet,
                                       double eSigma,
                                       double utility)

formatOutput

protected java.lang.String formatOutput(int n,
                                        cern.colt.matrix.linalg.Algebra alg,
                                        double ra,
                                        DVector w_p,
                                        int ct)
Called to write out a line into the standard output for this iteration of the solver

Parameters:
n -
alg -
ra -
w_p -
ct -
Returns:
Formatted string for solution