gpalta.core
Class DataHolder

java.lang.Object
  extended by gpalta.core.ProblemData

public class DataHolder
extends java.lang.Object

Holds the problem's data and provides methods to access it.


Field Summary
 int nSamples
           
 int nVars
           
 
Constructor Summary
DataHolder(double[][] data)
          Initialize the data from the given matrix.
DataHolder(java.lang.String fileName)
          Initialize the data from a file
 
Method Summary
 double[] getCurrentSample()
          Get the current sample (all variables)
 double getData(int whichVar)
          Get the current value for a variable
 double[] getDataVect(int whichVar)
          Get all values (in all samples) for a variable
 double getE1()
           
 double getMax(int whichVar)
          Get the maximum value of a certain variable
 double getMin(int whichVar)
          Get the minimum value of a certain variable
 double getRange(int wVar)
          Get the range (maximum - minimum) of a certain variable
 double[] getSample(int wSample)
          Get a sample (all variables)
 void reset()
          reset() must be called every time a new tree is being evaluated (when using eval() instead of evalVect() )
 void update()
          update() must be called every time a new sample is required (when using eval() instead of evalVect() )
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

nSamples

public int nSamples

nVars

public int nVars
Constructor Detail

DataHolder

public DataHolder(java.lang.String fileName)
Initialize the data from a file


DataHolder

public DataHolder(double[][] data)
Initialize the data from the given matrix. Every row is a variable and every column is a sample

Method Detail

getData

public double getData(int whichVar)
Get the current value for a variable

Parameters:
whichVar - The variable (between 1 and nVars)
Returns:
The current value

getDataVect

public double[] getDataVect(int whichVar)
Get all values (in all samples) for a variable

Parameters:
whichVar - The variable (between 1 and nVars)
Returns:
an array with the values the variable takes for every sample

reset

public void reset()
reset() must be called every time a new tree is being evaluated (when using eval() instead of evalVect() )


update

public void update()
update() must be called every time a new sample is required (when using eval() instead of evalVect() )


getMin

public double getMin(int whichVar)
Get the minimum value of a certain variable

Parameters:
whichVar - The variable (between 1 and nVars)

getMax

public double getMax(int whichVar)
Get the maximum value of a certain variable

Parameters:
whichVar - The variable (between 1 and nVars)

getRange

public double getRange(int wVar)
Get the range (maximum - minimum) of a certain variable

Parameters:
wVar - The variable (between 1 and nVars)

getCurrentSample

public double[] getCurrentSample()
Get the current sample (all variables)

Returns:
an array with the whole sample

getSample

public double[] getSample(int wSample)
Get a sample (all variables)

Parameters:
wSample - Which sample (between 0 and nSamples)
Returns:
an array with the whole sample

getE1

public double getE1()