Package jsl.simulation
Interface IterativeProcessIfc
-
- All Superinterfaces:
GetNameIfc
- All Known Implementing Classes:
Executive,Executive.EventExecutionProcess,IPBisectionRootFinder,IPRootFinder,IterativeProcess,Simulation,Simulation.ReplicationExecutionProcess,StochasticApproximationRootFinder
public interface IterativeProcessIfc extends GetNameIfc
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleanallStepsCompleted()The iterative process may end by a variety of means, this method checks if the iterative process ended because it ran all of its stepsvoidend()The iterative process will continue until there are no more steps or its maximum execution time has been reached, whichever comes first.voidend(java.lang.String msg)The iterative process will continue until there are no more steps or its maximum execution time has been reached, whichever comes first.booleanexecutionTimeExceeded()The iterative process may end by a variety of means, this method checks if the iterative process ended because it timed outlonggetBeginExecutionTime()Returns system time in milliseconds that the iterative process startedlonggetElapsedExecutionTime()Gets the clock time in milliseconds since the iterative process was initializedlonggetEndExecutionTime()Returns system time in milliseconds that the iterative process endedIPLogReportgetLogReport()Returns a reference to the current log report.longgetMaximumAllowedExecutionTime()Returns maximum (real) clock time allocated for the iterative processlonggetNumberStepsCompleted()Returns the number of steps completed since the iterative process was last initializedbooleangetStoppingFlag()Returns the stopping flagjava.lang.StringgetStoppingMessage()A string message for why stop() was called.voidinitialize()Initializes the iterative process prior to running any steps This must be done prior to calling runNext();booleanisCreated()Checks if the iterative process is in the created state.booleanisDone()A flag to indicate whether the iterative process is done A iterative process can be done if: 1) it ran all of its steps 2) it was ended by a client prior to completing all of its steps 3) it ended because it exceeded its maximum allowable execution time before completing all of its steps.booleanisEnded()Checks if the iterative process is in the ended state After the iterative process has been ended this method will return truebooleanisExecutionTimeExceeded()Returns if the elapsed execution time exceeds the maximum time allowed.booleanisInitialized()Checks if the iterative process is in the initialized state After the iterative process has been initialized this method will return truebooleanisRunning()An iterative process is running if it is been told to run (i.e.booleanisRunningStep()Indicates that the iterative process is currently running an individual stepbooleanisStepCompleted()Checks if the iterative process is in the completed step state After the iterative process has successfully completed a step this method will return truebooleanisUnfinished()The iterative process may end by a variety of means, this method checks if the iterative process ended but was unfinished, not all steps completedbooleannoStepsExecuted()Indicates that the iterative process ended because of no stepsvoidrun()Runs all of the steps of the iterative process.voidrunNext()Runs the next step in the iterative processvoidsetMaximumExecutionTime(long milliseconds)Set the maximum allotted (suggested) execution (real) clock for the entire iterative process.voidstop()This sets a flag to indicate to the process that is should stop after the next step is completed.voidstop(java.lang.String msg)This sets a flag to indicate to the process that is should stop after the next step is completed.booleanstoppedByCondition()The iterative process may end by a variety of means, this method checks if the iterative process ended because it was stoppedvoidturnOffLogReport()Turns off log reporting.voidturnOnLogReport(java.nio.file.Path pathToFile)Turns on the log report.voidturnOnTimer(long milliseconds)This method will cause the a timer to start allowing a TimerTask to be scheduled.-
Methods inherited from interface jsl.utilities.GetNameIfc
getName
-
-
-
-
Method Detail
-
isDone
boolean isDone()
A flag to indicate whether the iterative process is done A iterative process can be done if: 1) it ran all of its steps 2) it was ended by a client prior to completing all of its steps 3) it ended because it exceeded its maximum allowable execution time before completing all of its steps. 4) its end condition was satisfied- Returns:
- true if done
-
isExecutionTimeExceeded
boolean isExecutionTimeExceeded()
Returns if the elapsed execution time exceeds the maximum time allowed. Only true if the maximum was set and elapsed time is greater than or equal to getMaximumAllowedExecutionTime()- Returns:
- true if the execution time exceeds getMaximumAllowedExecutionTime()
-
getBeginExecutionTime
long getBeginExecutionTime()
Returns system time in milliseconds that the iterative process started- Returns:
- the number as a long
-
getElapsedExecutionTime
long getElapsedExecutionTime()
Gets the clock time in milliseconds since the iterative process was initialized- Returns:
- a long representing the elapsed time
-
getEndExecutionTime
long getEndExecutionTime()
Returns system time in milliseconds that the iterative process ended- Returns:
- the number as a long
-
getMaximumAllowedExecutionTime
long getMaximumAllowedExecutionTime()
Returns maximum (real) clock time allocated for the iterative process- Returns:
- the number as long representing milliseconds
-
setMaximumExecutionTime
void setMaximumExecutionTime(long milliseconds)
Set the maximum allotted (suggested) execution (real) clock for the entire iterative process. This is a suggested time because the execution time requirement is only checked after the completion of an individual step After it is discovered that cumulative time for executing the step has exceeded the maximum time, then the iterative process will be ended (perhaps) not completing other steps.- Parameters:
milliseconds- the time
-
getNumberStepsCompleted
long getNumberStepsCompleted()
Returns the number of steps completed since the iterative process was last initialized- Returns:
- the number of steps completed
-
turnOnLogReport
void turnOnLogReport(java.nio.file.Path pathToFile)
Turns on the log report. This report yields a text file of the state changes for the iterative process- Parameters:
pathToFile- specifies a prefix name for the report
-
turnOffLogReport
void turnOffLogReport()
Turns off log reporting.
-
getLogReport
IPLogReport getLogReport()
Returns a reference to the current log report.- Returns:
- The log report
-
turnOnTimer
void turnOnTimer(long milliseconds)
This method will cause the a timer to start allowing a TimerTask to be scheduled. This method causes a print to console task to be run which prints the elapsed time since initializing the iterative process.- Parameters:
milliseconds- the time for the timer
-
isCreated
boolean isCreated()
Checks if the iterative process is in the created state. If the iterative process is in the created state this method will return true- Returns:
- true if in the created state
-
isInitialized
boolean isInitialized()
Checks if the iterative process is in the initialized state After the iterative process has been initialized this method will return true- Returns:
- true if initialized
-
isRunning
boolean isRunning()
An iterative process is running if it is been told to run (i.e. runNext()) but has not yet been told to end().- Returns:
- true if running
-
isStepCompleted
boolean isStepCompleted()
Checks if the iterative process is in the completed step state After the iterative process has successfully completed a step this method will return true- Returns:
- true if the iterative process completed the step
-
isEnded
boolean isEnded()
Checks if the iterative process is in the ended state After the iterative process has been ended this method will return true- Returns:
- true if ended
-
allStepsCompleted
boolean allStepsCompleted()
The iterative process may end by a variety of means, this method checks if the iterative process ended because it ran all of its steps- Returns:
- true if all completed
-
executionTimeExceeded
boolean executionTimeExceeded()
The iterative process may end by a variety of means, this method checks if the iterative process ended because it timed out- Returns:
- true if exceeded
-
stoppedByCondition
boolean stoppedByCondition()
The iterative process may end by a variety of means, this method checks if the iterative process ended because it was stopped- Returns:
- true if it was stopped via stop()
-
isUnfinished
boolean isUnfinished()
The iterative process may end by a variety of means, this method checks if the iterative process ended but was unfinished, not all steps completed- Returns:
- true if the process is not finished
-
initialize
void initialize()
Initializes the iterative process prior to running any steps This must be done prior to calling runNext();
-
runNext
void runNext()
Runs the next step in the iterative process
-
run
void run()
Runs all of the steps of the iterative process. If the iterative process has not been initialized, then it will automatically be initialized. After attempting to run the steps, the process will be in the end() state. The process may or may not complete all of its steps.
-
end
void end()
The iterative process will continue until there are no more steps or its maximum execution time has been reached, whichever comes first. If this method is called the iterative process will stop processing (terminate) before the next step and not process the next step in the process. The current step will be completed. This method can be used to stop the process at an arbitrary step. Once stopped, the process must be restarted.
-
end
void end(java.lang.String msg)
The iterative process will continue until there are no more steps or its maximum execution time has been reached, whichever comes first. If this method is called the iterative process will stop processing (terminate) before the next step and not process the next step in the process. The current step will be completed. This method can be used to stop the process at an arbitrary step. Once stopped, the process must be restarted.- Parameters:
msg- an option message to indicate the reason for stopping
-
getStoppingMessage
java.lang.String getStoppingMessage()
A string message for why stop() was called.- Returns:
- the message
-
getStoppingFlag
boolean getStoppingFlag()
Returns the stopping flag- Returns:
- true if the process has been told to stop via stop()
-
stop
void stop()
This sets a flag to indicate to the process that is should stop after the next step is completed. This is different than end(). Calling end() immediately places the process in the End state. The process needs to be in a valid state before end() can be used. Calling stop tells the process to eventually get into the end state. stop() can be used to arbitrarily stop the process based on some user defined condition.
-
stop
void stop(java.lang.String msg)
This sets a flag to indicate to the process that is should stop after the next step is completed. This is different than end(). Calling end() immediately places the process in the End state. The process needs to be in a valid state before end() can be used. Calling stop tells the process to eventually get into the end state. stop() can be used to arbitrarily stop the process based on some user defined condition.- Parameters:
msg- A string to represent the reason for the stopping
-
isRunningStep
boolean isRunningStep()
Indicates that the iterative process is currently running an individual step- Returns:
- true if the step is in progress
-
noStepsExecuted
boolean noStepsExecuted()
Indicates that the iterative process ended because of no steps- Returns:
- True if no steps are executed
-
-