Class SGameModelController

java.lang.Object
  extended by SGameController
      extended by SGameModelController

public class SGameModelController
extends SGameController

This applet demonstrates a simple game. It isn't designed to be general or reusable.

Copyright (C) 2006 David Poole.

This program gives core of the simulation. The GUI is in SGameGUI.java. The environment code is at SGameEnv.java. This controller is at SGameQController.java.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.


Field Summary
 int ACTION_SIZE
           
 int DAMAGE_SIZE
           
 int PRIZE_SIZE
           
 int STATE_SIZE
           
 int X_SIZE
           
 int Y_SIZE
           
 
Fields inherited from class SGameController
tracing
 
Method Summary
 void doreset(double initVal)
          resets the Q-values, and all of the transitions.
 void dostep(int action)
          does one step.
 void doSteps(int numsteps, double greedyProb)
          do numsteps number of steps This is where you would put your controller
 int getCounts(int xval, int yval, int action)
          The GUI uses getCounts(x,y,a) to display counts.
 double num_updates()
           
 double qvalue(int xval, int yval, int action)
          The GUI uses qvalue(x,y,a) to display values and arrows.
 int state(int xval, int yval, int prize, boolean damage)
          gets the state from the xpos, ypos, prize, damage
 double value(int state)
          determines the value of a state the value is the maximum, for all actions, of the q-value
 
Methods inherited from class SGameController
getAlpha, getAlphaFixed, getDiscount, getEnvironment, getTitle, setAlpha, setAlphaFixed, setDiscount, toDisplay
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

X_SIZE

public final int X_SIZE
See Also:
Constant Field Values

Y_SIZE

public final int Y_SIZE
See Also:
Constant Field Values

PRIZE_SIZE

public final int PRIZE_SIZE
See Also:
Constant Field Values

DAMAGE_SIZE

public final int DAMAGE_SIZE
See Also:
Constant Field Values

STATE_SIZE

public final int STATE_SIZE
See Also:
Constant Field Values

ACTION_SIZE

public final int ACTION_SIZE
See Also:
Constant Field Values
Method Detail

num_updates

public double num_updates()

qvalue

public double qvalue(int xval,
                     int yval,
                     int action)
The GUI uses qvalue(x,y,a) to display values and arrows.

Overrides:
qvalue in class SGameController

getCounts

public int getCounts(int xval,
                     int yval,
                     int action)
The GUI uses getCounts(x,y,a) to display counts.

Overrides:
getCounts in class SGameController

state

public int state(int xval,
                 int yval,
                 int prize,
                 boolean damage)
gets the state from the xpos, ypos, prize, damage


doreset

public void doreset(double initVal)
resets the Q-values, and all of the transitions.

Overrides:
doreset in class SGameController
Parameters:
initVal - the initial value given by a box in the GUI

dostep

public void dostep(int action)
does one step. carries out the action in the environment. This may be a place to record what the agent has learned from its experience.

Overrides:
dostep in class SGameController
Parameters:
action - the action that the agent does

value

public double value(int state)
determines the value of a state the value is the maximum, for all actions, of the q-value

Parameters:
state -
Returns:
the value of the state

doSteps

public void doSteps(int numsteps,
                    double greedyProb)
do numsteps number of steps This is where you would put your controller

Overrides:
doSteps in class SGameController
Parameters:
numsteps - the number of steps to do
greedyProb - the probability that is step is chosen greedily