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.
-
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 aMODEL_CHANGED
controller event.protected void
Fires aPROGRESS_CHANGED
controller event.protected void
Fires aSTATE_CHANGED
controller event.protected void
Fires aVIEW_CHANGED
controller event.Returns an unmodifiable collection containing the results associated with the specified key.boolean
Returnstrue
if the adaptive multimethod variation collector is included;false
otherwise.boolean
Returnstrue
if the adaptive time continuation collector is included;false
otherwise.boolean
Returnstrue
if the additive ε-indicator collector is included;false
otherwise.boolean
Returnstrue
if the approximation set collector is included;false
otherwise.boolean
Returnstrue
if the contribution indicator collector is included;false
otherwise.boolean
Returnstrue
if the elapsed time collector is included;false
otherwise.boolean
Returnstrue
if the ε-progress collector is included;false
otherwise.boolean
Returnstrue
if the generational distance indicator collector is included;false
otherwise.boolean
Returnstrue
if the hypervolume indicator collector is included;false
otherwise.boolean
Returnstrue
if the inverted generational distance indicator collector is included;false
otherwise.boolean
Returnstrue
if the population size collector is included;false
otherwise.boolean
Returnstrue
if the R1 indicator collector is included;false
otherwise.boolean
Returnstrue
if the R2 indicator collector is included;false
otherwise.boolean
Returnstrue
if the R3 indicator collector is included;false
otherwise.boolean
Returnstrue
if the spacing indicator collector is included;false
otherwise.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.boolean
Returnstrue
if individual traces are shown;false
if quantiles are shown.boolean
Returnstrue
if the last run's trace is displayed;false
otherwise.protected void
Handles an exception, possibly displaying a dialog box containing details of the exception.boolean
Returnstrue
if this controller is currently processing an evaluation job;false
otherwise.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.void
setIncludeAdaptiveMultimethodVariation
(boolean includeAdaptiveMultimethodVariation) Sets the inclusion of the adaptive multimethod variation collector.void
setIncludeAdaptiveTimeContinuation
(boolean includeAdaptiveTimeContinuation) Sets the inclusion of the adaptive time continuation collector.void
setIncludeAdditiveEpsilonIndicator
(boolean includeAdditiveEpsilonIndicator) Sets the inclusion of the additive ε-indicator collector.void
setIncludeApproximationSet
(boolean includeApproximationSet) Sets the inclusion of the approximation set collector.void
setIncludeContribution
(boolean includeContribution) Sets the inclusion of the contribution indicator collector.void
setIncludeElapsedTime
(boolean includeElapsedTime) Sets the inclusion of the elapsed time collector.void
setIncludeEpsilonProgress
(boolean includeEpsilonProgress) Sets the inclusion of the ε-progress collector.void
setIncludeGenerationalDistance
(boolean includeGenerationalDistance) Sets the inclusion of the generational distance indicator collector.void
setIncludeHypervolume
(boolean includeHypervolume) Sets the inclusion of the hypervolume indicator collector.void
setIncludeInvertedGenerationalDistance
(boolean includeInvertedGenerationalDistance) Sets the inclusion of the inverted generational distance indicator collector.void
setIncludePopulationSize
(boolean includePopulationSize) Sets the inclusion of the population size collector.void
setIncludeR1
(boolean includeR1) Sets the inclusion of the R1 indicator collector.void
setIncludeR2
(boolean includeR2) Sets the inclusion of the R2 indicator collector.void
setIncludeR3
(boolean includeR3) Sets the inclusion of the R3 indicator collector.void
setIncludeSpacing
(boolean includeSpacing) Sets the inclusion of the spacing indicator collector.void
setShowIndividualTraces
(boolean showIndividualTraces) Set totrue
to show individual traces;false
to show quantiles.void
setShowLastTrace
(boolean showLastTrace) Sets the display of the last run's trace.void
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
-
fireModelChangedEvent
protected void fireModelChangedEvent()Fires aMODEL_CHANGED
controller event. -
fireStateChangedEvent
protected void fireStateChangedEvent()Fires aSTATE_CHANGED
controller event. -
fireProgressChangedEvent
protected void fireProgressChangedEvent()Fires aPROGRESS_CHANGED
controller event. -
fireViewChangedEvent
protected void fireViewChangedEvent()Fires aVIEW_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. AMODEL_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. AMODEL_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. AMODEL_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. APROGRESS_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
public void showStatistics()Creates and displays a dialog containing a statistical comparison of the selected results. -
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
-
getShowLastTrace
public boolean getShowLastTrace()Returnstrue
if the last run's trace is displayed;false
otherwise.- Returns:
true
if the last run's trace is displayed;false
otherwise
-
setShowLastTrace
public void setShowLastTrace(boolean showLastTrace) Sets the display of the last run's trace.- Parameters:
showLastTrace
-true
if the last run's trace is displayed;false
otherwise
-
getIncludeHypervolume
public boolean getIncludeHypervolume()Returnstrue
if the hypervolume indicator collector is included;false
otherwise.- Returns:
true
if the hypervolume indicator collector is included;false
otherwise
-
setIncludeHypervolume
public void setIncludeHypervolume(boolean includeHypervolume) Sets the inclusion of the hypervolume indicator collector.- Parameters:
includeHypervolume
-true
if the hypervolume collector is included;false
otherwise
-
getIncludeGenerationalDistance
public boolean getIncludeGenerationalDistance()Returnstrue
if the generational distance indicator collector is included;false
otherwise.- Returns:
true
if the generational distance indicator collector is included;false
otherwise
-
setIncludeGenerationalDistance
public void setIncludeGenerationalDistance(boolean includeGenerationalDistance) Sets the inclusion of the generational distance indicator collector.- Parameters:
includeGenerationalDistance
-true
if the generational distance indicator collector is included;false
otherwise
-
getIncludeInvertedGenerationalDistance
public boolean getIncludeInvertedGenerationalDistance()Returnstrue
if the inverted generational distance indicator collector is included;false
otherwise.- Returns:
true
if the inverted generational distance indicator collector is included;false
otherwise
-
setIncludeInvertedGenerationalDistance
public void setIncludeInvertedGenerationalDistance(boolean includeInvertedGenerationalDistance) Sets the inclusion of the inverted generational distance indicator collector.- Parameters:
includeInvertedGenerationalDistance
-true
if the inverted generational distance indicator collector is included;false
otherwise
-
getIncludeSpacing
public boolean getIncludeSpacing()Returnstrue
if the spacing indicator collector is included;false
otherwise.- Returns:
true
if the spacing indicator collector is included;false
otherwise
-
setIncludeSpacing
public void setIncludeSpacing(boolean includeSpacing) Sets the inclusion of the spacing indicator collector.- Parameters:
includeSpacing
-true
if the spacing indicator collector is included;false
otherwise
-
getIncludeAdditiveEpsilonIndicator
public boolean getIncludeAdditiveEpsilonIndicator()Returnstrue
if the additive ε-indicator collector is included;false
otherwise.- Returns:
true
if the additive ε-indicator collector is included;false
otherwise
-
setIncludeAdditiveEpsilonIndicator
public void setIncludeAdditiveEpsilonIndicator(boolean includeAdditiveEpsilonIndicator) Sets the inclusion of the additive ε-indicator collector.- Parameters:
includeAdditiveEpsilonIndicator
-true
if the additive ε-indicator collector is included;false
otherwise
-
getIncludeContribution
public boolean getIncludeContribution()Returnstrue
if the contribution indicator collector is included;false
otherwise.- Returns:
true
if the contribution indicator collector is included;false
otherwise
-
setIncludeContribution
public void setIncludeContribution(boolean includeContribution) Sets the inclusion of the contribution indicator collector.- Parameters:
includeContribution
-true
if the contribution indicator collector is included;false
otherwise
-
getIncludeR1
public boolean getIncludeR1()Returnstrue
if the R1 indicator collector is included;false
otherwise.- Returns:
true
if the R1 indicator collector is included;false
otherwise
-
setIncludeR1
public void setIncludeR1(boolean includeR1) Sets the inclusion of the R1 indicator collector.- Parameters:
includeR1
-true
if the R1 indicator collector is included;false
otherwise
-
getIncludeR2
public boolean getIncludeR2()Returnstrue
if the R2 indicator collector is included;false
otherwise.- Returns:
true
if the R2 indicator collector is included;false
otherwise
-
setIncludeR2
public void setIncludeR2(boolean includeR2) Sets the inclusion of the R2 indicator collector.- Parameters:
includeR2
-true
if the R2 indicator collector is included;false
otherwise
-
getIncludeR3
public boolean getIncludeR3()Returnstrue
if the R3 indicator collector is included;false
otherwise.- Returns:
true
if the R3 indicator collector is included;false
otherwise
-
setIncludeR3
public void setIncludeR3(boolean includeR3) Sets the inclusion of the R3 indicator collector.- Parameters:
includeR3
-true
if the R3 indicator collector is included;false
otherwise
-
getIncludeEpsilonProgress
public boolean getIncludeEpsilonProgress()Returnstrue
if the ε-progress collector is included;false
otherwise.- Returns:
true
if the ε-progress collector is included;false
otherwise
-
setIncludeEpsilonProgress
public void setIncludeEpsilonProgress(boolean includeEpsilonProgress) Sets the inclusion of the ε-progress collector.- Parameters:
includeEpsilonProgress
-true
if the ε-progress collector is included;false
otherwise
-
getIncludeAdaptiveMultimethodVariation
public boolean getIncludeAdaptiveMultimethodVariation()Returnstrue
if the adaptive multimethod variation collector is included;false
otherwise.- Returns:
true
if the adaptive multimethod variation collector is included;false
otherwise
-
setIncludeAdaptiveMultimethodVariation
public void setIncludeAdaptiveMultimethodVariation(boolean includeAdaptiveMultimethodVariation) Sets the inclusion of the adaptive multimethod variation collector.- Parameters:
includeAdaptiveMultimethodVariation
-true
if the adaptive multimethod variation collector is included;false
otherwise
-
getIncludeAdaptiveTimeContinuation
public boolean getIncludeAdaptiveTimeContinuation()Returnstrue
if the adaptive time continuation collector is included;false
otherwise.- Returns:
true
if the adaptive time continuation collector is included;false
otherwise
-
setIncludeAdaptiveTimeContinuation
public void setIncludeAdaptiveTimeContinuation(boolean includeAdaptiveTimeContinuation) Sets the inclusion of the adaptive time continuation collector.- Parameters:
includeAdaptiveTimeContinuation
-true
if the adaptive time continuation collector is included;false
otherwise
-
getIncludeElapsedTime
public boolean getIncludeElapsedTime()Returnstrue
if the elapsed time collector is included;false
otherwise.- Returns:
true
if the elapsed time collector is included;false
otherwise
-
setIncludeElapsedTime
public void setIncludeElapsedTime(boolean includeElapsedTime) Sets the inclusion of the elapsed time collector.- Parameters:
includeElapsedTime
-true
if the elapsed time collector is included;false
otherwise
-
getIncludeApproximationSet
public boolean getIncludeApproximationSet()Returnstrue
if the approximation set collector is included;false
otherwise.- Returns:
true
if the approximation set collector is included;false
otherwise
-
setIncludeApproximationSet
public void setIncludeApproximationSet(boolean includeApproximationSet) Sets the inclusion of the approximation set collector.- Parameters:
includeApproximationSet
-true
if the approximation set collector is included;false
otherwise
-
getIncludePopulationSize
public boolean getIncludePopulationSize()Returnstrue
if the population size collector is included;false
otherwise.- Returns:
true
if the population size collector is included;false
otherwise
-
setIncludePopulationSize
public void setIncludePopulationSize(boolean includePopulationSize) Sets the inclusion of the population size collector.- Parameters:
includePopulationSize
-true
if the population size collector is included;false
otherwise
-
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
-
getShowIndividualTraces
public boolean getShowIndividualTraces()Returnstrue
if individual traces are shown;false
if quantiles are shown.- Returns:
true
if individual traces are shown;false
if quantiles are shown
-
setShowIndividualTraces
public void setShowIndividualTraces(boolean showIndividualTraces) Set totrue
to show individual traces;false
to show quantiles.- Parameters:
showIndividualTraces
-true
to show individual traces;false
to show quantiles
-
handleException
Handles an exception, possibly displaying a dialog box containing details of the exception.- Parameters:
e
- the exception
-