public class SSFileEnvironment extends java.lang.Object implements Environment
This is the base class for all the single step problems environments that read the examples from a file. It uses the Dataset API to get all the information needed from the file.
Constructor and Description |
---|
SSFileEnvironment(java.lang.String fileName,
boolean readAttrBounds)
It's the constructor of the class.
|
Modifier and Type | Method and Description |
---|---|
void |
beginSequentialExamples()
It initializes at the first example.
|
void |
deleteMatchedExamples(Classifier cl)
It deletes the examples of the database that match with de
classifier passed.
|
double[] |
getCurrentState()
The function returns the current state.
|
int |
getEnvironmentClass()
Does return if the class of the environmental state.
|
double |
getMaxPayoff()
Does return the environment maximum payoff
|
double |
getMinPayoff()
Does return the environment minimum payoff
|
int |
getNumberOfExamples()
It return the number of the examples of the database.
|
double[] |
getSequentialState()
It returns the new Example of a single step file environment.
|
boolean |
isPerformed()
Does return if the class has been executed.
|
double |
makeAction(int action)
This function returns the reward given at applying the action in the
environment.
|
double[] |
newState()
Does create a new state of the problem.
|
boolean |
wasCorrect()
Does determine if the classification was good
|
public SSFileEnvironment(java.lang.String fileName, boolean readAttrBounds)
It's the constructor of the class.
fileName
- is the name of the file where
the attributes of the problem are described.readAttrBounds
- is the name of the file where the
examples of the execution are written.public boolean wasCorrect()
Does determine if the classification was good
wasCorrect
in interface Environment
public double makeAction(int action)
This function returns the reward given at applying the action in the environment.
makeAction
in interface Environment
action
- is the action chosen to do.
* @return a double with the rewardpublic double[] getCurrentState()
The function returns the current state.
getCurrentState
in interface Environment
public double[] newState()
Does create a new state of the problem. The XCS have to decide the action to do.
newState
in interface Environment
public double getMaxPayoff()
Does return the environment maximum payoff
getMaxPayoff
in interface Environment
public double getMinPayoff()
Does return the environment minimum payoff
getMinPayoff
in interface Environment
public boolean isPerformed()
Does return if the class has been executed. It is used in the multiple step problems.
isPerformed
in interface Environment
public int getEnvironmentClass()
Does return if the class of the environmental state. It's used by the UCS.
getEnvironmentClass
in interface Environment
public void beginSequentialExamples()
It initializes at the first example. It is used in the file environment to get the examples sequentially.
beginSequentialExamples
in interface Environment
public double[] getSequentialState()
It returns the new Example of a single step file environment.
getSequentialState
in interface Environment
public int getNumberOfExamples()
It return the number of the examples of the database. It's only used in the file environments.
getNumberOfExamples
in interface Environment
public void deleteMatchedExamples(Classifier cl)
It deletes the examples of the database that match with de classifier passed. It's only used in the file enviornment.
deleteMatchedExamples
in interface Environment
cl
- is the classifier which if the examples matches with,
the have to be eliminate from the set.