jInfer

cz.cuni.mff.ksi.jinfer.iss.experiments.termination
Class TimeIterations

java.lang.Object
  extended by cz.cuni.mff.ksi.jinfer.iss.experiments.termination.TimeIterations
All Implemented Interfaces:
TerminationCriterion

public class TimeIterations
extends Object
implements TerminationCriterion

An implementation of the TerminationCriterion based on the total time spent running the metaheuristics and the number of iterations - improvement heuristics runs. Also, as soon as known optimum is reached, this criterion is met.


Field Summary
static TimeIterations NULL
          Instance terminating immediately, without running any IHs.
 
Constructor Summary
TimeIterations(int maxIterations)
          Constructor.
TimeIterations(int maxIterations, long maxTime)
          Full constructor.
 
Method Summary
 Pair<Boolean,String> terminate(Experiment experiment, long time, List<IdSet> solutions)
          Returns a flag whether to terminate the iterations of the metaheuristic.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NULL

public static final TimeIterations NULL
Instance terminating immediately, without running any IHs.

Constructor Detail

TimeIterations

public TimeIterations(int maxIterations)
Constructor. Initializes this criterion to run at most the specified number of iterations, max time is set to "infinity".

Parameters:
maxIterations - Maximum number of iterations - improvement heuristics runs allowed.

TimeIterations

public TimeIterations(int maxIterations,
                      long maxTime)
Full constructor. Initializes this criterion to run at most the specified time or number of iterations, whichever comes first.

Parameters:
maxIterations - Maximum number of iterations - improvement heuristics runs allowed.
maxTime - Maximal time allowed, in milliseconds.
Method Detail

terminate

public Pair<Boolean,String> terminate(Experiment experiment,
                                      long time,
                                      List<IdSet> solutions)
Description copied from interface: TerminationCriterion
Returns a flag whether to terminate the iterations of the metaheuristic.

Specified by:
terminate in interface TerminationCriterion
Parameters:
experiment - Experiment in context of which to measure the quality.
time - Total time taken so far.
solutions - The pool solutions that were produced in the last run.
Returns:
The first item of the pair is true if the metaheuristic should be terminated, false otherwise. The second is a string describing why the metaheuristics was terminated, in user-friendly language.

jInfer

Generated on Fri Dec 9 00:01:25 CET 2011