MOEA Framework 2.12
API Specification

org.moeaframework.util.progress
Class ProgressHelper

java.lang.Object
  extended by org.moeaframework.util.progress.ProgressHelper

public class ProgressHelper
extends Object

Helper for notifying ProgressListeners when the evaluation progress of an Executor changes. This class reports the current progress, percent complete, elapsed time, and remaining time. Be sure to first call #start(int, int) to set the total number of seeds and NFE prior to invoking any other method.


Constructor Summary
ProgressHelper(Executor executor)
          Constructs a new progress helper for generating progress reports for the given executor.
 
Method Summary
 void addProgressListener(ProgressListener listener)
          Adds the given listener to receive progress reports.
 void nextSeed()
          Increments the current seed and sets NFE to 0.
 void removeProgressListener(ProgressListener listener)
          Removes the given listener so it no longer receives progress reports.
 void setCurrentNFE(int currentNFE)
          Sets the current number of objective function evaluations.
 void setCurrentSeed(int currentSeed)
          Sets the current seed.
 void start(int totalSeeds, int maxNFE, long maxTime)
          Prepares this progress helper for use.
 void stop()
          Stops this progress helper.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProgressHelper

public ProgressHelper(Executor executor)
Constructs a new progress helper for generating progress reports for the given executor.

Parameters:
executor - the executor that will be reporting progress
Method Detail

addProgressListener

public void addProgressListener(ProgressListener listener)
Adds the given listener to receive progress reports.

Parameters:
listener - the listener to receive progress reports

removeProgressListener

public void removeProgressListener(ProgressListener listener)
Removes the given listener so it no longer receives progress reports.

Parameters:
listener - the listener to no longer receive progress reports

setCurrentNFE

public void setCurrentNFE(int currentNFE)
Sets the current number of objective function evaluations. This method will generate a progress report.

Parameters:
currentNFE - the current number of objective function evaluations

setCurrentSeed

public void setCurrentSeed(int currentSeed)
Sets the current seed. This call will have no affect if the current seed is unchanged. This method will generate a progress report if the current seed changes.

It is strongly recommended that nextSeed() is used instead of this method, as nextSeed() sets the current NFE to 0.

Parameters:
currentSeed - the current seed being processed, starting at 1

nextSeed

public void nextSeed()
Increments the current seed and sets NFE to 0. This method will generate a progress report. This method should be invoked after every seed completes in order to notify listeners that the seed completed.


start

public void start(int totalSeeds,
                  int maxNFE,
                  long maxTime)
Prepares this progress helper for use. This method must be invoked prior to calling all other methods. The internal state of the progress helper is reset, allowing a single progress helper to be reused across many sequential runs.

Parameters:
totalSeeds - the total number of seeds to be evaluated
maxNFE - the maximum number of objective function evaluations per seed
maxTime - the maximum time

stop

public void stop()
Stops this progress helper. No other methods should be invoked after calling this method. However, start(int, int, long) can be called to reset and restart this progress helper.


MOEA Framework 2.12
API Specification

Copyright 2009-2016 MOEA Framework. All rights reserved.
Licensed under the GNU Lesser General Public License.
Return to the MOEA Framework homepage. Visit us on Github!