Class 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 TypeFieldDescription(package private) final Model.HasIBS.CGroupsFor group interaction modulesmodule==groupmoduleholds andnullotherwise.(package private) final Model.HasIBS.CPairsFor pairwise interaction modulesmodule==pairmoduleholds andnullotherwise.Fields inherited from class IBSMCPopulation
groupmodule, init, myTraits, oldScores, oldTraits, pairmodule, smallTrait, tmpGroup, traitRangeMax, traitRangeMin, traits, traitsNextFields inherited from class IBSPopulation
adjustScores, competition, compGroup, consistencyCheckRequested, debugFocal, debugModel, debugModels, debugNModels, debugSame, distrMigrants, engine, fitness, groupScores, hasLookupTable, interaction, interactions, interGroup, isMultispecies, isNeutral, logger, map2fit, maxEffScoreIdx, maxFitness, maxScore, migrationType, minFitness, minScore, module, mutation, nIssues, nMixedInter, nPopulation, nTraits, opponent, optimizeHomo, pAddwire, playerScoreAveraged, playerScoring, playerUpdate, pMigration, populationUpdate, pRewire, rng, scores, smallScores, staticmodule, sumFitness, syncFraction, tags, typeFitness, typeScores, vacantIdx -
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.(package private) voidplayGroupOnceAt(int me, IBSGroup group) Evaluate a single group interaction with the sampled opponents.(package private) voidplayGroupSequentiallyAt(int me, IBSGroup group, int nGroup) Evaluate sequential group interactions when not enough opponents are available simultaneously.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
addState, adjustScoreAt, adjustScoreAt, check, checkConvergence, commitTraits, doAdjustScores, encodeTraits, get2DTraitHistogramData, getInit, getMaxTraits, getMaxTraits, getMeanFitness, getMeanTraits, getMinTraits, getMinTraits, getStatus, getTraitAt, getTraitAt, getTraitData, getTraitHistogramData, getTraitHistogramData, getTraitNameAt, getTraitRangeMax, getTraitRangeMin, getTraits, getTraitsAt, getTraitsAt, init, initGaussian, initMono, initMutant, initUniform, maybeMutateAt, maybeMutateMoran, mouseHitNode, mutateAt, playNoGameAt, preferredPlayerBest, reset, restoreTraits, setInit, setTraitAt, setTraitAt, setTraitsAt, updateFromModelAtMethods inherited from class IBSPopulation
adjustGameScoresAt, becomesVacantAt, checkCompSampling, checkConsistentFitness, checkGeometry, checkGeometryRewire, checkInteractions, checkLookupTable, checkMigration, checkNoLookupTable, checkOptimizations, checkPayoffs, debugMarkChange, debugScores, debugUpdate, debugUpdatePopulationAt, doBirthDeathMigration, doDeathBirthMigration, doDiffusionMigration, doMigration, doSyncMigration, encodeFitness, encodeGeometry, encodeInteractions, getCompetitionGeometry, getCompGroup, getFitness, getFitnessAt, getFitnessData, getFitnessHistogramData, getFitnessNameAt, getFitnessNameAt, getInteractionGeometry, getInteractionsAt, getInterGroup, getMaxScore, getMigrationProb, getMigrationType, getMinScore, getModule, getNMean, getNMixedInteractions, getPlayerScoreAveraged, getPlayerScoring, getPopulationSize, getPopulationUpdate, getScoreAt, getScoreNameAt, getScores, getSpeciesUpdateRate, getSyncFraction, getTagAt, getTagData, getTagNameAt, getTags, getTotalFitness, isConsistent, isMonomorphic, isVacantAt, logAccountingIssue, logAccountingIssue, logFitnessIssue, logMapIssue, logScoringIssue, logScoringIssue, migrateMoran, mouseHitNode, mutate, nextBinomial, pickFitFocalIndividual, pickFitFocalIndividual, pickFitNeighborAt, pickFitNeighborAt, pickFocalIndividual, pickFocalIndividual, pickFocalSite, pickFocalSite, pickNeighborSiteAt, playGameAt, playGameSyncAt, processScore, random01, random0n, randomGaussian, removeScoreAt, removeScoreAt, resetEphemeral, resetMoran, resetScoreAt, resetScores, resetTraits, restoreFitness, restoreGeometry, restoreInteractions, setAddwire, setConsistencyCheck, setGeometryNames, setMaxEffScoreIdx, setMigrationProb, setMigrationType, setPlayerScoreAveraged, setPlayerScoring, setPopulationUpdate, setRewire, setScoreAt, setSyncFraction, setTagAt, 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
-
cpairmodule
For pairwise interaction modulesmodule==pairmoduleholds andnullotherwise. Convenience field to reduce the number of (unnecessary) casts.- See Also:
-
cgroupmodule
For group interaction modulesmodule==groupmoduleholds andnullotherwise. Convenience field to reduce the number of (unnecessary) casts.- See Also:
-
-
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
Play a pairwise interaction with the individuals ingroup.Continuous modules with a single trait never get here.
Continuous modules with multiple traits never get here.
- Overrides:
playPairGameAtin classIBSMCPopulation- Parameters:
group- the group of individuals interacting in pairs- See Also:
-
adjustPairGameScoresAt
public void adjustPairGameScoresAt(int me) Adjusts scores of focal individual with indexmeand its neighbors aftermechanged trait. Only works ifadjustScores==true.Important: new trait must not yet have been committed.
Continuous modules with a single trait never get here.
Continuous modules with multiple traits never get here.
- Overrides:
adjustPairGameScoresAtin classIBSMCPopulation- Parameters:
me- the index of the focal individual- See Also:
-
playGroupGameAt
Play a group interaction with the individuals ingroup.Continuous modules with a single trait never get here.
Continuous modules with multiple traits never get here.
- Overrides:
playGroupGameAtin classIBSMCPopulation- Parameters:
group- the group of interacting individuals- See Also:
-
playGroupSequentiallyAt
Description copied from class:IBSMCPopulationEvaluate sequential group interactions when not enough opponents are available simultaneously.- Overrides:
playGroupSequentiallyAtin classIBSMCPopulation- Parameters:
me- focal player indexgroup- sampled opponent groupnGroup- number of players participating in each interaction
-
playGroupOnceAt
Description copied from class:IBSMCPopulationEvaluate a single group interaction with the sampled opponents.- Overrides:
playGroupOnceAtin classIBSMCPopulation- Parameters:
me- focal player indexgroup- sampled opponent group
-
yalpGroupGameAt
Counterpart ofIBSPopulation.playGroupGameAt(IBSGroup),IBSPopulation.playGameAt(int)and/orIBSPopulation.playGameSyncAt(int). Removes the payoffs of group interactions.Continuous modules with a single trait never get here.
Continuous modules with multiple traits never get here.
- Overrides:
yalpGroupGameAtin classIBSMCPopulation- Parameters:
group- the interaction group- See Also:
-
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)
-