bodhidharma.classifiers.genetic_algorithms
Class GeneticAlgorithmJFrame

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Window
              extended by java.awt.Frame
                  extended by javax.swing.JFrame
                      extended by bodhidharma.classifiers.genetic_algorithms.GeneticAlgorithmJFrame
All Implemented Interfaces:
java.awt.event.ActionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants

public class GeneticAlgorithmJFrame
extends javax.swing.JFrame
implements java.awt.event.ActionListener

Dialog box used to hold and edit the basic parameters of new genetic algorithms.

IMPORTANT: These parameters are used when new genetic algorithm systems are created. They do not affect existing genetic algorithm systems.

The Bits Per Word field sets the number of bits used for each word in the DNA bit string of Chromosome objects. Some implementations of genetic algorithms ignore this field (in cases where the word size is fixed).

The Population Size field sets the total number of chromosomes in one generation in all villages put together.

The Mating Rate field sets the fraction of the population that can serve as parents during each generation. Must be between 0 and 1.

The Mutation Probability field sets the probability that any bit in the DNA bit string of Chromosome object will flip after crossover. Must be between 0 and 1.

The Elitism Allowed field sets whether the best performing chromosome is cloned to the next generation.

The Number of Villages field sets the number of isolated villages in which Chromosome objects evolve. There is interchange between villages periodicallly (see bottom two parameters).

The Migration Delay field sets the number of generations which pass between chromosome interchanges between villages. This field has no effect if there is only one village.

The Migration Size field sets the number of chromosomes that are exchanged between villages during interchanges. This field has no effect if there is only one village.

It should be noted that error messages are given if these parameters are incorrectly set.

The various get methods of this class can be used by external objects to access the stored parameters.

The OK button stores the entered settings. An error message is displayed if there is a problem with the parameters.

The Cancel button cancels the entered settings and restores the previous values.

See Also:
BioKNearestNeighbour, Breeder, PreferencesPanel, Serialized Form
Author:
Cory McKay

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JFrame
javax.swing.JFrame.AccessibleJFrame
 
Nested classes/interfaces inherited from class java.awt.Frame
java.awt.Frame.AccessibleAWTFrame
 
Nested classes/interfaces inherited from class java.awt.Window
java.awt.Window.AccessibleAWTWindow
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
 
Fields inherited from class javax.swing.JFrame
accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
GeneticAlgorithmJFrame(PreferencesPanel parent)
          Basic constructor.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent event)
          Calls the appropriate methods when the buttons are pressed.
 boolean getElitism()
          Return the value of the elitism field
 double getMatingRate()
          Return the value of the mating_rate field
 int getMigrationDelay()
          Return the value of the migration_delay field
 int getMigrationSize()
          Return the value of the migration_size field
 double getMutationProbability()
          Return the value of the mutation_probability field
 int getNumberVillages()
          Return the value of the number_villages field
 int getPopulationSize()
          Return the value of the population_size field
 int getWordLength()
          Return the value of the word_length field
 void setElitism(java.lang.String value)
          Set the value of the elitism and elitism_checkbox fields
 void setMatingRate(java.lang.String value)
          Set the value of the mating_rate and mating_rate_text_area fields
 void setMigrationDelay(java.lang.String value)
          Set the value of the migration_delay and migration_delay_text_area fields
 void setMigrationSize(java.lang.String value)
          Set the value of the migration_size and migration_size_text_area fields
 void setMutationProbability(java.lang.String value)
          Set the value of the mutation_probability and mutation_probability_text_area fields
 void setNumberVillages(java.lang.String value)
          Set the value of the number_villages and number_villages_text_area fields
 void setPopulationSize(java.lang.String value)
          Set the value of the population_size and population_size_text_area fields
 void setWordLength(java.lang.String value)
          Set the value of the word_length and word_length fields
 
Methods inherited from class javax.swing.JFrame
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, update
 
Methods inherited from class java.awt.Frame
addNotify, finalize, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setResizable, setState, setTitle, setUndecorated
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getMostRecentFocusOwner, getOwnedWindows, getOwner, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, setAlwaysOnTop, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setLocationByPlatform, setLocationRelativeTo, show, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Constructor Detail

GeneticAlgorithmJFrame

public GeneticAlgorithmJFrame(PreferencesPanel parent)
Basic constructor. Configures the panel and its fields. Removes access to the parent JFrame.

Parameters:
parent - Name of the JFrame window that spawned this dialog box.
Method Detail

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent event)
Calls the appropriate methods when the buttons are pressed.

Specified by:
actionPerformed in interface java.awt.event.ActionListener
Parameters:
event - The event that is to be reacted to.

getWordLength

public int getWordLength()
Return the value of the word_length field


getPopulationSize

public int getPopulationSize()
Return the value of the population_size field


getMatingRate

public double getMatingRate()
Return the value of the mating_rate field


getMutationProbability

public double getMutationProbability()
Return the value of the mutation_probability field


getElitism

public boolean getElitism()
Return the value of the elitism field


getNumberVillages

public int getNumberVillages()
Return the value of the number_villages field


getMigrationDelay

public int getMigrationDelay()
Return the value of the migration_delay field


getMigrationSize

public int getMigrationSize()
Return the value of the migration_size field


setWordLength

public void setWordLength(java.lang.String value)
                   throws java.lang.Exception
Set the value of the word_length and word_length fields

Throws:
java.lang.Exception

setPopulationSize

public void setPopulationSize(java.lang.String value)
                       throws java.lang.Exception
Set the value of the population_size and population_size_text_area fields

Throws:
java.lang.Exception

setMatingRate

public void setMatingRate(java.lang.String value)
                   throws java.lang.Exception
Set the value of the mating_rate and mating_rate_text_area fields

Throws:
java.lang.Exception

setMutationProbability

public void setMutationProbability(java.lang.String value)
                            throws java.lang.Exception
Set the value of the mutation_probability and mutation_probability_text_area fields

Throws:
java.lang.Exception

setElitism

public void setElitism(java.lang.String value)
                throws java.lang.Exception
Set the value of the elitism and elitism_checkbox fields

Throws:
java.lang.Exception

setNumberVillages

public void setNumberVillages(java.lang.String value)
                       throws java.lang.Exception
Set the value of the number_villages and number_villages_text_area fields

Throws:
java.lang.Exception

setMigrationDelay

public void setMigrationDelay(java.lang.String value)
                       throws java.lang.Exception
Set the value of the migration_delay and migration_delay_text_area fields

Throws:
java.lang.Exception

setMigrationSize

public void setMigrationSize(java.lang.String value)
                      throws java.lang.Exception
Set the value of the migration_size and migration_size_text_area fields

Throws:
java.lang.Exception