public class Simple2dRLearn
extends java.lang.Object
Constructor and Description |
---|
Simple2dRLearn(int Ns,
int Na)
Default Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addAction()
Add action.
|
void |
addState()
Add state.
|
int |
getBestAction(int s1,
int s2)
Gets the best action for state s.
|
double[] |
getBestActionAndValue(int s1,
int s2)
Returns the best chosen action and its value in Q.
|
int |
getNa()
Gets NA value.
|
int |
getNs()
Gets NS value.
|
double[][][] |
getQ()
Gets Q value.
|
boolean |
isEmpty()
Verify if is empty.
|
void |
printQ()
Print Q values.
|
void |
setNa(int na)
Sets NA value.
|
void |
setNs(int ns)
Sets NS value.
|
void |
setQ(double[][][] q)
Sets Q value.
|
void |
update(int s1,
int s2,
int a,
double r)
Updates Q table of values
|
public Simple2dRLearn(int Ns, int Na)
Ns
- Na
- public void update(int s1, int s2, int a, double r)
s1
- previous states2
- current statea
- chosen actionr
- reward for performing action a in state s1/s2, should be between -1 and 1public void addAction()
public void addState()
public void printQ()
public int getBestAction(int s1, int s2)
s1
- firsts2
- secondpublic double[] getBestActionAndValue(int s1, int s2)
s1
- s2
- public double[][][] getQ()
public void setQ(double[][][] q)
q
- the q to setpublic int getNa()
public void setNa(int na)
na
- the na to setpublic int getNs()
public void setNs(int ns)
ns
- the ns to setpublic boolean isEmpty()