All Packages This Package Class Hierarchy Class Search Index
java.lang.Object | +----java.awt.Component | +----java.awt.Canvas | +----aima.cs.learning.QLearning_Agent
A basic Q-learning agent. Both states and actions are represented and communicated using ints.
public class QLearning_Agent extends java.awt.Canvas implements java.io.Serializable, aima.cs.learning.StateReward_PerceptListener { // Constructors 2 public QLearning_Agent(); public QLearning_Agent(int, int); // Methods 28 public synchronized void addIntActionListener(intActionListener); protected void allocParams(); protected void computePolicy(); protected void computePolicyOf(int); protected void computeValueOf(int); protected void computeValues(); public int getAction(); public double getDiscountFactor(); public double getExplorationRate(); public double getLearningRate(); public Dimension getMinimumSize(); public int getNumActions(); public int getNumStates(); public int getState(); public int getVerbosity(); public synchronized void paint(Graphics); public void perceiveStateReward(StateReward_PerceptEvent); public void randomlyInitParams(double); public synchronized void removeIntActionListener(intActionListener); public void setDiscountFactor(double); public void setExplorationRate(double); public void setLearningRate(double); public void setNumActions(int); public void setNumStates(int); public void setState(int); public void setVerbosity(int); public int step(int, double); public String toString(); }
public QLearning_Agent()
public QLearning_Agent(int n, int na)
public void setState(int s)
Sets the current state of the agent. The assumption is that this state is detached from the previous state history.
public int getState()
public void setNumStates(int n)
public int getNumStates()
public void setNumActions(int na)
public int getNumActions()
protected void allocParams()
public void randomlyInitParams(double max)
protected void computeValues()
protected void computeValueOf(int i)
protected void computePolicy()
protected void computePolicyOf(int i)
public void setLearningRate(double r)
public double getLearningRate()
public void setExplorationRate(double r)
public double getExplorationRate()
public void setDiscountFactor(double d)
public double getDiscountFactor()
public int step(int s, double r)
Take a experience/learning step. Input is the new state and reward. Returns an action. Assume that input state of -1 indicates reset (that the previous state was terminal.)
public int getAction()
Returns an action. This method will need to be modified when more sophisticated exploration policies are desired.
public String toString()
- Overrides:
- toString in class Component
public void setVerbosity(int n)
public int getVerbosity()
public void perceiveStateReward(StateReward_PerceptEvent e)
- Implements:
- perceiveStateReward in interface StateReward_PerceptListener
public synchronized void addIntActionListener(intActionListener l)
The specified ActionListeners actionPerformed method will be called each time the button is clicked. The ActionListener object is added to a list of ActionListeners managed by this button, it can be removed with removeActionListener. Note: the JavaBeans specification does not require ActionListeners to run in any particular order.
Parameter Description l the ActionListener
See Also: removeActionListener
public synchronized void removeIntActionListener(intActionListener l)
Remove this ActionListener from the buttons internal list. If the ActionListener isn't on the list, silently do nothing.
Parameter Description l the ActionListener
See Also: addActionListener
public synchronized void paint(Graphics g)
- Overrides:
- paint in class Canvas
public Dimension getMinimumSize()
- Overrides:
- getMinimumSize in class Component
All Packages This Package Class Hierarchy Class Search IndexFreshly brewed Java API Documentation automatically generated with polardoc Version 1.0.4