Skip to content

Configurable spatial connectivity feature - #307

Merged
anyaevostinar merged 125 commits into
anyaevostinar:mainfrom
amlalejini:spatial-struct-lalejini
Jul 10, 2026
Merged

Configurable spatial connectivity feature#307
anyaevostinar merged 125 commits into
anyaevostinar:mainfrom
amlalejini:spatial-struct-lalejini

Conversation

@amlalejini

@amlalejini amlalejini commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

The main feature added by this pull request is the ability to load any graph structure (either in a matrix format or in a csv, one row per edge) to define the population's structure (i.e, which individuals neighbor each other). This feature is implemented in default mode, so it should work for all currently implemented downstream modes.

Adding arbitrary spatial structure configuration required a few fundamental tweaks to basic setup, such as requiring that spatial structure be configured before initializing the population. This motivated shifting SetupHosts and SetupSymbionts to protected functions that should be called only from the World's Setup function.

Other less major changes:

  • Minor changes to spacing / indentation throughout for consistency (e.g., removal of trailing spaces, consistent indent size, consistent spacing between ) {, etc.). Mainly in files that were already being touched by this pull request.
  • Shift phylogeny taxon mode and tag metric mode configuration to strings converted into enums on setup.
  • Additional testing utilities in source/test/test_utils.h. E.g., a world wrapper for exposing public functions to tests.
  • Additional generic utilities combined with sgp mode utilities (which are generically useful) and moved into source/utils.h
  • Marked many functions as const that can be marked as const
  • InjectHost always places in random location, no longer changes population capacity; population capacity must be sized prior to calling
  • AddOrgAt no longer resizes the population in well-mixed mode (i.e., now behaves consistently across spatial modes)
  • Many updates to tests to accomodate changes above.

Active TODOS before merging:

  • Fix existing tests to accommodate changes to SetupHosts / SetupSymbionts
  • (active) Merge updates to main, update tests/merged changes as needed
  • Test new spatial structure configuration option
    • For default mode
    • For sgp mode because it implements its own setup
  • Add emp warning / asserts to enforce running Setup prior to running an experiment.
  • Output tag length in run config snapshot

Questions / notes to reviewer(s)

  • See comment in multi-infection integration test about world size configuration

Owen Hillary and others added 30 commits June 11, 2026 08:03
…rmatting in SpatialStructure.h. Add example spatial structure files.
…atial structure setup code into smaller helper functions for each spatial structure mode.
…incorporating spatial structure into SymWorld
…on to sgp world, more spacing consistency fixes
…m backend. Move corresponding setup code into helper functions.
…ake cure updates config a size_t instead of int
…unctions for unit testing, continue updating tests to work with spatial structure changes
}

TEST_CASE("SetupSymbionts with tag matching on", "[default]"){
// NOTE: This test is a little bit frustrating to maintain if we change calls to

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, let's remove this comment

config.PGG(1);
config.MUTATION_SIZE(0.05);
config.UPDATES(2000);
// @AML: These world size parameters weren't taking effect in the original test

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, thanks! We can remove this comment now

Comment thread source/test/sgp_mode_test/functional_tests/HealthMode.test.cc
Comment thread source/test/sgp_mode_test/unit_tests/SGPHost.test.cc
Comment thread source/test/test_utils.h Outdated
cfg.MUTATION_SIZE(0);
}

// Wrapper for Symbumlation world classes intended to expose protected

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo

Comment thread source/utils.h

@anyaevostinar anyaevostinar left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whew, some things to change and some questions

@anyaevostinar anyaevostinar left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yey, looks good, thank you!!!!

@anyaevostinar
anyaevostinar merged commit d273443 into anyaevostinar:main Jul 10, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants