public final class PairPipeline
extends java.lang.Object
Processing definition for pairs of EmasAgent.
Pipeline
Modifier and Type | Field and Description |
---|---|
private io.vavr.collection.List<io.vavr.Tuple2<EmasAgent,EmasAgent>> |
pairs |
Constructor and Description |
---|
PairPipeline(io.vavr.collection.List<io.vavr.Tuple2<EmasAgent,EmasAgent>> pairs) |
Modifier and Type | Method and Description |
---|---|
io.vavr.Tuple2<Pipeline,Pipeline> |
encounter(java.util.function.Predicate<EmasAgent> reproductionPredicate,
java.util.function.Function<io.vavr.Tuple2<EmasAgent,EmasAgent>,io.vavr.Tuple2<io.vavr.collection.Seq<EmasAgent>,EmasAgent>> reproductionStrategy,
java.util.function.Function<io.vavr.Tuple2<EmasAgent,EmasAgent>,io.vavr.collection.Seq<EmasAgent>> fightingStrategy)
Performs an agent encounter.
|
private static io.vavr.Tuple2<io.vavr.collection.Seq<EmasAgent>,EmasAgent> |
encounterPair(io.vavr.Tuple2<EmasAgent,EmasAgent> pair,
java.util.function.Predicate<EmasAgent> reproductionPredicate,
java.util.function.Function<io.vavr.Tuple2<EmasAgent,EmasAgent>,io.vavr.Tuple2<io.vavr.collection.Seq<EmasAgent>,EmasAgent>> reproductionStrategy,
java.util.function.Function<io.vavr.Tuple2<EmasAgent,EmasAgent>,io.vavr.collection.Seq<EmasAgent>> fightingStrategy) |
Pipeline |
fight(java.util.function.Function<io.vavr.Tuple2<EmasAgent,EmasAgent>,io.vavr.collection.Seq<EmasAgent>> fightingStrategy)
Fight in pairs.
|
Pipeline |
fight(io.vavr.Function2<EmasAgent,EmasAgent,io.vavr.collection.Seq<EmasAgent>> fightingStrategy) |
io.vavr.Tuple2<Pipeline,Pipeline> |
reproduce(java.util.function.Function<io.vavr.Tuple2<EmasAgent,EmasAgent>,io.vavr.Tuple2<io.vavr.collection.Seq<EmasAgent>,EmasAgent>> reproductionStrategy)
Reproduce in pairs.
|
io.vavr.Tuple2<Pipeline,Pipeline> |
reproduce(io.vavr.Function2<EmasAgent,EmasAgent,io.vavr.Tuple2<io.vavr.collection.Seq<EmasAgent>,EmasAgent>> reproductionStrategy) |
public io.vavr.Tuple2<Pipeline,Pipeline> reproduce(java.util.function.Function<io.vavr.Tuple2<EmasAgent,EmasAgent>,io.vavr.Tuple2<io.vavr.collection.Seq<EmasAgent>,EmasAgent>> reproductionStrategy)
Reproduce in pairs.
reproductionStrategy
- a function taking a pair of agents as an argument and returning a new set of agents that should replace this pair. Parents should also be returned in this set if they should stay in the new population.public io.vavr.Tuple2<Pipeline,Pipeline> reproduce(io.vavr.Function2<EmasAgent,EmasAgent,io.vavr.Tuple2<io.vavr.collection.Seq<EmasAgent>,EmasAgent>> reproductionStrategy)
public Pipeline fight(java.util.function.Function<io.vavr.Tuple2<EmasAgent,EmasAgent>,io.vavr.collection.Seq<EmasAgent>> fightingStrategy)
Fight in pairs.
fightingStrategy
- a function taking a pair of agents as an argument and returning a new set of agents that should replace this pair.public Pipeline fight(io.vavr.Function2<EmasAgent,EmasAgent,io.vavr.collection.Seq<EmasAgent>> fightingStrategy)
public io.vavr.Tuple2<Pipeline,Pipeline> encounter(java.util.function.Predicate<EmasAgent> reproductionPredicate, java.util.function.Function<io.vavr.Tuple2<EmasAgent,EmasAgent>,io.vavr.Tuple2<io.vavr.collection.Seq<EmasAgent>,EmasAgent>> reproductionStrategy, java.util.function.Function<io.vavr.Tuple2<EmasAgent,EmasAgent>,io.vavr.collection.Seq<EmasAgent>> fightingStrategy)
Performs an agent encounter. If both agents meet a given reproduction predicate - they reproduce themselves with a given reproduction strategy. Otherwise they fight with each other with a given fight strategy.
reproductionPredicate
- the reproduction predicatereproductionStrategy
- a function taking a pair of agents as an argument and returning a new set of agents that should replace this pair. Parents should also be returned in this set if they should stay in the new population.fightingStrategy
- a function taking a pair of agents as an argument and returning a new set of agents that should replace this pair.private static io.vavr.Tuple2<io.vavr.collection.Seq<EmasAgent>,EmasAgent> encounterPair(io.vavr.Tuple2<EmasAgent,EmasAgent> pair, java.util.function.Predicate<EmasAgent> reproductionPredicate, java.util.function.Function<io.vavr.Tuple2<EmasAgent,EmasAgent>,io.vavr.Tuple2<io.vavr.collection.Seq<EmasAgent>,EmasAgent>> reproductionStrategy, java.util.function.Function<io.vavr.Tuple2<EmasAgent,EmasAgent>,io.vavr.collection.Seq<EmasAgent>> fightingStrategy)