org.akutan.optimization
Class IPVector

java.lang.Object
  extended by org.akutan.optimization.IPVector
All Implemented Interfaces:
java.lang.Cloneable

public class IPVector
extends java.lang.Object
implements java.lang.Cloneable

This class encapsulates the assignment and structure of the various subcomponents of the interior point method solution. The Vector is broken out into w slack vector for inquality constraints x solution vector y lagrange multipliers for all constraints z dual variables for solution vector


Field Summary
protected  int _woffset
           
protected  int _wwidth
           
protected  int _xoffset
           
protected  int _xwidth
           
protected  int _y0offset
           
protected  int _y0width
           
protected  int _y1offset
           
protected  int _y1width
           
protected  int _zoffset
           
protected  int _zwidth
           
 
Constructor Summary
IPVector(int uw, int vw, int xw, int zw)
          Constructs
IPVector(int uw, int vw, int xw, int zw, cern.colt.matrix.DoubleMatrix1D v)
          Constructs
 
Method Summary
 void add(IPVector v)
          Called to add a vector to this one
 java.lang.Object clone()
          Clones the object, makes a deep copy of the underlying vector
 cern.colt.matrix.DoubleMatrix1D get()
          Called to get access to the contents expressed as a 1D vector
 cern.colt.matrix.DoubleMatrix1D getW()
          Called to return the W vector
 cern.colt.matrix.DoubleMatrix1D getX()
          Called to get access to the x vector
 cern.colt.matrix.DoubleMatrix1D getY0()
          Called to return the y0 vector
 cern.colt.matrix.DoubleMatrix1D getY1()
          Called to return the y1 vector
 cern.colt.matrix.DoubleMatrix1D getZ()
          Called to return the Z vector
 IPVector multiply(double d)
          Multiplies the solution vector by a constant.
 IPVector negate()
          Called to negate an IPVector, copies the vector, negates the copy and then returns the negated copy.
 int rows()
          Returns the size of the wrapper DoubleMatrix1D
 void setW(cern.colt.matrix.DoubleMatrix1D w)
          Called to set the w vector
 void setX(double cons)
          Called to set all x values equal to cons
 void setX(cern.colt.matrix.DoubleMatrix1D x)
          Called to set all x values equal to cons
 void setY0(double cons)
          Called to set all y0 values equal to cons
 void setY0(cern.colt.matrix.DoubleMatrix1D y0)
          Called to set all y0 values from a vector
 void setY1(double cons)
          Called to set all y1 values equal to cons
 void setY1(cern.colt.matrix.DoubleMatrix1D y1)
          Called to set all uy1 values from a vector
 void setZ(double cons)
          Called to set the z vector
 void setZ(cern.colt.matrix.DoubleMatrix1D z)
          Called to set the z vector
 java.lang.String toString()
          Formats the solution vector as a String
 double xDotProduct()
          Computes the dot product of the X portion of the solution vector
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_xwidth

protected int _xwidth

_wwidth

protected int _wwidth

_y0width

protected int _y0width

_y1width

protected int _y1width

_zwidth

protected int _zwidth

_xoffset

protected final int _xoffset
See Also:
Constant Field Values

_woffset

protected int _woffset

_y0offset

protected final int _y0offset

_y1offset

protected int _y1offset

_zoffset

protected int _zoffset
Constructor Detail

IPVector

public IPVector(int uw,
                int vw,
                int xw,
                int zw)
Constructs

Parameters:
uw - Number of equality constraints
vw - Number of inequality constraints
xw - Number of assets in the problem
zw - Number of dual variables for the assets

IPVector

public IPVector(int uw,
                int vw,
                int xw,
                int zw,
                cern.colt.matrix.DoubleMatrix1D v)
Constructs

Parameters:
uw - Number of equality constraints
vw - Number of inequality constraints
xw - Number of assets in the problem
zw - Number of dual variables
v - Vector to use for storage
Method Detail

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Clones the object, makes a deep copy of the underlying vector

Overrides:
clone in class java.lang.Object
Returns:
The new object which is an exact deep copy of this
Throws:
java.lang.CloneNotSupportedException
See Also:
Cloneable

setX

public void setX(double cons)
Called to set all x values equal to cons

Parameters:
cons - The constant to set into all x values.

setX

public void setX(cern.colt.matrix.DoubleMatrix1D x)
Called to set all x values equal to cons

Parameters:
x - The vector to set into the x vector

getX

public cern.colt.matrix.DoubleMatrix1D getX()
Called to get access to the x vector

Returns:
Returns the X portion of the solution vector.

setY0

public void setY0(double cons)
Called to set all y0 values equal to cons

Parameters:
cons - The constant to put into the Y0 portion of the solution vector.

setY0

public void setY0(cern.colt.matrix.DoubleMatrix1D y0)
Called to set all y0 values from a vector

Parameters:
y0 - The vector to set into the Y0 portion of the solution vector.

getY0

public cern.colt.matrix.DoubleMatrix1D getY0()
Called to return the y0 vector

Returns:
The Y0 portion of the solution vector.

setY1

public void setY1(double cons)
Called to set all y1 values equal to cons

Parameters:
cons - The constant to set into the y1 values

setY1

public void setY1(cern.colt.matrix.DoubleMatrix1D y1)
Called to set all uy1 values from a vector

Parameters:
y1 - The vector to set into the y1 vector

getY1

public cern.colt.matrix.DoubleMatrix1D getY1()
Called to return the y1 vector

Returns:
The y1 portion of the solution vector

setW

public void setW(cern.colt.matrix.DoubleMatrix1D w)
Called to set the w vector

Parameters:
w - Vector of slack variables for inequality constraints

getW

public cern.colt.matrix.DoubleMatrix1D getW()
Called to return the W vector

Returns:
The slack variables for the inequality constraints

setZ

public void setZ(double cons)
Called to set the z vector

Parameters:
cons - The constant to set into the dual variables.

setZ

public void setZ(cern.colt.matrix.DoubleMatrix1D z)
Called to set the z vector

Parameters:
z - The vector to set over the vector of dual variables.

getZ

public cern.colt.matrix.DoubleMatrix1D getZ()
Called to return the Z vector

Returns:
The dual variables from the solution vector.

get

public cern.colt.matrix.DoubleMatrix1D get()
Called to get access to the contents expressed as a 1D vector

Returns:
A copy of the underlying vector

negate

public IPVector negate()
Called to negate an IPVector, copies the vector, negates the copy and then returns the negated copy.

Returns:
Negated copy of the vector

multiply

public IPVector multiply(double d)
Multiplies the solution vector by a constant.

Parameters:
d - Constant by which to multiply the solution vector
Returns:
A deep copy of this with each element multiplied by d

rows

public int rows()
Returns the size of the wrapper DoubleMatrix1D

Returns:
Size of the vector

add

public void add(IPVector v)
Called to add a vector to this one

Parameters:
v - An IPVector to be added elementwise to this

xDotProduct

public double xDotProduct()
Computes the dot product of the X portion of the solution vector

Returns:
Scalar result of X'X

toString

public java.lang.String toString()
Formats the solution vector as a String

Overrides:
toString in class java.lang.Object
See Also:
Object.toString()