org.apache.commons.math3.genetics
Class FixedElapsedTime

java.lang.Object
  extended by org.apache.commons.math3.genetics.FixedElapsedTime
All Implemented Interfaces:
StoppingCondition

public class FixedElapsedTime
extends Object
implements StoppingCondition

Stops after a fixed amount of time has elapsed.

The first time isSatisfied(Population) is invoked, the end time of the evolution is determined based on the provided maxTime value. Once the elapsed time reaches the configured maxTime value, isSatisfied(Population) returns true.

Since:
3.1
Version:
$Id: FixedElapsedTime.java 1385297 2012-09-16 16:05:57Z tn $

Constructor Summary
FixedElapsedTime(long maxTime)
          Create a new FixedElapsedTime instance.
FixedElapsedTime(long maxTime, TimeUnit unit)
          Create a new FixedElapsedTime instance.
 
Method Summary
 boolean isSatisfied(Population population)
          Determine whether or not the maximum allowed time has passed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FixedElapsedTime

public FixedElapsedTime(long maxTime)
                 throws NumberIsTooSmallException
Create a new FixedElapsedTime instance.

Parameters:
maxTime - maximum number of seconds generations are allowed to evolve
Throws:
NumberIsTooSmallException - if the provided time is < 0

FixedElapsedTime

public FixedElapsedTime(long maxTime,
                        TimeUnit unit)
                 throws NumberIsTooSmallException
Create a new FixedElapsedTime instance.

Parameters:
maxTime - maximum time generations are allowed to evolve
unit - TimeUnit of the maxTime argument
Throws:
NumberIsTooSmallException - if the provided time is < 0
Method Detail

isSatisfied

public boolean isSatisfied(Population population)
Determine whether or not the maximum allowed time has passed. The termination time is determined after the first generation.

Specified by:
isSatisfied in interface StoppingCondition
Parameters:
population - ignored (no impact on result)
Returns:
true IFF the maximum allowed time period has elapsed


Copyright © 2003-2013 The Apache Software Foundation. All Rights Reserved.