Class IBSMCPopulation
- Direct Known Subclasses:
IBSCPopulation
IBSCPopulation
.- Author:
- Christoph Hauert
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected IBS.HasIBS.MCGroups
For group interaction modulesmodule==groupmodule
holds andnull
otherwise.protected double[]
Temporary storage for strategies/traits of individuals in group interactions.protected IBSC.Init
Type of initial configuration.private double[]
The array for storing the mean and standard deviation of the initial state.private double[]
The array for calculating and storing the mean traits and their standard deviation.protected Continuous
The continuous module associated with this model.protected Mutation.Continuous
The mutation parameters.protected double[]
Temporary storage for the traits/strategies of the focal individual.protected double[]
Temporary storage for the scores of each strategy/type prior to the group interactions.protected double[]
Temporary storage for the traits/strategies of the focal individual before the update.(package private) IBSMCPopulation
The interaction partner/opponent of this populationopponent.getModule()==getModule().getOpponent()
.protected IBS.HasIBS.MCPairs
For pairwise interaction modulesmodule==pairmodule
holds andnull
otherwise.protected double[]
Temporary storage for strategies/traits of individuals in small sub-group interactions.double[]
The array of individual traits/strategies.protected double[]
The array for temporarily storing strategies during updates.protected double[]
The array with the maximal values for each trait/strategy.protected double[]
The array with the minimal values for each trait/strategy.Fields 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
ConstructorsConstructorDescriptionIBSMCPopulation
(EvoLudo engine, Continuous module) Creates a population of individuals with multiple continuous traits for IBS simulations. -
Method Summary
Modifier and TypeMethodDescriptionvoid
adjustPairGameScoresAt
(int me) Adjusts scores of focal individual with indexme
and its neighbors afterme
changed strategy.void
adjustScoreAt
(int index, double adjust) Adjust score of individual with indexindex
byadjust
and update all applicable helper variables, e.g.void
adjustScoreAt
(int index, double before, double after) Adjust score of individual with indexindex
frombefore
toafter
and update all applicable helper variables, e.g.boolean
check()
Check all model parameters for consistency and adjust if necessary (and feasible).boolean
Check if population has converged.void
After a synchronous update step the new state must be copied back to become the current state.void
commitStrategyAt
(int me) The change of a strategy of the player atindex
is stored in a temporary variable and must be committed before proceeding.private double
deltaStrategies
(int a, int b) Measure the (Cartesian) distance between strategies ata
andb
protected boolean
Check if scores can be adjusted rather than recalculated after an individual changed its strategy.void
encodeStrategies
(StringBuilder plist) Encode the strategies of all individuals in the IBS model in aplist
inspiredXML
string.private void
gatherPlayers
(IBSGroup group) Gather the traits/strategies of all individuals in the interaction groupgroup
.void
get2DTraitHistogramData
(double[] bins, int trait1, int trait2) Creates 2D histogram for traitstrait1
andtrait2
.getInit()
Gets the type of the initial configuration and its arguments.void
getInitialTraits
(double[] traits) Returns the initial trait(s) of this population in the arrayinit
.void
getMeanFitness
(double[] mean) Returns the mean fitness of this population in the arraymean
.void
getMeanTraits
(double[] mean) Returns the mean trait(s) of this population in the arraymean
.Gets the status of the as a formatted string.<T> void
getTraitData
(T[] colors, ColorMap<T> colorMap) Returns the traits of all individuals in this population coded as colors in the arraycolors
using the mapcolorMap
.void
getTraitHistogramData
(double[][] bins) Creates a histogram for each trait separately (if there are multiple) and returns the result in the arraybins
where the first index denotes the trait and the second refers to the bin.void
getTraitHistogramData
(double[] bins, int trait) Creates a histogram for the trait with indextrait
and returns the result in the arraybins
.double[]
Get the maxima for all traits.double[]
Get the minima for all traits.getTraitNameAt
(int index) Gets the formatted name of the trait of the individual at siteindex
.getTraits
(int digits) Gets all traits of all individuals.boolean
haveSameStrategy
(int a, int b) Check if individuals with indexa
and indexb
have the same strategies.void
init()
Initialize the model.boolean
isSameStrategy
(int a) Check if individual with indexa
has switched strategies.protected boolean
maybeMutateAt
(int focal, boolean switched) Consider mutating the trait of the focal individual with indexfocal
.protected void
maybeMutateMoran
(int source, int dest) Consider mutating the trait of the parent individual with indexsource
.boolean
mouseHitNode
(int hit, boolean alt) Called from GUI if node/individual with indexidx
received a mouse click or tap and indicates whether thealt
-key had been pressed.double
mutateAt
(int focal) Mutate the strategy of the focal individual with indexfocal
.private boolean
mutateAt
(int focal, boolean switched) Mutate all traits/strategies of the focal individual with indexfocal
ifmutate == true
.void
playGroupGameAt
(IBSGroup group) Play a group interaction with the individuals ingroup
.void
playPairGameAt
(IBSGroup group) Play a pairwise interaction with the individuals ingroup
.boolean
preferredPlayerBest
(int me, int best, int sample) For deterministic updating with multiple strategies (more than two), it must be specified which strategy is the preferred one.void
Prior to a synchronous update step the current state must be duplicated in preparation for processing the next step.void
reset()
Reset the model.boolean
restoreStrategies
(Plist plist) Restore the strategies of all individuals encoded in theplist
inspiredmap
ofkey, value
-pairs.void
Sets the type of the initial configuration and any accompanying arguments.void
setOpponentPop
(IBSPopulation opponent) Set the interaction partner/opponent of this population.void
swapStrategies
(int a, int b) Swap strategies of individuals with indexa
and indexb
.void
updateFromModelAt
(int index, int modelPlayer) Update individual with indexme
and adopt the strategy of individual with indexyou
.void
yalpGroupGameAt
(IBSGroup group) Counterpart ofIBSPopulation.playGroupGameAt(IBSGroup)
,IBSPopulation.playGameAt(int)
and/orIBSPopulation.playGameSyncAt(int)
.Methods 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, 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, resetStrategies, restoreFitness, restoreGeometry, restoreInteractions, setAddwire, setConsistencyCheck, setMaxEffScoreIdx, setMigrationProb, setMigrationType, setPlayerScoreAveraged, setPlayerScoring, setPopulationUpdate, setRewire, setScoreAt, setSyncFraction, setTagAt, srandom, step, swapScoresAt, updateEffScoreRange, updateFitnessAt, updateMinMaxScores, updatePlayerAsync, updatePlayerAsyncAt, updatePlayerAt, updatePlayerBest, updatePlayerBestHalf, updatePlayerBestResponse, updatePlayerEcology, updatePlayerEcologyAt, updatePlayerMoranBirthDeath, updatePlayerMoranBirthDeathAt, updatePlayerMoranDeathBirth, updatePlayerMoranDeathBirthAt, updatePlayerMoranImitate, updatePlayerMoranImitateAt, updatePlayerSwap, updateProportionalAbs, updateReplicatorHalf, updateReplicatorPlus, updateScoreAt, updateScoreAt, updateScoreAt, updateScores, updateThermal
-
Field Details
-
module
The continuous module associated with this model.Note: This deliberately hides
IBSPopulation.module
. The two variables point to the same object but this setup avoids unnecessary casts because onlyContinuous
modules generateIBSCPopulation
(s). -
pairmodule
For pairwise interaction modulesmodule==pairmodule
holds andnull
otherwise. Convenience field to reduce the number of (unnecessary) casts.- See Also:
-
groupmodule
For group interaction modulesmodule==groupmodule
holds andnull
otherwise. Convenience field to reduce the number of (unnecessary) casts.- See Also:
-
opponent
IBSMCPopulation 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 onlyDiscrete
modules generateIBSDPopulation
(s). -
mutation
The mutation parameters. -
traitMin
protected double[] traitMinThe array with the minimal values for each trait/strategy. Convenience variable.Note: Internally traits are always scaled to
[0, 1]
.- See Also:
-
traitMax
protected double[] traitMaxThe array with the maximal values for each trait/strategy. Convenience variable.Note: Internally traits are always scaled to
[0, 1]
.- See Also:
-
strategies
public double[] strategiesThe array of individual traits/strategies. The traits of individuali
is stored atstrategies[i * nTraits]
throughstrategies[(i + 1) * nTraits - 1]
-
strategiesScratch
protected double[] strategiesScratchThe array for temporarily storing strategies during updates. -
groupStrat
protected double[] groupStratTemporary storage for strategies/traits of individuals in group interactions. -
smallStrat
protected double[] smallStratTemporary storage for strategies/traits of individuals in small sub-group interactions. -
myTrait
protected double[] myTraitTemporary storage for the traits/strategies of the focal individual. -
oldTrait
protected double[] oldTraitTemporary storage for the traits/strategies of the focal individual before the update. Used for adjusting scores. -
oldScores
protected double[] oldScoresTemporary storage for the scores of each strategy/type prior to the group interactions. -
meantrait
private double[] meantraitThe array for calculating and storing the mean traits and their standard deviation. Must be of length> 2 * nTraits
. -
inittrait
private double[] inittraitThe array for storing the mean and standard deviation of the initial state. Must be of length> 2 * nTraits
. -
init
Type of initial configuration.- See Also:
-
-
Constructor Details
-
IBSMCPopulation
Creates a population of individuals with multiple continuous traits for IBS simulations.- Parameters:
engine
- the pacemaker for running the modelmodule
- the module that defines the game
-
-
Method Details
-
setOpponentPop
Description copied from class:IBSPopulation
Set the interaction partner/opponent of this population.- Overrides:
setOpponentPop
in classIBSPopulation
- Parameters:
opponent
- the interaction partner/opponent
-
checkConvergence
public boolean checkConvergence()Description copied from class:IBSPopulation
Check if population has converged. By defaulttrue
if population is monomorphic and no (zero) mutations. However, different implementations may have different criteria for convergence.Note: This tends to be less restrictive than reaching an absorbing state. Typically convergence is used as a criterion to abort simulations.
- Specified by:
checkConvergence
in classIBSPopulation
- Returns:
true
if converged.
-
getTraitMin
public double[] getTraitMin()Get the minima for all traits.- Returns:
- the array with the trait minima
-
getTraitMax
public double[] getTraitMax()Get the maxima for all traits.- Returns:
- the array with the trait maxima
-
updateFromModelAt
public void updateFromModelAt(int index, int modelPlayer) Description copied from class:IBSPopulation
Update individual with indexme
and adopt the strategy of individual with indexyou
.Note: method must be subclassed to deal with different data types of strategies but should also include a call to super.
- Overrides:
updateFromModelAt
in classIBSPopulation
- Parameters:
index
- the index of the focal individualmodelPlayer
- the index of the model individual to adopt strategy from- See Also:
-
haveSameStrategy
public boolean haveSameStrategy(int a, int b) Description copied from class:IBSPopulation
Check if individuals with indexa
and indexb
have the same strategies.- Specified by:
haveSameStrategy
in classIBSPopulation
- Parameters:
a
- the index of first individualb
- the index of second individual- Returns:
true
if the two individuals have the same strategies
-
isSameStrategy
public boolean isSameStrategy(int a) Description copied from class:IBSPopulation
Check if individual with indexa
has switched strategies.Note: this test is only meaningful before strategy gets committed.
- Specified by:
isSameStrategy
in classIBSPopulation
- Parameters:
a
- index of individual- Returns:
true
if strategy remained the same- See Also:
-
swapStrategies
public void swapStrategies(int a, int b) Description copied from class:IBSPopulation
Swap strategies of individuals with indexa
and indexb
.Note: the strategies still need to be committed.
- Specified by:
swapStrategies
in classIBSPopulation
- Parameters:
a
- the index of first individualb
- the index of second individual- See Also:
-
mutateAt
public double mutateAt(int focal) Description copied from class:IBSPopulation
Mutate the strategy of the focal individual with indexfocal
. The mutated strategy is committed and the scores updated.- Specified by:
mutateAt
in classIBSPopulation
- Parameters:
focal
- the index of the focal individual- Returns:
- the elapsed time in realtime units
-
maybeMutateAt
protected boolean maybeMutateAt(int focal, boolean switched) Description copied from class:IBSPopulation
Consider mutating the trait of the focal individual with indexfocal
. The strategy of the focal individual is stored in the arraystrategies
unless the focal individual switched strategy. In that case the current strategy is stored in the arraystrategyScratch
.Important: The trait is not committed regardless of whether a mutation occurred.
- Specified by:
maybeMutateAt
in classIBSPopulation
- Parameters:
focal
- the index of the focal individualswitched
-true
if the focal individual switched strategy- Returns:
true
if the trait of the focal individual changed
-
maybeMutateMoran
protected void maybeMutateMoran(int source, int dest) Description copied from class:IBSPopulation
Consider mutating the trait of the parent individual with indexsource
. The mutated strategy is committed and the scores updated.- Specified by:
maybeMutateMoran
in classIBSPopulation
- Parameters:
source
- the index of the parent individualdest
- the index of the location for the offspring placement
-
mutateAt
private boolean mutateAt(int focal, boolean switched) Mutate all traits/strategies of the focal individual with indexfocal
ifmutate == true
. In all cases commit strategies and update scores.- Parameters:
focal
- the index of the focal individual that gets updatedswitched
-true
if focal already switched trait- Returns:
true
if the strategy has changed
-
preferredPlayerBest
public boolean preferredPlayerBest(int me, int best, int sample) For deterministic updating with multiple strategies (more than two), it must be specified which strategy is the preferred one.Summary: does 'me' prefer 'sample' over 'best'?
Here we introduce the convention the trait/strategy closer to
me
is preferred.- Specified by:
preferredPlayerBest
in classIBSPopulation
- Parameters:
me
- the index of the focal individualbest
- the index of the best performing individualsample
- the index of the sample type- Returns:
true
ifsample
is preferred overbest
-
deltaStrategies
private double deltaStrategies(int a, int b) Measure the (Cartesian) distance between strategies ata
andb
- Parameters:
a
- the index where the traits/strategies of the first individual startb
- the index where the traits/strategies of the second individual start- Returns:
- the distance between
a
andb
-
gatherPlayers
Gather the traits/strategies of all individuals in the interaction groupgroup
.- Parameters:
group
- the interaction group
-
doAdjustScores
protected boolean doAdjustScores()Description copied from class:IBSPopulation
Check if scores can be adjusted rather than recalculated after an individual changed its strategy. This requires that individuals interact with all their neighbours and that the structure of the population is not well-mixed. Some implementations may be able to extend adjustments to other structures. For example, adjusting scores is feasible in well-mixed populations for discrete traits/strategies.Requirements:
- Group.SAMPLING_ALL
- individuals need to be interacting with all their neighbours (not just a randomly selected subset).
- Geometry.MEANFIELD
- interactions with everyone are not feasible (impossible to model
efficiently), in general, for unstructured populations (subclasses can do
better, e.g. for discrete strategies it is possible, see
IBSDPopulation.doAdjustScores()
). - playerScoreReset
- if scores are reset whenever an individual adopts the strategy of another (regardless of whether an actual strategy change occurred) then the expected number of interactions of each individual remains constant over time (even though the interaction count may differ for individuals on heterogeneous structures).
- Specified by:
doAdjustScores
in classIBSPopulation
- Returns:
true
if adjusting scores is feasible- See Also:
-
adjustScoreAt
public void adjustScoreAt(int index, double before, double after) Description copied from class:IBSPopulation
Adjust score of individual with indexindex
frombefore
toafter
and update all applicable helper variables, e.g.sumFitness
.Important: Use only to adjust scores of individuals that did not change strategy.
- Specified by:
adjustScoreAt
in classIBSPopulation
- Parameters:
index
- the index of the individualbefore
- the score before adjustmentsafter
- the score after adjustments
-
adjustScoreAt
public void adjustScoreAt(int index, double adjust) Description copied from class:IBSPopulation
Adjust score of individual with indexindex
byadjust
and update all applicable helper variables, e.g.sumFitness
.- Specified by:
adjustScoreAt
in classIBSPopulation
- Parameters:
index
- the index of the individualadjust
- the score adjustment
-
playPairGameAt
Description copied from class:IBSPopulation
Play a pairwise interaction with the individuals ingroup
.- Specified by:
playPairGameAt
in classIBSPopulation
- Parameters:
group
- the group of individuals interacting in pairs
-
adjustPairGameScoresAt
public void adjustPairGameScoresAt(int me) Description copied from class:IBSPopulation
Adjusts scores of focal individual with indexme
and its neighbors afterme
changed strategy. Only works ifadjustScores==true
.Important: new strategy must not yet have been committed.
- Specified by:
adjustPairGameScoresAt
in classIBSPopulation
- Parameters:
me
- the index of the focal individual
-
playGroupGameAt
Description copied from class:IBSPopulation
Play a group interaction with the individuals ingroup
.- Specified by:
playGroupGameAt
in classIBSPopulation
- Parameters:
group
- the group of interacting individuals
-
yalpGroupGameAt
Description copied from class:IBSPopulation
Counterpart ofIBSPopulation.playGroupGameAt(IBSGroup)
,IBSPopulation.playGameAt(int)
and/orIBSPopulation.playGameSyncAt(int)
. Removes the payoffs of group interactions.- Specified by:
yalpGroupGameAt
in classIBSPopulation
- Parameters:
group
- the interaction group
-
prepareStrategies
public void prepareStrategies()Description copied from class:IBSPopulation
Prior to a synchronous update step the current state must be duplicated in preparation for processing the next step.- Specified by:
prepareStrategies
in classIBSPopulation
- See Also:
-
commitStrategies
public void commitStrategies()Description copied from class:IBSPopulation
After a synchronous update step the new state must be copied back to become the current state.- Specified by:
commitStrategies
in classIBSPopulation
- See Also:
-
commitStrategyAt
public void commitStrategyAt(int me) Description copied from class:IBSPopulation
The change of a strategy of the player atindex
is stored in a temporary variable and must be committed before proceeding.- Specified by:
commitStrategyAt
in classIBSPopulation
- Parameters:
me
- the index of the player that needs to have its new strategy committed
-
getTraitData
Description copied from class:IBSPopulation
Returns the traits of all individuals in this population coded as colors in the arraycolors
using the mapcolorMap
. Used by GUI to visualize the current state of this IBS model. Colors are coded in different data types<T>
depending on the runtime environment (GWT or JRE) as well as the graph (e.g.PopGraph2D
orPopGraph3D
).- Specified by:
getTraitData
in classIBSPopulation
- Type Parameters:
T
- the type of color data (String
orMeshLambertMaterial
for GWT andColor
for JRE).- Parameters:
colors
- the array where the colors of all nodes are storedcolorMap
- the map that converts traits into colors
-
getTraitHistogramData
public void getTraitHistogramData(double[][] bins) Creates a histogram for each trait separately (if there are multiple) and returns the result in the arraybins
where the first index denotes the trait and the second refers to the bin.- Parameters:
bins
- the array to store the histogram(s)
-
getTraitHistogramData
public void getTraitHistogramData(double[] bins, int trait) Creates a histogram for the trait with indextrait
and returns the result in the arraybins
.- Parameters:
bins
- the array to store the histogram(s)trait
- the index of the trait
-
get2DTraitHistogramData
public void get2DTraitHistogramData(double[] bins, int trait1, int trait2) Creates 2D histogram for traitstrait1
andtrait2
. The result is returned in the linear arraybins
and arranged in a way that is compatible with square lattice geometries for visualization byDistribution
andPopGraph2D
(GWT only).- Parameters:
bins
- the linear array to store the 2D histogramtrait1
- the index of the first traittrait2
- the index of the second trait- See Also:
-
getTraits
Gets all traits of all individuals. The traits are returned as a formatted string with an accuracy ofdigits
decimals. With multiple traits they are listed sequentially for each individual.- Parameters:
digits
- the number of decimals of the formatted string- Returns:
- the formatted traits
-
getTraitNameAt
Description copied from class:IBSPopulation
Gets the formatted name of the trait of the individual at siteindex
.- Specified by:
getTraitNameAt
in classIBSPopulation
- Parameters:
index
- the index of the- Returns:
- the string describing the trait
-
getInitialTraits
public void getInitialTraits(double[] traits) Returns the initial trait(s) of this population in the arrayinit
. Used by GUI to visualize the initial state of this IBS model.Note: For continuous modules the IBS model returns the concatenated mean and stdev of each trait in
traits
.- Specified by:
getInitialTraits
in classIBSPopulation
- Parameters:
traits
- the array for returning the initial trait values- See Also:
-
getMeanTraits
public void getMeanTraits(double[] mean) Returns the mean trait(s) of this population in the arraymean
. Used by GUI to visualize the current state of this IBS model.For continuous traits/strategies the first
nTraits
entries represent the mean of each trait and the secondnTraits
entries denote the standard deviation.- Specified by:
getMeanTraits
in classIBSPopulation
- Parameters:
mean
- the array for returning the trait values- See Also:
-
getMeanFitness
public void getMeanFitness(double[] mean) Returns the mean fitness of this population in the arraymean
. Used by GUI to visualize the current state of this IBS model. Returnstrue
if data point belongs to the same time series andfalse
if a new series was started throughIBSPopulation.init()
orIBSPopulation.reset()
.For continuous traits/strategies the first
nTraits
entries represent the mean fitness of each trait and the secondnTraits
entries denote their standard deviation.- Specified by:
getMeanFitness
in classIBSPopulation
- Parameters:
mean
- the array for storing the mean fitness values- See Also:
-
getStatus
Description copied from class:IBSPopulation
Gets the status of the as a formatted string. This is typically used in the GUI to summarize the progress of the model.- Specified by:
getStatus
in classIBSPopulation
- Returns:
- the status of the population
-
check
public boolean check()Description copied from class:IBSPopulation
Check all model parameters for consistency and adjust if necessary (and feasible). Returnstrue
if adjustments require a reset. Free memory if possible and request a reset if new memory needs to be allocated.- Overrides:
check
in classIBSPopulation
- Returns:
true
if reset is required- See Also:
-
setInit
Sets the type of the initial configuration and any accompanying arguments. If eithertype
orargs
arenull
the respective current setting is preserved.- Parameters:
init
- the type and arguments of the initial configuration
-
getInit
Gets the type of the initial configuration and its arguments.- Returns:
- the type and arguments of the initial configuration
-
init
public void init()Description copied from class:IBSPopulation
Initialize the model. All parameters must be consistent. Subclasses must override this method to generate the initial strategy configuration and call super.Note: Initialization leaves the interaction and competition structures untouched
- Overrides:
init
in classIBSPopulation
- See Also:
-
reset
public void reset()Description copied from class:IBSPopulation
Reset the model. All parameters must be consistent at this point. Allocate memory and initialize the interaction and competition structures. If structures include random elements, e.g. random regular graphs, a new structure is generated. Generate initial configuration. Subclasses must override this method to allocate memory for the strategies and call super.- Overrides:
reset
in classIBSPopulation
- See Also:
-
mouseHitNode
public boolean mouseHitNode(int hit, boolean alt) Description copied from class:IBSPopulation
Called from GUI if node/individual with indexidx
received a mouse click or tap and indicates whether thealt
-key had been pressed.- Overrides:
mouseHitNode
in classIBSPopulation
- Parameters:
hit
- the index of the nodealt
-true
if thealt
-key was pressed- Returns:
false
if no actions taken
-
encodeStrategies
Description copied from class:IBSPopulation
Encode the strategies of all individuals in the IBS model in aplist
inspiredXML
string.- Specified by:
encodeStrategies
in classIBSPopulation
- Parameters:
plist
- theStringBuilder
to write the encoded state to- See Also:
-
restoreStrategies
Description copied from class:IBSPopulation
Restore the strategies of all individuals encoded in theplist
inspiredmap
ofkey, value
-pairs.- Specified by:
restoreStrategies
in classIBSPopulation
- Parameters:
plist
- the map ofkey, value
-pairs- Returns:
true
if successful- See Also:
-