Class Controller

java.lang.Object
org.moeaframework.analysis.diagnostics.Controller

public class Controller extends Object
The controller manages the underlying data model, performs the evaluation of jobs, and notifies any listeners when its state changes.
  • Constructor Details

    • Controller

      public Controller(DiagnosticTool frame)
      Constructs a new controller for the specified DiagnosticTool instance.
      Parameters:
      frame - the DiagnosticTool instance using this controller
  • Method Details

    • addControllerListener

      public void addControllerListener(ControllerListener listener)
      Adds the specified listener to receive all subsequent controller events.
      Parameters:
      listener - the listener to receive controller events
    • removeControllerListener

      public void removeControllerListener(ControllerListener listener)
      Removes the specified listener so it no longer receives controller events.
      Parameters:
      listener - the listener to no longer receive controller events
    • fireSettingsChangedEvent

      protected void fireSettingsChangedEvent()
      Fires a ControllerEvent.Type.SETTINGS_CHANGED controller event.
    • fireModelChangedEvent

      protected void fireModelChangedEvent()
      Fires a ControllerEvent.Type.MODEL_CHANGED controller event.
    • fireStateChangedEvent

      protected void fireStateChangedEvent()
      Fires a ControllerEvent.Type.STATE_CHANGED controller event.
    • fireProgressChangedEvent

      protected void fireProgressChangedEvent()
      Fires a ControllerEvent.Type.PROGRESS_CHANGED controller event.
    • fireViewChangedEvent

      protected void fireViewChangedEvent()
      Fires a ControllerEvent.Type.VIEW_CHANGED controller event.
    • fireEvent

      protected void fireEvent(ControllerEvent event)
      Fires the specified controller event. All listeners will receive this event on the event dispatch thread.
      Parameters:
      event - the controller event to fire
    • add

      public void add(ResultKey key, Observations observation)
      Adds a new result to this controller. If the specified key already exists, the observation is appended to the existing results. A ControllerEvent.Type.MODEL_CHANGED event is fired.
      Parameters:
      key - the result key identifying the algorithm and problem associated with these results
      observation - the observation storing the results
    • add

      public void add(String algorithm, String problem, Observations observation)
      Adds a new result to this controller. This method invokes add(ResultKey, Observations).
      Parameters:
      algorithm - the algorithm associated with these results
      problem - the problem associated with these results
      observation - the observation storing the results
    • clear

      public void clear()
      Clears all results from this collector. A ControllerEvent.Type.MODEL_CHANGED event is fired.
    • get

      public List<Observations> get(ResultKey key)
      Returns an unmodifiable collection containing the results associated with the specified key.
      Parameters:
      key - the result key
      Returns:
      an unmodifiable collection containing the results associated with the specified key
    • getKeys

      public Set<ResultKey> getKeys()
      Returns an unmodifiable set of result keys contained in this controller.
      Returns:
      an unmodifiable set of result keys contained in this controller
    • getLastObservation

      public Observations getLastObservation()
      Returns the last observation to be generated; or null if there is none or has been cleared
      Returns:
      the last observation to be generated; or null
    • clearLastObservation

      public void clearLastObservation()
      Clears the last observation. Subsequent invocations of getLastObservation() will return null until a new observation is generated.
    • saveData

      public void saveData(File file) throws IOException
      Saves all results stored in this controller to the specified file.
      Parameters:
      file - the file to which the results are saved
      Throws:
      IOException - if an I/O error occurred
    • loadData

      public void loadData(File file) throws IOException
      Loads all results stored in the specified file. A ControllerEvent.Type.MODEL_CHANGED event is fired.
      Parameters:
      file - the file containing the results to load
      Throws:
      IOException - if an I/O error occurred
    • updateProgress

      protected void updateProgress(int currentEvaluation, int currentSeed, int totalEvaluations, int totalSeeds)
      Updates the progress of this controller. A ControllerEvent.Type.PROGRESS_CHANGED event is fired.
      Parameters:
      currentEvaluation - the current evaluation number
      currentSeed - the current seed number
      totalEvaluations - the total number of evaluations
      totalSeeds - the total number of seeds
    • showStatistics

      public StatisticalResultsViewer showStatistics()
      Creates and displays a dialog containing a statistical comparison of the selected results.
      Returns:
      the dialog, or null if unable to display
    • run

      public void run()
      Launches a thread to run the current evaluation job.
    • cancel

      public void cancel()
      Notifies the controller that it should cancel the current evaluation job.
    • isRunning

      public boolean isRunning()
      Returns true if this controller is currently processing an evaluation job; false otherwise.
      Returns:
      true if this controller is currently processing an evaluation job; false otherwise
    • join

      public void join() throws InterruptedException
      Waits for the currently running thread to finish. If there is no such thread, this method returns immediately.
      Throws:
      InterruptedException - if the thread was interrupted
    • showLastTrace

      public org.moeaframework.analysis.diagnostics.Controller.Toggle showLastTrace()
      Returns the setting for displaying the last trace.
      Returns:
      the setting object
    • includeHypervolume

      public org.moeaframework.analysis.diagnostics.Controller.Toggle includeHypervolume()
      Returns the setting for collecting the hypervolume indicator.
      Returns:
      the setting object
    • includeGenerationalDistance

      public org.moeaframework.analysis.diagnostics.Controller.Toggle includeGenerationalDistance()
      Returns the setting for collecting the generational distance (GD) indicator.
      Returns:
      the setting object
    • includeGenerationalDistancePlus

      public org.moeaframework.analysis.diagnostics.Controller.Toggle includeGenerationalDistancePlus()
      Returns the setting for collecting the generational distance plus (GD+) indicator.
      Returns:
      the setting object
    • includeInvertedGenerationalDistance

      public org.moeaframework.analysis.diagnostics.Controller.Toggle includeInvertedGenerationalDistance()
      Returns the setting for collecting the inverted generational distance (IGD) indicator.
      Returns:
      the setting object
    • includeInvertedGenerationalDistancePlus

      public org.moeaframework.analysis.diagnostics.Controller.Toggle includeInvertedGenerationalDistancePlus()
      Returns the setting for collecting the inverted generational distance plus (IGD+) indicator.
      Returns:
      the setting object
    • includeSpacing

      public org.moeaframework.analysis.diagnostics.Controller.Toggle includeSpacing()
      Returns the setting for collecting the spacing indicator.
      Returns:
      the setting object
    • includeAdditiveEpsilonIndicator

      public org.moeaframework.analysis.diagnostics.Controller.Toggle includeAdditiveEpsilonIndicator()
      Returns the setting for collecting the additive epsilon indicator.
      Returns:
      the setting object
    • includeContribution

      public org.moeaframework.analysis.diagnostics.Controller.Toggle includeContribution()
      Returns the setting for collecting the contribution indicator.
      Returns:
      the setting object
    • includeR1

      public org.moeaframework.analysis.diagnostics.Controller.Toggle includeR1()
      Returns the setting for collecting the R1 indicator.
      Returns:
      the setting object
    • includeR2

      public org.moeaframework.analysis.diagnostics.Controller.Toggle includeR2()
      Returns the setting for collecting the R2 indicator.
      Returns:
      the setting object
    • includeR3

      public org.moeaframework.analysis.diagnostics.Controller.Toggle includeR3()
      Returns the setting for collecting the R3 indicator.
      Returns:
      the setting object
    • includeEpsilonProgress

      public org.moeaframework.analysis.diagnostics.Controller.Toggle includeEpsilonProgress()
      Returns the setting for collecting epsilon progress metrics.
      Returns:
      the setting object
    • includeAdaptiveMultimethodVariation

      public org.moeaframework.analysis.diagnostics.Controller.Toggle includeAdaptiveMultimethodVariation()
      Returns the setting for collecting adaptive multimethod variation probabilities.
      Returns:
      the setting object
    • includeAdaptiveTimeContinuation

      public org.moeaframework.analysis.diagnostics.Controller.Toggle includeAdaptiveTimeContinuation()
      Returns the setting for collecting adaptive time continuation metrics.
      Returns:
      the setting object
    • includeElapsedTime

      public org.moeaframework.analysis.diagnostics.Controller.Toggle includeElapsedTime()
      Returns the setting for collecting the elapsed runtime.
      Returns:
      the setting object
    • includeApproximationSet

      public org.moeaframework.analysis.diagnostics.Controller.Toggle includeApproximationSet()
      Returns the setting for collecting the approximation set.
      Returns:
      the setting object
    • includePopulationSize

      public org.moeaframework.analysis.diagnostics.Controller.Toggle includePopulationSize()
      Returns the setting for collecting the population / archive size.
      Returns:
      the setting object
    • showIndividualTraces

      public org.moeaframework.analysis.diagnostics.Controller.Toggle showIndividualTraces()
      Returns the setting for displaying individual traces versus quantiles.
      Returns:
      the setting object
    • getRunProgress

      public int getRunProgress()
      Returns the run progress of the current job being evaluated. The run progress measures the number of evaluations completed thus far.
      Returns:
      the run progress of the current job being evaluated
    • getOverallProgress

      public int getOverallProgress()
      Returns the overall progress of the current job being evaluated. The overall progress measures the number of seeds completed thus far.
      Returns:
      the overall progress of the current job being evaluated
    • handleException

      protected void handleException(Exception e)
      Handles an exception, possibly displaying a dialog box containing details of the exception.
      Parameters:
      e - the exception