Class Controller
java.lang.Object
org.moeaframework.analysis.diagnostics.Controller
The controller manages the underlying data model, performs the evaluation of jobs, and notifies any listeners when
its state changes.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
Represents a setting that can be configured programmatically or through user interaction in the UI. -
Constructor Summary
ConstructorDescriptionController
(DiagnosticTool frame) Constructs a new controller for the specifiedDiagnosticTool
instance. -
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(String algorithm, String problem, Observations observation) Adds a new result to this controller.void
add
(ResultKey key, Observations observation) Adds a new result to this controller.void
addControllerListener
(ControllerListener listener) Adds the specified listener to receive all subsequent controller events.void
cancel()
Notifies the controller that it should cancel the current evaluation job.void
clear()
Clears all results from this collector.void
Clears the last observation.protected void
fireEvent
(ControllerEvent event) Fires the specified controller event.protected void
Fires aControllerEvent.Type.MODEL_CHANGED
controller event.protected void
Fires aControllerEvent.Type.PROGRESS_CHANGED
controller event.protected void
Fires aControllerEvent.Type.SETTINGS_CHANGED
controller event.protected void
Fires aControllerEvent.Type.STATE_CHANGED
controller event.protected void
Fires aControllerEvent.Type.VIEW_CHANGED
controller event.Returns an unmodifiable collection containing the results associated with the specified key.getKeys()
Returns an unmodifiable set of result keys contained in this controller.Returns the last observation to be generated; ornull
if there is none or has been clearedint
Returns the overall progress of the current job being evaluated.int
Returns the run progress of the current job being evaluated.protected void
Handles an exception, possibly displaying a dialog box containing details of the exception.org.moeaframework.analysis.diagnostics.Controller.Toggle
Returns the setting for collecting adaptive multimethod variation probabilities.org.moeaframework.analysis.diagnostics.Controller.Toggle
Returns the setting for collecting adaptive time continuation metrics.org.moeaframework.analysis.diagnostics.Controller.Toggle
Returns the setting for collecting the additive epsilon indicator.org.moeaframework.analysis.diagnostics.Controller.Toggle
Returns the setting for collecting the approximation set.org.moeaframework.analysis.diagnostics.Controller.Toggle
Returns the setting for collecting the contribution indicator.org.moeaframework.analysis.diagnostics.Controller.Toggle
Returns the setting for collecting the elapsed runtime.org.moeaframework.analysis.diagnostics.Controller.Toggle
Returns the setting for collecting epsilon progress metrics.org.moeaframework.analysis.diagnostics.Controller.Toggle
Returns the setting for collecting the generational distance (GD) indicator.org.moeaframework.analysis.diagnostics.Controller.Toggle
Returns the setting for collecting the generational distance plus (GD+) indicator.org.moeaframework.analysis.diagnostics.Controller.Toggle
Returns the setting for collecting the hypervolume indicator.org.moeaframework.analysis.diagnostics.Controller.Toggle
Returns the setting for collecting the inverted generational distance (IGD) indicator.org.moeaframework.analysis.diagnostics.Controller.Toggle
Returns the setting for collecting the inverted generational distance plus (IGD+) indicator.org.moeaframework.analysis.diagnostics.Controller.Toggle
Returns the setting for collecting the population / archive size.org.moeaframework.analysis.diagnostics.Controller.Toggle
Returns the setting for collecting the R1 indicator.org.moeaframework.analysis.diagnostics.Controller.Toggle
Returns the setting for collecting the R2 indicator.org.moeaframework.analysis.diagnostics.Controller.Toggle
Returns the setting for collecting the R3 indicator.org.moeaframework.analysis.diagnostics.Controller.Toggle
Returns the setting for collecting the spacing indicator.boolean
Returnstrue
if this controller is currently processing an evaluation job;false
otherwise.void
join()
Waits for the currently running thread to finish.void
Loads all results stored in the specified file.void
removeControllerListener
(ControllerListener listener) Removes the specified listener so it no longer receives controller events.void
run()
Launches a thread to run the current evaluation job.void
Saves all results stored in this controller to the specified file.org.moeaframework.analysis.diagnostics.Controller.Toggle
Returns the setting for displaying individual traces versus quantiles.org.moeaframework.analysis.diagnostics.Controller.Toggle
Returns the setting for displaying the last trace.Creates and displays a dialog containing a statistical comparison of the selected results.protected void
updateProgress
(int currentEvaluation, int currentSeed, int totalEvaluations, int totalSeeds) Updates the progress of this controller.
-
Constructor Details
-
Controller
Constructs a new controller for the specifiedDiagnosticTool
instance.- Parameters:
frame
- theDiagnosticTool
instance using this controller
-
-
Method Details
-
addControllerListener
Adds the specified listener to receive all subsequent controller events.- Parameters:
listener
- the listener to receive controller events
-
removeControllerListener
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 aControllerEvent.Type.SETTINGS_CHANGED
controller event. -
fireModelChangedEvent
protected void fireModelChangedEvent()Fires aControllerEvent.Type.MODEL_CHANGED
controller event. -
fireStateChangedEvent
protected void fireStateChangedEvent()Fires aControllerEvent.Type.STATE_CHANGED
controller event. -
fireProgressChangedEvent
protected void fireProgressChangedEvent()Fires aControllerEvent.Type.PROGRESS_CHANGED
controller event. -
fireViewChangedEvent
protected void fireViewChangedEvent()Fires aControllerEvent.Type.VIEW_CHANGED
controller event. -
fireEvent
Fires the specified controller event. All listeners will receive this event on the event dispatch thread.- Parameters:
event
- the controller event to fire
-
add
Adds a new result to this controller. If the specified key already exists, the observation is appended to the existing results. AControllerEvent.Type.MODEL_CHANGED
event is fired.- Parameters:
key
- the result key identifying the algorithm and problem associated with these resultsobservation
- the observation storing the results
-
add
Adds a new result to this controller. This method invokesadd(ResultKey, Observations)
.- Parameters:
algorithm
- the algorithm associated with these resultsproblem
- the problem associated with these resultsobservation
- the observation storing the results
-
clear
public void clear()Clears all results from this collector. AControllerEvent.Type.MODEL_CHANGED
event is fired. -
get
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
Returns an unmodifiable set of result keys contained in this controller.- Returns:
- an unmodifiable set of result keys contained in this controller
-
getLastObservation
Returns the last observation to be generated; ornull
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 ofgetLastObservation()
will returnnull
until a new observation is generated. -
saveData
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
Loads all results stored in the specified file. AControllerEvent.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. AControllerEvent.Type.PROGRESS_CHANGED
event is fired.- Parameters:
currentEvaluation
- the current evaluation numbercurrentSeed
- the current seed numbertotalEvaluations
- the total number of evaluationstotalSeeds
- the total number of seeds
-
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()Returnstrue
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
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
Handles an exception, possibly displaying a dialog box containing details of the exception.- Parameters:
e
- the exception
-