Class BasicPSOPanel

All Implemented Interfaces:
ActionListener, ItemListener, KeyListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, RootPaneContainer, WindowConstants
Direct Known Subclasses:
BPSOPanel, CPSOPanel, HPSO_LSPanel, PSO42Panel

public abstract class BasicPSOPanel extends ParameterPanel implements ItemListener
This java class is used to create and show a panel for the parameter settings of the basic particle swarm optimization (BasicPSO) method.
Author:
Sina Tabakhi
See Also:
  • Field Details

    • btn_classifierType

      protected JButton btn_classifierType
  • Constructor Details

    • BasicPSOPanel

      public BasicPSOPanel()
      Creates new form BasicPSOPanel. This method is called from within the constructor to initialize the form.
  • Method Details

    • keyReleased

      public void keyReleased(KeyEvent e)
      The listener method for receiving keyboard events (keystrokes). Invoked when a key has been released.
      Specified by:
      keyReleased in interface KeyListener
      Specified by:
      keyReleased in class ParameterPanel
      Parameters:
      e - an action event
    • actionPerformed

      public void actionPerformed(ActionEvent e)
      The listener method for receiving action events. Invoked when an action occurs.
      Specified by:
      actionPerformed in interface ActionListener
      Overrides:
      actionPerformed in class ParameterPanel
      Parameters:
      e - an action event
    • itemStateChanged

      public void itemStateChanged(ItemEvent e)
      The listener method for receiving item events. Invoked when an item has been selected or deselected by the user.
      Specified by:
      itemStateChanged in interface ItemListener
      Parameters:
      e - an action event
    • btn_okActionPerformed

      protected void btn_okActionPerformed(ActionEvent e)
      This method sets an action for the btn_ok button.
      Overrides:
      btn_okActionPerformed in class ParameterPanel
      Parameters:
      e - an action event
    • getClassifierType

      public ClassifierType getClassifierType()
      This method returns the selected classifier type.
      Returns:
      the classifierType parameter
    • setClassifierType

      public void setClassifierType(ClassifierType classifierType)
      This method sets the selected classifier type.
      Parameters:
      classifierType - the selected classifier type
    • getSelectedClassifierPan

      public Object getSelectedClassifierPan()
      This method returns the selected classifier panel value.
      Returns:
      the selectedClassifierPan parameter
    • setSelectedClassifierPan

      public void setSelectedClassifierPan(Object selectedClassifierPan)
      This method sets the selected classifier panel value.
      Parameters:
      selectedClassifierPan - the selected classifier panel value
    • getNumIteration

      public int getNumIteration()
      This method returns the number of iterations value.
      Returns:
      the numIteration parameter
    • setNumIteration

      public void setNumIteration(int numIteration)
      This method sets the number of iterations value.
      Parameters:
      numIteration - the number of iterations value
    • getPopulationSize

      public int getPopulationSize()
      This method returns the size of population value.
      Returns:
      the populationSize parameter
    • setPopulationSize

      public void setPopulationSize(int populationSize)
      This method sets the size of population value.
      Parameters:
      populationSize - the size of population value
    • getInertiaWeight

      public double getInertiaWeight()
      This method returns the inertia weight (w) value.
      Returns:
      the inertiaWeight parameter
    • setInertiaWeight

      public void setInertiaWeight(double inertiaWeight)
      This method sets the inertia weight (w) value.
      Parameters:
      inertiaWeight - the inertia weight (w) value
    • getC1

      public double getC1()
      This method returns the c1 value.
      Returns:
      the c1 parameter
    • setC1

      public void setC1(double c1)
      This method sets the c1 value.
      Parameters:
      c1 - the c1 value
    • getC2

      public double getC2()
      This method returns the c2 value.
      Returns:
      the c2 parameter
    • setC2

      public void setC2(double c2)
      This method sets the c2 value.
      Parameters:
      c2 - the c2 value
    • getStartPosInterval

      public double getStartPosInterval()
      This method returns the position interval start value.
      Returns:
      the startPosInterval parameter
    • setStartPosInterval

      public void setStartPosInterval(double startPosInterval)
      This method sets the position interval start value.
      Parameters:
      startPosInterval - the position interval start value
    • getEndPosInterval

      public double getEndPosInterval()
      This method returns the position interval end value.
      Returns:
      the endPosInterval parameter
    • setEndPosInterval

      public void setEndPosInterval(double endPosInterval)
      This method sets the position interval end value.
      Parameters:
      endPosInterval - the position interval end value
    • getMinVelocity

      public double getMinVelocity()
      This method returns the velocity interval start value.
      Returns:
      the minVelocity parameter
    • setMinVelocity

      public void setMinVelocity(double minVelocity)
      This method sets the velocity interval start value.
      Parameters:
      minVelocity - the velocity interval start value
    • getMaxVelocity

      public double getMaxVelocity()
      This method returns the velocity interval end value.
      Returns:
      the maxVelocity parameter
    • setMaxVelocity

      public void setMaxVelocity(double maxVelocity)
      This method sets the velocity interval end value.
      Parameters:
      maxVelocity - the velocity interval end value
    • getKFolds

      public int getKFolds()
      This method returns the k folds value.
      Returns:
      the kFolds parameter
    • setKFolds

      public void setKFolds(int kFolds)
      This method sets the k folds value.
      Parameters:
      kFolds - the k folds value
    • setDefaultValue

      public void setDefaultValue()
      Sets the default values of the basic PSO parameters
    • changeDefaultValue

      public void changeDefaultValue(int numIteration, int populationSize, double inertiaWeight, double c1, double c2, double startPosInterval, double endPosInterval, double minVelocity, double maxVelocity, int kFolds)
      Replaces the default values of basic PSO parameters with user values
      Parameters:
      numIteration - the maximum number of allowed iterations that algorithm repeated
      populationSize - the size of population of candidate solutions
      inertiaWeight - the inertia weight in the velocity updating rule
      c1 - the acceleration constant in the velocity updating rule
      c2 - the acceleration constant in the velocity updating rule
      startPosInterval - the position interval start value of each particle
      endPosInterval - the position interval end value of each particle
      minVelocity - the velocity interval end value of each particle
      maxVelocity - the velocity interval end value of each particle
      kFolds - the number of equal sized subsamples that is used in k-fold cross validation
    • enablePositionValues

      public void enablePositionValues(boolean enable)
      Enables the values of text box
      Parameters:
      enable - the status of the value
    • setUserValue

      public void setUserValue(ClassifierType classifierType, Object selectedClassifierPan, int numIteration, int populationSize, double inertiaWeight, double c1, double c2, double startPosInterval, double endPosInterval, double minVelocity, double maxVelocity, int kFolds)
      Sets the last values of the basic PSO parameters entered by user
      Parameters:
      classifierType - the selected classifier type
      selectedClassifierPan - the selected classifier panel
      numIteration - the maximum number of allowed iterations that algorithm repeated
      populationSize - the size of population of candidate solutions
      inertiaWeight - the inertia weight in the velocity updating rule
      c1 - the acceleration constant in the velocity updating rule
      c2 - the acceleration constant in the velocity updating rule
      startPosInterval - the position interval start value of each particle
      endPosInterval - the position interval end value of each particle
      minVelocity - the velocity interval end value of each particle
      maxVelocity - the velocity interval end value of each particle
      kFolds - the number of equal sized subsamples that is used in k-fold cross validation