Class HierarchicalGeometry
Object
AbstractGeometry
AbstractLattice
HierarchicalGeometry
Hierarchical meta-population structure implementation. Embeds well-mixed or
square-lattice demes into recursive layers.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate int[]The number of units at each hierarchical level.private doubleCoupling strength between hierarchical levels.private GeometryTypeThe geometry of each hierarchical level.Fields inherited from class AbstractLattice
fixedBoundaryFields inherited from class AbstractGeometry
cli, connectivity, derivedId, EMPTY_LINKS, engine, features, geometryId, in, isInterspecies, isRegular, isRewired, isSingle, isUndirected, isValid, kin, kout, logger, name, network2D, network3D, out, pAddwire, pRewire, size, specs, type -
Constructor Summary
ConstructorsConstructorDescriptionHierarchicalGeometry(EvoLudo engine) Create a hierarchical geometry tied to the given engine. -
Method Summary
Modifier and TypeMethodDescriptionprivate intcalcSquareUnit(int nHierarchy) Calculate the unit size for square-lattice hierarchies, adjusting each level to a perfect square with at least 2x2 units with at least 3x3 individuals each.private booleanProcess the hierarchy specifications to calculate the number of units and the size of each unit.protected booleanHook for subclasses to implement geometry specific checks.clone()Clone geometry.booleanint[]Retrieve a copy of the processed hierarchy definition (levels plus individuals per deme).doubleReport the weight applied to inter-level interactions.Retrieve the geometry used within each hierarchy level (e.g.inthashCode()voidinit()Initialise the geometry.private voidinitHierarchy(int level, int start) Utility method to generate hierarchical graphs.booleanisSubtype(GeometryType type) Check if the sub-geometry matches the given type.booleanisUnique()Check if current geometry unique.(package private) booleanParse geometry-specific CLI options.private voidParse the hierarchy-related CLI spec, updating subtype, boundary flag and weight, and storing the raw hierarchy levels (without the computed leaf size).Methods inherited from class AbstractLattice
ensureSquareSize, isFixedBoundary, setFixedBoundary, stripBoundaryMethods inherited from class AbstractGeometry
addDirected, addEdgeAt, addLinkAt, addUndirected, alloc, check, clearLinksFrom, clearLinksTo, create, create, create, decodeGeometry, deriveCompetitionGeometry, displaySingle, encodeGeometry, enforceSize, getAddwire, getCLI, getConnectivity, getEncodeKey, getFeatures, getLabel, getName, getNetwork2D, getNetwork3D, getRewire, getSize, getSpecs, getType, isConsistent, isDerivedFrom, isGraphConnected, isInterspecies, isLattice, isNeighborOf, isRegular, isRewired, isSingle, isType, isUndirected, markDerivedFrom, parse, removeEdgeAt, removeLinkAt, rewire, rewireDirected, rewireEdgeAt, rewireLinkAt, rewireUndirected, setAddwire, setConnectivity, setInterspecies, setName, setNetwork2D, setNetwork3D, setRewire, setSingle, setSize, setType, swapEdges, usage, warn
-
Field Details
-
subType
The geometry of each hierarchical level. -
hierarchy
private int[] hierarchyThe number of units at each hierarchical level. -
hierarchyWeight
private double hierarchyWeightCoupling strength between hierarchical levels.
-
-
Constructor Details
-
HierarchicalGeometry
Create a hierarchical geometry tied to the given engine.- Parameters:
engine- EvoLudo pacemaker
-
-
Method Details
-
parse
Description copied from class:AbstractGeometryParse geometry-specific CLI options.- Overrides:
parsein classAbstractGeometry- Parameters:
spec- the argument string without the geometry key- Returns:
trueif parsing succeeded,falseif invalid
-
isSubtype
Check if the sub-geometry matches the given type.- Parameters:
type- the geometry type to check against- Returns:
trueif the sub-geometry matches the given type
-
getSubType
Retrieve the geometry used within each hierarchy level (e.g. square or well-mixed).- Returns:
- the geometry used within each hierarchy level (e.g. square or well-mixed)
-
getHierarchyWeight
public double getHierarchyWeight()Report the weight applied to inter-level interactions.- Returns:
- the weight applied to inter-level interactions
-
getHierarchyLevels
public int[] getHierarchyLevels()Retrieve a copy of the processed hierarchy definition (levels plus individuals per deme).- Returns:
- a copy of the processed hierarchy definition (levels plus individuals per deme)
-
checkSettings
protected boolean checkSettings()Description copied from class:AbstractGeometryHook for subclasses to implement geometry specific checks.- Overrides:
checkSettingsin classAbstractGeometry- Returns:
trueif adjustments require a reset
-
calcUnitSize
private boolean calcUnitSize()Process the hierarchy specifications to calculate the number of units and the size of each unit. On each level there must be at least 2 units for well-mixed hierarchies and each unit must contain at least 2 individuals. For hierarchies with square lattices each level must ahev at least 2x2 units with at least 3x3 individuals each.- Returns:
trueif the size was adjusted and resetting is required
-
calcSquareUnit
private int calcSquareUnit(int nHierarchy) Calculate the unit size for square-lattice hierarchies, adjusting each level to a perfect square with at least 2x2 units with at least 3x3 individuals each.- Parameters:
nHierarchy- the number of hierarchy levels- Returns:
- the total size of the graph
-
init
public void init()Initialise the geometry.Requirements/notes:
Only well-mixed (complete) or square lattice graphs are currently supported.- Specified by:
initin classAbstractGeometry
-
initHierarchy
private void initHierarchy(int level, int start) Utility method to generate hierarchical graphs.- Parameters:
level- the hierarchical levelstart- the index of the first node to process
-
isUnique
public boolean isUnique()Description copied from class:AbstractGeometryCheck if current geometry unique. Only unique geomteries need to be encoded.Requirements/notes:
- Lattices etc. are not unique because they can be identically recreated.
- Complete graphs, stars, wheels, etc. are not unique.
- All geometries involving random elements are unique.
- All rewired geometries are unique.
- Hierarchical geometries require recursive checks of uniqueness.
- Overrides:
isUniquein classAbstractGeometry- Returns:
trueif geometry is unique
-
clone
Description copied from class:AbstractGeometryClone geometry.Requirements/notes:
- Overrides:
clonein classAbstractLattice- Returns:
- clone of geometry
-
hashCode
public int hashCode()- Overrides:
hashCodein classAbstractLattice
-
equals
- Overrides:
equalsin classAbstractLattice
-
parseHierarchy
private void parseHierarchy()Parse the hierarchy-related CLI spec, updating subtype, boundary flag and weight, and storing the raw hierarchy levels (without the computed leaf size).
-