org.akutan.optimization
Class NewtonSolver

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

public class NewtonSolver
extends java.lang.Object
implements Solver


Field Summary
protected  java.text.DecimalFormat df
          Display format for use in logging
 
Constructor Summary
NewtonSolver(cern.colt.matrix.DoubleMatrix1D priors)
          Constructs
 
Method Summary
 double computeDiff(cern.colt.matrix.DoubleMatrix1D prop, cern.colt.matrix.DoubleMatrix1D act)
          Computes the norm between the two vectors
protected  cern.colt.matrix.DoubleMatrix1D generate_b(java.util.List<Constraint> constraints)
          Given the list of constraints, builds the matrix of equality constraints Ax = b.
protected  java.util.List<Constraint> getConstraints()
          Returns list of constraints for the sample problem.
protected  cern.colt.matrix.DoubleMatrix2D getEqualityConstraints(java.util.List<Constraint> constraints)
          Given the list of constraints, builds the matrix of equality constraints A.
protected static cern.colt.matrix.DoubleMatrix1D getPriors()
          Returns a vector of the priors
protected static cern.colt.matrix.DoubleMatrix1D getSolution()
          Returns the actual solution vector for our test example
protected static cern.colt.matrix.DoubleMatrix1D getUniform()
          Returns a vector of priors which is the uniform distribution
static void main(java.lang.String[] args)
          Test driver to match the Silva de Mattos/Veiga paper.
 cern.colt.matrix.DoubleMatrix2D make2D(cern.colt.matrix.DoubleMatrix1D m)
          Helper function to convert a vector into a 1 column matrix
protected  void setMatrix(cern.colt.matrix.DoubleMatrix2D Q, int qx, int qy, cern.colt.matrix.DoubleMatrix1D V, int vx)
           
protected  void setMatrix(cern.colt.matrix.DoubleMatrix2D Q, int qx, int qy, cern.colt.matrix.DoubleMatrix2D V, int vx, int vy)
          Called to setup the matrix Q given the covariancevalues
 java.util.List<SolvedPoint> solve(java.util.List<Constraint> extraConstraints, org.akutan.optimization.ProgressIndicator progress)
          Simple Newton Solver for use in processing entropy (MAXENT or MINENT) solutions.
 
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
Display format for use in logging

Constructor Detail

NewtonSolver

public NewtonSolver(cern.colt.matrix.DoubleMatrix1D priors)
Constructs

Parameters:
priors - Vector of prior values relative to which the entropy will be calculated
Method Detail

make2D

public cern.colt.matrix.DoubleMatrix2D make2D(cern.colt.matrix.DoubleMatrix1D m)
Helper function to convert a vector into a 1 column matrix

Parameters:
m - Vector to convert
Returns:
Single column matrix which is identical to m

setMatrix

protected void setMatrix(cern.colt.matrix.DoubleMatrix2D Q,
                         int qx,
                         int qy,
                         cern.colt.matrix.DoubleMatrix2D V,
                         int vx,
                         int vy)
Called to setup the matrix Q given the covariancevalues

Parameters:
Q -
qx -
qy -
V -
vx -
vy -

setMatrix

protected void setMatrix(cern.colt.matrix.DoubleMatrix2D Q,
                         int qx,
                         int qy,
                         cern.colt.matrix.DoubleMatrix1D V,
                         int vx)

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:
Coefficient matrix of the equality constraints (A)

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 Ax = b.

Parameters:
constraints - List of constraints
Returns:
Vector (b) of constants from the constraints

solve

public java.util.List<SolvedPoint> solve(java.util.List<Constraint> extraConstraints,
                                         org.akutan.optimization.ProgressIndicator progress)
Simple Newton Solver for use in processing entropy (MAXENT or MINENT) solutions. The entropy optimization problem structurally imposes a positivity constraint on each weight and a budget constraint.

Specified by:
solve in interface Solver
Parameters:
extraConstraints - List of additonal constraints the user would like to apply to the problem.
Returns:
List of points on the entropy efficient frontier.

getConstraints

protected java.util.List<Constraint> getConstraints()
Returns list of constraints for the sample problem.

Returns:
Generates and returns a fixed set of constraints for the problem

getUniform

protected static cern.colt.matrix.DoubleMatrix1D getUniform()
Returns a vector of priors which is the uniform distribution

Returns:
A uniform vector

getPriors

protected static cern.colt.matrix.DoubleMatrix1D getPriors()
Returns a vector of the priors

Returns:
The vector of the priors

computeDiff

public double computeDiff(cern.colt.matrix.DoubleMatrix1D prop,
                          cern.colt.matrix.DoubleMatrix1D act)
Computes the norm between the two vectors

Parameters:
prop - The first vector
act - The second vector
Returns:
The norm

getSolution

protected static cern.colt.matrix.DoubleMatrix1D getSolution()
Returns the actual solution vector for our test example

Returns:
The expected solution for the test case

main

public static void main(java.lang.String[] args)
Test driver to match the Silva de Mattos/Veiga paper.

Parameters:
args -