Top Description Fields Constructors Methods
org.apache.commons.math3.genetics

public Class FixedElapsedTime

extends Object
implements StoppingCondition
Class Inheritance
All Implemented Interfaces
org.apache.commons.math3.genetics.StoppingCondition
Imports
java.util.concurrent.TimeUnit, org.apache.commons.math3.exception.NumberIsTooSmallException

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

Field Summary

Modifier and TypeField and Description
private long
endTime

The predetermined termination time (stopping condition).

private final long
maxTimePeriod

Maximum allowed time period (in nanoseconds).

Constructor Summary

AccessConstructor and Description
public
FixedElapsedTime(final long
maximum number of seconds generations are allowed to evolve
maxTime
)

Create a new FixedElapsedTime instance.

public
FixedElapsedTime(final long
maximum time generations are allowed to evolve
maxTime
,
final TimeUnit
TimeUnit of the maxTime argument
unit
)

Create a new FixedElapsedTime instance.

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true IFF the maximum allowed time period has elapsed
isSatisfied
(final Population
ignored (no impact on result)
population
)

Implements org.apache.commons.math3.genetics.StoppingCondition.isSatisfied.

Determine whether or not the maximum allowed time has passed.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

endTimeback to summary
private long endTime

The predetermined termination time (stopping condition).

maxTimePeriodback to summary
private final long maxTimePeriod

Maximum allowed time period (in nanoseconds).

Constructor Detail

FixedElapsedTimeback to summary
public FixedElapsedTime(final long maxTime) throws NumberIsTooSmallException

Create a new FixedElapsedTime instance.

Parameters
maxTime:long

maximum number of seconds generations are allowed to evolve

Exceptions
NumberIsTooSmallException:
if the provided time is < 0
FixedElapsedTimeback to summary
public FixedElapsedTime(final long maxTime, final TimeUnit unit) throws NumberIsTooSmallException

Create a new FixedElapsedTime instance.

Parameters
maxTime:long

maximum time generations are allowed to evolve

unit:TimeUnit

TimeUnit of the maxTime argument

Exceptions
NumberIsTooSmallException:
if the provided time is < 0

Method Detail

isSatisfiedback to summary
public boolean isSatisfied(final Population population)

Implements org.apache.commons.math3.genetics.StoppingCondition.isSatisfied.

Determine whether or not the maximum allowed time has passed. The termination time is determined after the first generation.

Parameters
population:Population

ignored (no impact on result)

Returns:boolean

true IFF the maximum allowed time period has elapsed