|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--Square
This class implements the problem to be solved by agents. It first generates randomly two values corresponding to the two parameters taken into account for the evaluation. Then, it calculates the value corresponding to the combination of these two variables. These two variables are then converted in a binary string that is the signal transmitted to the agent. It then calculates the reward, comparing the calculated output and the answer provided by the agent.
Field Summary | |
private int |
bits
the number of bits used to code the variables in binaries |
private int[] |
car
The different variables are stored in an array of integers. |
static int |
conLength
Specifies the length of each presented problem. |
private static XCSConstants |
cons
Stores the relevant constants for XCS. |
private boolean |
correct
Stores if the last classification was correct. |
private java.lang.String |
currentState
Stores the current problem. |
private int |
edgeSquare
Edge of the square problem |
private int |
maxPayoff
Specifies the maximal payoff possible in this environment. |
private int |
nbVar
The number of variables taken into account in the process of evaluation, i.e. in calculating the right action. |
private int |
nrActions
In the square problem there are 6 possible classifications |
static boolean |
payoffLandscape
Defines if either a payoff landscape or a 1000/0 payoff is provided after the execution of a classification. |
private java.util.Random |
random
Used to generate new situations randomly |
private boolean |
reset
Is set to true after a classification was executed |
private int |
scale
In the square problem, variables'values can rank from 0 to 3 |
Constructor Summary | |
Square(int payoffMap)
Constructs the square problem according to the specified problem length and chosen payoff type. |
Method Summary | |
double |
computeDistance(java.lang.String string1,
java.lang.String string2)
Computes the distance between two points in the problem space. |
boolean |
doReset()
Returns true after the current problem was classified |
private java.lang.String |
encode(int n)
turn an integer into a binary |
double |
executeAction(int action)
Executes the action and determines the reward. |
private int[] |
generateSituation()
Generates the values of the variables constituting the current state |
int |
getConditionLength()
Returns the problem length |
java.lang.String |
getCurrentState()
Returns the current problem |
int |
getMaxPayoff()
Returns the maximal payoff possible in the current multiplexer problem. |
int |
getNbVar()
Returns the number of variables comprised in the problem |
int |
getNrActions()
Returns the number of possible actions. |
double |
getProblemSurface()
Returns the edge of the surface of the square problem space |
boolean |
isMultiStepProblem()
Returns false since the square problem is a single step problem |
java.lang.String |
resetState()
Generates a new random problem instance. |
boolean |
wasCorrect()
Returns true if the last executed action was a correct classification |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static int conLength
public static boolean payoffLandscape
private int maxPayoff
private int edgeSquare
private java.util.Random random
private java.lang.String currentState
private static XCSConstants cons
XCSConstants
private boolean correct
private boolean reset
private final int nrActions
private final int scale
private int bits
private final int nbVar
private int[] car
Constructor Detail |
public Square(int payoffMap)
payoffMap
- Specifies if a payoff map should be provided or a
1000/0 payoff.Method Detail |
public java.lang.String resetState()
resetState
in interface Environment
generateSituation()
,
encode(int)
public double executeAction(int action)
executeAction
in interface Environment
action
- Specifies the classification.private int[] generateSituation()
private java.lang.String encode(int n)
n
- The integer to be turned into a binary stringpublic boolean wasCorrect()
wasCorrect
in interface Environment
public boolean isMultiStepProblem()
isMultiStepProblem
in interface Environment
public boolean doReset()
doReset
in interface Environment
public int getConditionLength()
getConditionLength
in interface Environment
public int getMaxPayoff()
getMaxPayoff
in interface Environment
public int getNrActions()
getNrActions
in interface Environment
public int getNbVar()
public java.lang.String getCurrentState()
getCurrentState
in interface Environment
public double computeDistance(java.lang.String string1, java.lang.String string2)
computeDistance
in interface Environment
string1
- Coordinates of the first position used in the comparisonstring2
- Coordinates of the second position used in the comparisonpublic double getProblemSurface()
getProblemSurface
in interface Environment
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |