org.akutan.optimization
Class EntropySolver

java.lang.Object
  extended by org.akutan.optimization.EntropySolver
All Implemented Interfaces:
Solver

public class EntropySolver
extends java.lang.Object
implements Solver

This class encapsulates an example of solving for the optimal portfolio using the entropy measure.

Since:
24 February 2006

Field Summary
protected  java.text.DecimalFormat df
           
 
Constructor Summary
EntropySolver(cern.colt.matrix.DoubleMatrix1D e_r, cern.colt.matrix.DoubleMatrix2D V_p)
          Constructs
 
Method Summary
protected  void addPoint(double ra, cern.colt.matrix.DoubleMatrix1D x, cern.colt.matrix.DoubleMatrix1D e_r, cern.colt.matrix.DoubleMatrix2D V, java.util.List<SolvedPoint> l)
           
protected  cern.colt.matrix.DoubleMatrix1D computeCi(cern.colt.matrix.DoubleMatrix1D M, cern.colt.matrix.DoubleMatrix2D V, double mu)
          Uses Merton method to compute lambda and gamma, and thence c
static double computeLambda(double risk_premium, double sigma_m)
          Called to compute the risk aversion of the market portfolio.
protected  java.lang.String formatOutput(int ct, double ra, cern.colt.matrix.DoubleMatrix1D x, cern.colt.matrix.DoubleMatrix1D e_r, cern.colt.matrix.DoubleMatrix2D V)
           
protected  java.lang.String[] getAssetNames()
           
protected static cern.colt.matrix.DoubleMatrix1D getMarketWeights()
          Returns the market weights from the example shown in the Idzorek paper on Black-Litterman.
protected static cern.colt.matrix.DoubleMatrix2D getTestV()
          Returns the covariance matrix for the example shown in the Idzorek paper on Black-Litterman.
static void main(java.lang.String[] args)
          Test code to show how this class works.
protected static cern.colt.matrix.DoubleMatrix1D reverseOptimize(double lambda, double rf, cern.colt.matrix.DoubleMatrix2D V, cern.colt.matrix.DoubleMatrix1D w)
          Computes market implied excess returns given the following parameters
 void setPriors(cern.colt.matrix.DoubleMatrix1D priors)
           
 java.util.List<SolvedPoint> solve(java.util.List<Constraint> extraConstraints, org.akutan.optimization.ProgressIndicator progress)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

df

protected final java.text.DecimalFormat df
Constructor Detail

EntropySolver

public EntropySolver(cern.colt.matrix.DoubleMatrix1D e_r,
                     cern.colt.matrix.DoubleMatrix2D V_p)
Constructs

Method Detail

setPriors

public void setPriors(cern.colt.matrix.DoubleMatrix1D priors)

solve

public java.util.List<SolvedPoint> solve(java.util.List<Constraint> extraConstraints,
                                         org.akutan.optimization.ProgressIndicator progress)
Specified by:
solve in interface Solver

addPoint

protected void addPoint(double ra,
                        cern.colt.matrix.DoubleMatrix1D x,
                        cern.colt.matrix.DoubleMatrix1D e_r,
                        cern.colt.matrix.DoubleMatrix2D V,
                        java.util.List<SolvedPoint> l)

formatOutput

protected java.lang.String formatOutput(int ct,
                                        double ra,
                                        cern.colt.matrix.DoubleMatrix1D x,
                                        cern.colt.matrix.DoubleMatrix1D e_r,
                                        cern.colt.matrix.DoubleMatrix2D V)

getMarketWeights

protected static cern.colt.matrix.DoubleMatrix1D getMarketWeights()
Returns the market weights from the example shown in the Idzorek paper on Black-Litterman.

Returns:
Vector of market weights for the assets.

getTestV

protected static cern.colt.matrix.DoubleMatrix2D getTestV()
Returns the covariance matrix for the example shown in the Idzorek paper on Black-Litterman.

Returns:
Covariance matrix for the assets

getAssetNames

protected java.lang.String[] getAssetNames()

computeLambda

public static double computeLambda(double risk_premium,
                                   double sigma_m)
Called to compute the risk aversion of the market portfolio.

Parameters:
risk_premium - Expected risk premium of market portfolio over the risk free rate (percent).
sigma_m - Standard deviation of the market portfolio (percent).
Returns:
lamdba (risk aversion coefficient for Black-Litterman)

reverseOptimize

protected static cern.colt.matrix.DoubleMatrix1D reverseOptimize(double lambda,
                                                                 double rf,
                                                                 cern.colt.matrix.DoubleMatrix2D V,
                                                                 cern.colt.matrix.DoubleMatrix1D w)
Computes market implied excess returns given the following parameters

Parameters:
lambda - Market portfolio implied risk aversion
rf - Long run risk free rate
V - Long run covariance matrix for the individual assets
w - Current equilibrium weights of the assets in the market portfolio
Returns:
The vector of total returns (rf has been added back in)

computeCi

protected cern.colt.matrix.DoubleMatrix1D computeCi(cern.colt.matrix.DoubleMatrix1D M,
                                                    cern.colt.matrix.DoubleMatrix2D V,
                                                    double mu)
Uses Merton method to compute lambda and gamma, and thence c

Parameters:
M - Input matrix of returns
V - Input matrix of covariance
mu - Input constrained portfolio return.
Returns:
the c value for this index

main

public static void main(java.lang.String[] args)
Test code to show how this class works.