Package org.opt4j.start
Class Opt4JTask
java.lang.Object
org.opt4j.config.Task
org.opt4j.start.Opt4JTask
- All Implemented Interfaces:
Callable<Void>
,ControlListener
,OptimizerIterationListener
The
Opt4JTask
executes one optimization process.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.opt4j.config.Task
Task.State
-
Field Summary
Modifier and TypeFieldDescriptionprotected final boolean
protected final boolean
protected com.google.inject.Injector
protected boolean
protected Optimizer
protected com.google.inject.Injector
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Close the task.void
execute()
Executes theTask
.protected com.google.inject.Injector
Returns theInjector
of the task.<O> O
getInstance
(Class<O> type) Returns the instance of the given class.int
Returns the current iteration.protected Optimizer
Returns theOptimizer
of the task.void
init
(com.google.inject.Injector injector) Initialize with a parentInjector
.void
iterationComplete
(Optimizer optimizer, int iteration) Invoked if theOptimizer
completes an iteration.void
open()
Initialize a task manually before executing it.void
stateChanged
(Control.State state) Invoked if the state of theControl
changes.Methods inherited from class org.opt4j.config.Task
addStateListener, call, getException, getModules, getState, init, init, removeStateListener, setState, toString
-
Field Details
-
optimizer
-
injector
protected com.google.inject.Injector injector -
parentInjector
protected com.google.inject.Injector parentInjector -
closeOnStop
protected final boolean closeOnStop -
isClosed
protected boolean isClosed -
initializing
protected final boolean initializing- See Also:
-
-
Constructor Details
-
Method Details
-
execute
Description copied from class:Task
Executes theTask
. -
init
public void init(com.google.inject.Injector injector) Initialize with a parentInjector
.- Parameters:
injector
- the parent injector
-
close
public void close()Close the task. -
open
public void open()Initialize a task manually before executing it. This enables to get instances of classes before the optimization starts. -
getIteration
public int getIteration()Returns the current iteration.- Returns:
- the current iteration
-
getInstance
Returns the instance of the given class.- Type Parameters:
O
- the type of class- Parameters:
type
- the class- Returns:
- the instance of the class
-
getInjector
protected com.google.inject.Injector getInjector()Returns theInjector
of the task.- Returns:
- the injector
-
getOptimizer
Returns theOptimizer
of the task.- Returns:
- the optimizer
-
stateChanged
Description copied from interface:ControlListener
Invoked if the state of theControl
changes.- Specified by:
stateChanged
in interfaceControlListener
- Parameters:
state
- the current state of the optimization process
-
iterationComplete
Description copied from interface:OptimizerIterationListener
Invoked if theOptimizer
completes an iteration.- Specified by:
iterationComplete
in interfaceOptimizerIterationListener
- Parameters:
optimizer
- the optimizeriteration
- the completed iteration
-