org.akutan.optimization.entropy
Class EntropyInteriorPointsSolver

java.lang.Object
  extended by org.akutan.optimization.entropy.EntropyInteriorPointsSolver
Direct Known Subclasses:
EntropyReturn

public class EntropyInteriorPointsSolver
extends java.lang.Object


Field Summary
protected  java.text.DecimalFormat df
           
 
Constructor Summary
EntropyInteriorPointsSolver(cern.colt.matrix.DoubleMatrix1D e_r, cern.colt.matrix.DoubleMatrix2D V, double f)
           
 
Method Summary
protected  void addPoint(java.util.List<SolvedPoint> l, 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, EVector w_p, EMatrix Q, EMatrix QC, EConsVector 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, EVector w_p, cern.colt.matrix.DoubleMatrix2D AV, cern.colt.matrix.DoubleMatrix1D d, EVector 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, EVector 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  EVector initialGuess(int maxMin, double mu, int m1, cern.colt.matrix.DoubleMatrix2D AV, cern.colt.matrix.DoubleMatrix1D d, cern.colt.matrix.DoubleMatrix1D initX)
          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)
           
 void savePath(boolean savePath)
          Called to notify solver to save the path of solutions
 void setF(double f)
          Set the variance constraint
protected  EVector solvePoint(int maxMin, cern.colt.matrix.DoubleMatrix1D E_rx, java.util.List<Constraint> constraints, cern.colt.matrix.DoubleMatrix2D Vx, double threshold, cern.colt.matrix.DoubleMatrix1D initG)
          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

EntropyInteriorPointsSolver

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

savePath

public void savePath(boolean savePath)
Called to notify solver to save the path of solutions

Parameters:
savePath -

setF

public void setF(double f)
Set the variance constraint

Parameters:
f -

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 -
Returns:
Matrix of coefficients from 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 b values from the 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 coeffecients from the 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 -
Returns:
D vector generated from the constraints

solvePoint

protected EVector solvePoint(int maxMin,
                             cern.colt.matrix.DoubleMatrix1D E_rx,
                             java.util.List<Constraint> constraints,
                             cern.colt.matrix.DoubleMatrix2D Vx,
                             double threshold,
                             cern.colt.matrix.DoubleMatrix1D initG)
Called to solve for a single point using the Interior Points method with logarithmic barriers.

Parameters:
maxMin - Indicates maximizing or minimizing
E_rx -
constraints -
Vx -
threshold -
initG -
Returns:
The point which solves

algorithm

protected double algorithm(int maxMin,
                           EVector w_p,
                           EMatrix Q,
                           EMatrix QC,
                           EConsVector 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 - Indicates whether to maximize or minimize the objective
w_p - Vector with the state of the current point
Q - Matrix for multiplying the step from the current point
QC - Matrix for multiplying the current point
cons - Constant vector for rhs/constraints
mu - Step size
AV - Matrix for inequality constraints
d -
threshold - If x*x < threshold then stop the solver
Returns:
Updated value of mu, mu = 0 when done.

addPoint

protected void addPoint(java.util.List<SolvedPoint> l,
                        cern.colt.matrix.DoubleMatrix1D x)
Helper function called to build the finished point object and add it to the mean variance frontier. We compute the objective function result here so we can track the entropy and see if our optimizer is working right.

Parameters:
l -
x - Solution vector

initialGuess

protected EVector initialGuess(int maxMin,
                               double mu,
                               int m1,
                               cern.colt.matrix.DoubleMatrix2D AV,
                               cern.colt.matrix.DoubleMatrix1D d,
                               cern.colt.matrix.DoubleMatrix1D initX)
Called to compute the initial guess for a solution of the portfolio optimization problem

Parameters:
maxMin - Indicats whether to maximize or minimize the objective
mu -
m1 -
AV -
d -
initX -
Returns:
Vector containing initial guess at solution

computeAlpha

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

Parameters:
mu -
w_p -
AV -
d -
X -
Returns:
The step size given the constraints

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,
                                        EVector w_p,
                                        int ct)
Called to write out a line into the standard output for this iteration of the solver

Parameters:
n -
alg -
w_p -
ct -
Returns:
A formatted String for output with annualized values