public enum Optimize extends Enum<Optimize>
enum
determines whether the GA should maximize or minimize the
fitness function.Enum Constant and Description |
---|
MAXIMUM
GA maximization
|
MINIMUM
GA minimization
|
Modifier and Type | Method and Description |
---|---|
<T extends Comparable<? super T>> |
ascending()
Create an appropriate comparator of the given optimization strategy.
|
<C extends Comparable<? super C>> |
best(C a,
C b)
Return the best value, according to this optimization direction.
|
abstract <T extends Comparable<? super T>> |
compare(T a,
T b)
Compares two comparable objects.
|
<T extends Comparable<? super T>> |
descending()
Create an appropriate comparator of the given optimization strategy.
|
static Optimize |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static Optimize[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
<C extends Comparable<? super C>> |
worst(C a,
C b)
Return the worst value, according to this optimization direction.
|
public static Optimize[] values()
for (Optimize c : Optimize.values()) System.out.println(c);
public static Optimize valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic abstract <T extends Comparable<? super T>> int compare(T a, T b)
T
- the comparable typea
- the first object to be compared.b
- the second object to be compared.NullPointerException
- if one of the arguments is null
.public <T extends Comparable<? super T>> Comparator<T> descending()
final Population<DoubleGene, Double> population = ...
population.sort(Optimize.MINIMUM.<Double>descending());
T
- the type of the objects to compare.Comparator
for the type T
.public <T extends Comparable<? super T>> Comparator<T> ascending()
final Population<DoubleGene, Double> population = ...
population.sort(Optimize.MINIMUM.<Double>ascending());
T
- the type of the objects to compare.Comparator
for the type T
.public <C extends Comparable<? super C>> C best(C a, C b)
C
- the fitness value type.a
- the first value.b
- the second value.public <C extends Comparable<? super C>> C worst(C a, C b)
C
- the fitness value type.a
- the first value.b
- the second value.© 2007-2017 Franz Wilhelmstötter (2017-04-28 16:50)