org.omegahat.Numerics.Optimizers
Class ModelPointNumeric

java.lang.Object
  |
  +--org.omegahat.Numerics.Optimizers.ModelPointNumeric
All Implemented Interfaces:
ModelPoint, ModelPointNumericInt

public class ModelPointNumeric
extends java.lang.Object
implements ModelPointNumericInt

The basic numeric model point class.

The parameters must implement NumericArray


Field Summary
protected  boolean evaluated
           
protected  NumericArray gradient
           
protected  NumericMatrix hessian
           
protected  ModelObjective model
           
protected  java.lang.String[] names
           
protected  NumericArray parameters
           
protected  double value
           
 
Constructor Summary
ModelPointNumeric()
           
ModelPointNumeric(NumericArray pars, NumericArray gradient, NumericMatrix hessian)
          Create a model point initialized to the parameters, gradient and hessian (when one or both of the latter two are not null).
 
Method Summary
 ModelPoint copy()
          Copy the model point and its numeric properties (parameters, gradient, hessian).
 void copyData(ModelPoint theta)
          copy in the data from theta.
 void copyData(ModelPointNumeric source)
          Copy the data from source.
static NumericArray copyDoubles(NumericArray source)
          Copy or return null if the argument is null.
static NumericMatrix copyMatrix(NumericMatrix source)
          Copy or return null if the argument is null.
 void evaluate()
          Evaluate the model at the current point, using the model property to define the objective.
 NumericArray getGradient()
          Accessor for gradient field
 NumericMatrix getHessian()
          Accessor for hessian field
 ModelObjective getModel()
          Accessor for model field
 java.lang.String[] getNames()
          Accessor for names field
 NumericArray getParameters()
          Accessor for parameters field
 double getValue()
          Accessor for value field
 boolean isEvaluated()
          Accessor for evaluated field
 boolean setEvaluated(boolean value)
          Accessor for setting evaluated field
 NumericArray setGradient(NumericArray value)
          Accessor for setting gradient field
 NumericMatrix setHessian(NumericMatrix value)
          Accessor for setting hessian field
 ModelObjective setModel(ModelObjective value)
          Accessor for setting model field
 java.lang.String[] setNames(java.lang.String[] value)
          Accessor for setting names field
 NumericArray setParameters(NumericArray value)
          Accessor for setting parameters field
 double setValue(double val)
          Accessor for value field
 void show()
           
 void show(java.lang.String header)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

parameters

protected NumericArray parameters

value

protected double value

gradient

protected NumericArray gradient

hessian

protected NumericMatrix hessian

evaluated

protected boolean evaluated

names

protected java.lang.String[] names

model

protected ModelObjective model
Constructor Detail

ModelPointNumeric

public ModelPointNumeric()

ModelPointNumeric

public ModelPointNumeric(NumericArray pars,
                         NumericArray gradient,
                         NumericMatrix hessian)
Create a model point initialized to the parameters, gradient and hessian (when one or both of the latter two are not null).

These are references: to generate a model point with a copy of the existing values, use the copy method.

Method Detail

getParameters

public NumericArray getParameters()
Accessor for parameters field
Specified by:
getParameters in interface ModelPointNumericInt

setParameters

public NumericArray setParameters(NumericArray value)
Accessor for setting parameters field
Specified by:
setParameters in interface ModelPointNumericInt

getValue

public double getValue()
Accessor for value field
Specified by:
getValue in interface ModelPointNumericInt

setValue

public double setValue(double val)
Accessor for value field
Specified by:
setValue in interface ModelPointNumericInt

getGradient

public NumericArray getGradient()
Accessor for gradient field
Specified by:
getGradient in interface ModelPointNumericInt

setGradient

public NumericArray setGradient(NumericArray value)
Accessor for setting gradient field
Specified by:
setGradient in interface ModelPointNumericInt

getHessian

public NumericMatrix getHessian()
Accessor for hessian field
Specified by:
getHessian in interface ModelPointNumericInt

setHessian

public NumericMatrix setHessian(NumericMatrix value)
Accessor for setting hessian field
Specified by:
setHessian in interface ModelPointNumericInt

isEvaluated

public boolean isEvaluated()
Accessor for evaluated field
Specified by:
isEvaluated in interface ModelPointNumericInt

setEvaluated

public boolean setEvaluated(boolean value)
Accessor for setting evaluated field
Specified by:
setEvaluated in interface ModelPointNumericInt

getNames

public java.lang.String[] getNames()
Accessor for names field
Specified by:
getNames in interface ModelPointNumericInt

setNames

public java.lang.String[] setNames(java.lang.String[] value)
Accessor for setting names field
Specified by:
setNames in interface ModelPointNumericInt

getModel

public ModelObjective getModel()
Accessor for model field
Specified by:
getModel in interface ModelPointNumericInt

setModel

public ModelObjective setModel(ModelObjective value)
Accessor for setting model field
Specified by:
setModel in interface ModelPointNumericInt

copyDoubles

public static NumericArray copyDoubles(NumericArray source)
Copy or return null if the argument is null.

copyMatrix

public static NumericMatrix copyMatrix(NumericMatrix source)
Copy or return null if the argument is null.

copyData

public void copyData(ModelPointNumeric source)
Copy the data from source.

If suitable fields (parameters, gradient, hessian) exist in the current object, they are overwritten from the source; if they do not exist or are the wrong size, new fields are allocated.


copyData

public void copyData(ModelPoint theta)
copy in the data from theta.

The parameters will be those in theta, as will the value, gradient, and hessian (either of the latter two can be null). If allocate is true, the fields will be newly allocated; otherwise, data will be copied into them if they match in structure the corresponding fields in theta.

Specified by:
copyData in interface ModelPoint

evaluate

public void evaluate()
Description copied from interface: ModelPointNumericInt
Evaluate the model at the current point, using the model property to define the objective. Store the resulting value and optional gradient and hessian in this object and set the evaluated property to true.
Specified by:
evaluate in interface ModelPointNumericInt

show

public void show(java.lang.String header)
Specified by:
show in interface ModelPoint

show

public void show()
Specified by:
show in interface ModelPoint

copy

public ModelPoint copy()
Description copied from interface: ModelPoint
Copy the model point and its numeric properties (parameters, gradient, hessian). It is not required to copy the model.
Specified by:
copy in interface ModelPoint