caffeinterface
Class CaffeToVectorFunction

java.lang.Object
  extended by function.BasicVectorFunction
      extended by caffeinterface.CaffeToVectorFunction
All Implemented Interfaces:
Computable, VectorFunction
Direct Known Subclasses:
SupersonicWB

public abstract class CaffeToVectorFunction
extends BasicVectorFunction

Provides functionality similar to CaffeToScalarFunction, but for the case where there are multiple outputs computed by CAFFE.

Author:
dgorur

Field Summary
protected  caffe.SharedData db
           
 
Fields inherited from class function.BasicVectorFunction
DEFAULT_BOUNDS, DEFAULT_INPUT_DIMENSION, DEFAULT_OUTPUT_DIMENSION, VALUE_OUTSIDE_BOUNDS
 
Constructor Summary
CaffeToVectorFunction()
           
 
Method Summary
 caffe.CaffeClass getMainClass()
          Returns the main compute class in the CAFFE application.
 java.lang.String getXmlFileName()
          Returns the name of the XML file to be used for data input.
 void init()
          Initialization method.
 boolean isClientServerMode()
          Returns the clientServerMode.
 boolean isWithinBounds(double[] x)
          Returns true if the given point is within bounds.
protected abstract  void populateDatabase(double[] x)
          Populates the CAFFE database with variable values based on the given vector x.
 void quickCompute(double[] x, double[] y)
          Abstract method that all subclasses must implement.
 void quickCompute(cern.colt.matrix.DoubleMatrix2D X, cern.colt.matrix.DoubleMatrix2D Y)
          Applies BasicVectorFunction.compute(double[]) on a set of inputs, supplied row-wise in a matrix.
protected abstract  void readResults(double[] y)
          Reads the results from the database and suitably populates the given output array y.
 void setClientServerMode(boolean clientServerMode)
          Sets the clientServerMode.
 void setXmlFileName(java.lang.String xmlFileName)
          Sets the name of the XML file to be used for data input
 
Methods inherited from class function.BasicVectorFunction
checkInputDimension, compute, compute, compute, compute, compute, getBounds, getInputDimension, getOutputDimension, makeBounds
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

db

protected caffe.SharedData db
Constructor Detail

CaffeToVectorFunction

public CaffeToVectorFunction()
Method Detail

getMainClass

public caffe.CaffeClass getMainClass()
Returns the main compute class in the CAFFE application.

Returns:
the main compute class in the CAFFE application.

getXmlFileName

public java.lang.String getXmlFileName()
Returns the name of the XML file to be used for data input.

Returns:
the name of the XML file for data input.

init

public void init()
Description copied from class: BasicVectorFunction
Initialization method.

Specified by:
init in interface VectorFunction
Overrides:
init in class BasicVectorFunction

isClientServerMode

public boolean isClientServerMode()
Returns the clientServerMode.

Returns:
the clientServerMode.

isWithinBounds

public boolean isWithinBounds(double[] x)
Description copied from interface: Computable
Returns true if the given point is within bounds.

Specified by:
isWithinBounds in interface Computable
Overrides:
isWithinBounds in class BasicVectorFunction
Parameters:
x - the given point.
Returns:
true if within bounds.

quickCompute

public void quickCompute(double[] x,
                         double[] y)
Description copied from class: BasicVectorFunction
Abstract method that all subclasses must implement. This is the core compute method that takes an input double array and returns an output double array.

Specified by:
quickCompute in interface VectorFunction
Specified by:
quickCompute in class BasicVectorFunction
Parameters:
x - input array.
y - output array.

quickCompute

public void quickCompute(cern.colt.matrix.DoubleMatrix2D X,
                         cern.colt.matrix.DoubleMatrix2D Y)
Description copied from class: BasicVectorFunction
Applies BasicVectorFunction.compute(double[]) on a set of inputs, supplied row-wise in a matrix. Stores the result in the supplied output array. No size-checking is performed.

Specified by:
quickCompute in interface VectorFunction
Overrides:
quickCompute in class BasicVectorFunction
Parameters:
X - input matrix.
Y - output matrix.

setClientServerMode

public void setClientServerMode(boolean clientServerMode)
Sets the clientServerMode.

Parameters:
clientServerMode - the given clientServerMode.

setXmlFileName

public void setXmlFileName(java.lang.String xmlFileName)
Sets the name of the XML file to be used for data input

Parameters:
xmlFileName - the name of the XML file for data input.

populateDatabase

protected abstract void populateDatabase(double[] x)
Populates the CAFFE database with variable values based on the given vector x. This is the core of the adapter, since this maps the variables in this Computable to the variables in the CAFFE database.

Parameters:
x - the given set of design values.

readResults

protected abstract void readResults(double[] y)
Reads the results from the database and suitably populates the given output array y.

Parameters:
y - the given output array.