All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class gpsys.lawnmower.LawnMower

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----java.awt.Window
                           |
                           +----java.awt.Frame
                                   |
                                   +----gpsys.lawnmower.LawnMower

public class LawnMower
extends Frame
implements GPObserver
The user interface for the lawn mower problem. This class also contains the main() function to execute the application.

Version:
1.1, 30th June '97
Author:
Adil Qureshi
Department of Computer Science,
University College London,
Gower St,
London WC1E 6BT,
UK.

Constructor Index

 o LawnMower(Lawn, String)
Construct a lawn mower user interface.

Method Index

 o diagnosticUpdate(String)
Print the diagnostic message to the standard output.
 o exception(GPException)
Print the exception and generate a stack trace on the standard output.
 o generationUpdate(GPParameters, int)
If the filePrefix is null, just write a report of the current generation to the standard output.
 o individualUpdate(GPParameters, Individual, int)
We are not interested in this update, so we just ignore it.
 o individualUpdate(GPParameters, int, int)
We are not interested in this update, so we just ignore it.
 o main(String[])
The main() method of the lawn mower application.

Constructors

 o LawnMower
 public LawnMower(Lawn lawn,
                  String filePrefix)
Construct a lawn mower user interface.

Parameters:
lawn - The lawn being mowed.
lawn - The file prefix to use for saving generations and writing reports.

Methods

 o generationUpdate
 public void generationUpdate(GPParameters gpParameters,
                              int how)
If the filePrefix is null, just write a report of the current generation to the standard output. Otherwise, also append the report to the file "filePrefix.txt" and save the current generation to the file "filePrefix.p1.gzip". If the termination criteria has been met, or the maximum number of generations have been reached, visualise the best lawn mower in action!!!

Parameters:
gpParameters - The GP parameters used for this run.
how - How the generation was created. Can be either CREATION, FROMSTREAM or EVOLVED.
 o individualUpdate
 public void individualUpdate(GPParameters gpParameters,
                              Individual i,
                              int creationIndex)
We are not interested in this update, so we just ignore it.

Parameters:
gpParameters - the GP parameters used for this run.
i - the Individual that has just been created.
creationIndex - the index of the Individual in the population.
 o individualUpdate
 public void individualUpdate(GPParameters gpParameters,
                              int individualIndex,
                              int creationMethod)
We are not interested in this update, so we just ignore it.

Parameters:
gpParameters - the GP parameters used for this run.
individualIndex - the index of the created Individual in the population.
creationMethod - how the Individual was created. Can be either VIA_MUTATION or VIA_CROSSOVER.
 o diagnosticUpdate
 public void diagnosticUpdate(String s)
Print the diagnostic message to the standard output.

Parameters:
s - The diagnostic message.
 o exception
 public void exception(GPException e)
Print the exception and generate a stack trace on the standard output.

Parameters:
e - The exception that was genearted.
 o main
 public static void main(String argv[])
The main() method of the lawn mower application. This application may be invoked in any of the following ways.
		java LawnMower <filePrefix>
		java LawnMower <filePrefix> <generations>
		java LawnMower <filePrefix> <RNG seed> <population> <generations>
		java LawnMower <RNG seed> <population> <generations>
 
The first istructs the application to restart from the last saved session using the files with the prefix specified. The second is the same as the first, execept that the maximum number of geneartion is modified as specified. The third istructs the application to start a new run using the specifed file prefix for saves, and the specified parameters for the run. The last is the similar to the previous invokation except that nothing is saved to disk, and is hence very fast.


All Packages  Class Hierarchy  This Package  Previous  Next  Index