Package org.evoludo.simulator.models
Class IBSCPopulation
Object
IBSPopulation
IBSMCPopulation
IBSCPopulation
The core class for individual based simulations with a single
continuous trait. As compared to the more generic
IBSMCPopulation
this subclass takes advantage of simplifications that are possible for a
single trait.- Author:
- Christoph Hauert
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected IBS.HasIBS.CGroupsFor group interaction modulesmodule==groupmoduleholds andnullotherwise.(package private) doubleTemporary storage for the traits of the focal individual.(package private) IBSCPopulationThe interaction partner/opponent of this populationopponent.getModule()==getModule().getOpponent().protected IBS.HasIBS.CPairsFor pairwise interaction modulesmodule==pairmoduleholds andnullotherwise.Fields inherited from class IBSMCPopulation
init, module, mutation, oldScores, oldTrait, smallTrait, tmpGroup, traitMax, traitMin, traits, traitsNextFields inherited from class IBSPopulation
adjustScores, competition, compGroup, consistencyCheckRequested, debugFocal, debugModel, debugModels, debugNModels, debugSame, distrMigrants, engine, fitness, groupScores, hasLookupTable, interaction, interactions, interGroup, isConsistent, isMultispecies, isNeutral, logger, map2fit, maxEffScoreIdx, maxFitness, maxScore, migrationType, minFitness, minScore, nMixedInter, nPopulation, nTraits, pAddwire, playerScoreAveraged, playerScoring, playerUpdate, pMigration, populationUpdate, pRewire, rng, scores, smallScores, staticmodule, sumFitness, syncFraction, tags, typeFitness, typeScores, VACANT -
Constructor Summary
ConstructorsConstructorDescriptionIBSCPopulation(EvoLudo engine, Continuous module) Creates a population of individuals with a single continuous trait for IBS simulations. -
Method Summary
Modifier and TypeMethodDescriptionvoidadjustPairGameScoresAt(int me) Adjusts scores of focal individual with indexmeand its neighbors aftermechanged trait.voidcommitTraitAt(int me) The change of a trait of the player atindexis stored in a temporary variable and must be committed before proceeding.voidgetTraitHistogramData(double[] bins) Creates a histogram fortraitand returns the result in the arraybins.booleanhaveSameTrait(int a, int b) Check if individuals with indexaand indexbhave the same traits.booleanisSameTrait(int a) Check if individual with indexahas switched traits.voidplayGroupGameAt(IBSGroup group) Play a group interaction with the individuals ingroup.voidplayPairGameAt(IBSGroup group) Play a pairwise interaction with the individuals ingroup.voidPrior to a synchronous update step the current state must be duplicated in preparation for processing the next step.voidsetOpponentPop(IBSPopulation opponent) Set the interaction partner/opponent of this population.voidswapTraits(int a, int b) Swap traits of individuals with indexaand indexb.voidyalpGroupGameAt(IBSGroup group) Counterpart ofIBSPopulation.playGroupGameAt(IBSGroup),IBSPopulation.playGameAt(int)and/orIBSPopulation.playGameSyncAt(int).Methods inherited from class IBSMCPopulation
adjustScoreAt, adjustScoreAt, check, checkConvergence, commitTraits, doAdjustScores, encodeTraits, get2DTraitHistogramData, getInit, getMeanFitness, getMeanTraits, getStatus, getTraitData, getTraitHistogramData, getTraitHistogramData, getTraitMax, getTraitMin, getTraitNameAt, getTraits, init, maybeMutateAt, maybeMutateMoran, mouseHitNode, mutateAt, preferredPlayerBest, reset, restoreTraits, setInit, updateFromModelAtMethods inherited from class IBSPopulation
adjustGameScoresAt, becomesVacantAt, checkGeometry, createCompetitionGeometry, createInteractionGeometry, debugMarkChange, debugScores, debugUpdatePopulationAt, doBirthDeathMigration, doDeathBirthMigration, doDiffusionMigration, doMigration, doSyncMigration, encodeFitness, encodeGeometry, encodeInteractions, generateGeometry, getCompetitionGeometry, getCompGroup, getFitness, getFitnessAt, getFitnessData, getFitnessHistogramData, getFitnessNameAt, getFitnessNameAt, getInteractionGeometry, getInteractionsAt, getInterGroup, getMaxScore, getMigrationProb, getMigrationType, getMinScore, getModule, getNMean, getPlayerScoreAveraged, getPlayerScoring, getPopulationSize, getPopulationUpdate, getScoreAt, getScoreNameAt, getScores, getSpeciesUpdateRate, getSyncFraction, getTagAt, getTagData, getTagNameAt, getTags, getTotalFitness, isConsistent, isMonomorphic, isVacantAt, migrateMoran, mouseHitNode, mutate, nextBinomial, parseGeometry, pickFitFocalIndividual, pickFitFocalIndividual, pickFitNeighborAt, pickFitNeighborAt, pickFocalIndividual, pickFocalIndividual, pickFocalSite, pickFocalSite, pickNeighborSiteAt, playGameAt, playGameSyncAt, processScore, random01, random01d, random0n, random0N, randomGaussian, removeScoreAt, removeScoreAt, resetScoreAt, resetScores, resetTraits, restoreFitness, restoreGeometry, restoreInteractions, setAddwire, setConsistencyCheck, setMaxEffScoreIdx, setMigrationProb, setMigrationType, setPlayerScoreAveraged, setPlayerScoring, setPopulationUpdate, setRewire, setScoreAt, setSyncFraction, setTagAt, srandom, step, swapScoresAt, updateEffScoreRange, updateFitnessAt, updateMinMaxScores, updatePlayerAsync, updatePlayerAsyncAt, updatePlayerAt, updatePlayerAt, updatePlayerBest, updatePlayerBestHalf, updatePlayerBestResponse, updatePlayerEcology, updatePlayerEcologyAt, updatePlayerMoranBirthDeath, updatePlayerMoranBirthDeathAt, updatePlayerMoranDeathBirth, updatePlayerMoranDeathBirthAt, updatePlayerMoranImitate, updatePlayerMoranImitateAt, updatePlayerSwap, updateProportionalAbs, updateReplicatorHalf, updateReplicatorPlus, updateScoreAt, updateScoreAt, updateScoreAt, updateScores, updateThermal
-
Field Details
-
pairmodule
For pairwise interaction modulesmodule==pairmoduleholds andnullotherwise. Convenience field to reduce the number of (unnecessary) casts.- See Also:
-
groupmodule
For group interaction modulesmodule==groupmoduleholds andnullotherwise. Convenience field to reduce the number of (unnecessary) casts.- See Also:
-
opponent
IBSCPopulation opponentThe interaction partner/opponent of this populationopponent.getModule()==getModule().getOpponent(). In intra-species interactionsopponent==this. Convenience field.Note: This deliberately hides
IBSPopulation.opponent. The two variables point to the same object but this setup avoids unnecessary casts because onlyDiscretemodules generateIBSDPopulation(s). -
myTrait
double myTraitTemporary storage for the traits of the focal individual. This deliberately hides the array of the same name inIBSMCPopulation.
-
-
Constructor Details
-
IBSCPopulation
Creates a population of individuals with a single continuous trait for IBS simulations.- Parameters:
engine- the pacemaker for running the modelmodule- the module that defines the rules of the game
-
-
Method Details
-
setOpponentPop
Description copied from class:IBSPopulationSet the interaction partner/opponent of this population.- Overrides:
setOpponentPopin classIBSMCPopulation- Parameters:
opponent- the interaction partner/opponent
-
haveSameTrait
public boolean haveSameTrait(int a, int b) Description copied from class:IBSPopulationCheck if individuals with indexaand indexbhave the same traits.- Overrides:
haveSameTraitin classIBSMCPopulation- Parameters:
a- the index of first individualb- the index of second individual- Returns:
trueif the two individuals have the same traits
-
isSameTrait
public boolean isSameTrait(int a) Description copied from class:IBSPopulationCheck if individual with indexahas switched traits.Note: this test is only meaningful before trait are committed.
- Overrides:
isSameTraitin classIBSMCPopulation- Parameters:
a- index of individual- Returns:
trueif trait remained unchanged- See Also:
-
swapTraits
public void swapTraits(int a, int b) Description copied from class:IBSPopulationSwap traits of individuals with indexaand indexb.Note: the traits still need to be committed.
- Overrides:
swapTraitsin classIBSMCPopulation- Parameters:
a- the index of first individualb- the index of second individual- See Also:
-
playPairGameAt
Description copied from class:IBSPopulationPlay a pairwise interaction with the individuals ingroup.- Overrides:
playPairGameAtin classIBSMCPopulation- Parameters:
group- the group of individuals interacting in pairs
-
adjustPairGameScoresAt
public void adjustPairGameScoresAt(int me) Description copied from class:IBSPopulationAdjusts scores of focal individual with indexmeand its neighbors aftermechanged trait. Only works ifadjustScores==true.Important: new trait must not yet have been committed.
- Overrides:
adjustPairGameScoresAtin classIBSMCPopulation- Parameters:
me- the index of the focal individual
-
playGroupGameAt
Description copied from class:IBSPopulationPlay a group interaction with the individuals ingroup.- Overrides:
playGroupGameAtin classIBSMCPopulation- Parameters:
group- the group of interacting individuals
-
yalpGroupGameAt
Description copied from class:IBSPopulationCounterpart ofIBSPopulation.playGroupGameAt(IBSGroup),IBSPopulation.playGameAt(int)and/orIBSPopulation.playGameSyncAt(int). Removes the payoffs of group interactions.- Overrides:
yalpGroupGameAtin classIBSMCPopulation- Parameters:
group- the interaction group
-
prepareTraits
public void prepareTraits()Description copied from class:IBSPopulationPrior to a synchronous update step the current state must be duplicated in preparation for processing the next step.- Overrides:
prepareTraitsin classIBSMCPopulation- See Also:
-
commitTraitAt
public void commitTraitAt(int me) Description copied from class:IBSPopulationThe change of a trait of the player atindexis stored in a temporary variable and must be committed before proceeding.- Overrides:
commitTraitAtin classIBSMCPopulation- Parameters:
me- the index of the player that needs to have its new trait committed
-
getTraitHistogramData
public void getTraitHistogramData(double[] bins) Creates a histogram fortraitand returns the result in the arraybins.- Parameters:
bins- the array to store the histogram(s)
-