Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge misc. MABE2 support branches into MABE_devel #466

Merged
merged 146 commits into from
Jul 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
146 commits
Select commit Hold shift + click to select a range
e0a54c2
adding systematics documentation
abbywlsn Jun 4, 2020
1c14505
miniphylotrees makes very simple trees, still needs to incorporate sy…
abbywlsn Jun 16, 2020
2824062
miniphylotrees prints data to csv file now
abbywlsn Jun 18, 2020
d0b9be3
added systematics manager tools, still broken though
abbywlsn Jun 18, 2020
01e3808
new changes to miniphylotrees
abbywlsn Jun 22, 2020
5b47ce7
miniphylotrees works and generates data, concerned about compiler dif…
abbywlsn Jun 25, 2020
10ff45e
new csv with percentile data and miniphylotrees is correctly outputti…
abbywlsn Jun 26, 2020
cf2bbe7
original file with no systematics implementation for example purposes
abbywlsn Jun 26, 2020
7e22970
new miniphylo changes
abbywlsn Jul 1, 2020
c9ad62a
changes made to systematics with percentile functions
abbywlsn Jul 1, 2020
1836ef4
new improvements and updated systematics functions
abbywlsn Jul 23, 2020
14dcc46
cleaned up miniphylotrees
abbywlsn Jul 28, 2020
28294af
updated systematics function, still needs work
abbywlsn Jul 30, 2020
72c442e
cleaning up directories
abbywlsn Jul 31, 2020
516735b
more directory cleaning
abbywlsn Jul 31, 2020
f1c61a3
cleaned up systematics.h
abbywlsn Jul 31, 2020
d0aca02
cleaning up some stuff in GenTrees
abbywlsn Jul 31, 2020
5cf9f74
Fix data file tests
emilydolson Mar 7, 2021
f8824ef
Fix bug when mrca is alive and dies
emilydolson Mar 7, 2021
147c7bd
Merge fixes
emilydolson Mar 7, 2021
75f080c
merge in reorg
emilydolson Mar 7, 2021
3cf3c16
Remove extra files
emilydolson Mar 7, 2021
d0b5037
Merge branch 'fix-systematics' into systematics-normalization
emilydolson Mar 7, 2021
36d675d
Add mrca test
emilydolson Mar 8, 2021
cc286a6
Add mrca test
emilydolson Mar 8, 2021
be947f0
More systematics cleanup, tests, docs
emilydolson Mar 9, 2021
606affa
Add more tests, docs, simplify interface
emilydolson Mar 10, 2021
88b81a7
More docs and tests
emilydolson Mar 10, 2021
5ec6a95
organize systematics.hpp
emilydolson Mar 10, 2021
0e9d158
Clean up documentation
emilydolson Mar 10, 2021
f466fc9
Merge in bits-overhaul
emilydolson Jun 18, 2021
b5d4465
Adjust AnyFunction to obey rule of five
FergusonAJ Sep 28, 2021
9cbf52d
Clean up AnyFunctions fix
FergusonAJ Sep 28, 2021
f9c65ef
Merge in MABE compatability changes
emilydolson Oct 6, 2021
b9cce08
Fix merge conflict
emilydolson Oct 6, 2021
97dccf6
Add version of AddOrg that takes parent position
emilydolson Oct 6, 2021
e16232d
Merge in MABE_devel
emilydolson Oct 6, 2021
849876d
Fix arg names
emilydolson Oct 6, 2021
82bd90d
Add SwapPositions method to systematics
emilydolson Oct 6, 2021
42554c7
Fix parent/child confusion error
emilydolson Oct 6, 2021
8f530e0
Systematics can handle arbitrary number of populations
emilydolson Oct 6, 2021
c6ce913
Use constexpr if to get rid of gross code
emilydolson Oct 6, 2021
9d9148b
Fix template errors
emilydolson Oct 6, 2021
c703f69
Merge branch 'any_function' of github.com:FergusonAJ/Empirical into HEAD
FergusonAJ Oct 8, 2021
f01ddd8
Add VirtualCPU hardware
FergusonAJ Oct 8, 2021
730ffc1
Fix member initialization order
FergusonAJ Oct 8, 2021
8a661a6
Merge in master
emilydolson Oct 11, 2021
5ba6be8
Merge branch 'master' into mabe-systematics
emilydolson Oct 11, 2021
df71c38
Add better tests for systematics DataNodes
emilydolson Oct 11, 2021
31c589c
Fix delete bug in AnyFunction
FergusonAJ Oct 18, 2021
832f90a
Temp. add ids to instruction library
FergusonAJ Oct 18, 2021
dafb92e
Use inst. ids and add QoL to VirtualCPU
FergusonAJ Oct 18, 2021
982b271
Switch VirtualCPU to handle nops on birth/mut.
FergusonAJ Oct 19, 2021
334ee44
Fix bug of VirtualCPU instructions with wrong id
FergusonAJ Oct 19, 2021
c732578
Merge in changes to mabe devel
emilydolson Oct 21, 2021
7c2f355
Minor fixes to VirtualCPU instruction ids
FergusonAJ Nov 1, 2021
1a0d6b6
Add linear algebra classes to support path follow
FergusonAJ Nov 1, 2021
74d29cd
Dynamically create VCPU registers to match nops
FergusonAJ Nov 7, 2021
1141f0c
Add expanded nop support, labels, + new searches
FergusonAJ Nov 9, 2021
374a2f4
Add more VirtualCPU helper methods
FergusonAJ Nov 9, 2021
a9efc7d
Quote escape NONE ancestors list
Nov 12, 2021
0d42691
Patch index out of range in VirtualCPU::FindLabel
FergusonAJ Nov 16, 2021
db09a0a
Add missing include in VirtualCPU class
FergusonAJ Nov 22, 2021
f8b0f16
Start refactor of VirtualCPU
FergusonAJ Dec 7, 2021
947e001
Remove old AvidaGP error system from VirtualCPU
FergusonAJ Dec 9, 2021
0c847ca
Refactor and optimize CurateNops in VirtualCPU
FergusonAJ Dec 9, 2021
58457fc
Add checklist of VirtualCPU tests to write
FergusonAJ Dec 9, 2021
6d1baab
Clean CountNops and rename string funcs in VCPU
FergusonAJ Dec 14, 2021
d5f5bab
Refactor nop and label methods in VCPU
FergusonAJ Dec 14, 2021
12a688f
Add docstrings and other cleanups to VirtualCPU
FergusonAJ Dec 14, 2021
d9b5598
Update comments in VirtualCPU
FergusonAJ Dec 14, 2021
68215ab
Switch VirtualCPU to store NOP IDs in a set
FergusonAJ Dec 14, 2021
b9bc6d9
Take pass through first chunk of VirtualCPU tests
FergusonAJ Dec 14, 2021
d251253
Finish first pass of VirtualCPU tests
FergusonAJ Dec 14, 2021
aab8448
Rename method in VirtualCPU
FergusonAJ Jan 10, 2022
9df9742
Change comp. in unordered index map from < to <=
FergusonAJ Jan 10, 2022
9aea202
Merge remote-tracking branch 'charles/MABE_devel' into virtual_cpu_merge
FergusonAJ Jan 20, 2022
75b1605
Merge
emilydolson Jan 20, 2022
0c12188
Temp. fix the AvidaGP vs VCPU instruction issue
FergusonAJ Jan 21, 2022
9866f33
Adding Contributor count shield to readme
anyaevostinar Jan 24, 2022
9f6d1d7
Add minor tweaks to function TypeIDs
FergusonAJ Jan 24, 2022
1fe7f90
Merge pull request #464 from devosoft/anyaevostinar-readme-contributor
mmore500 Jan 25, 2022
a4b58bd
Track instructions executed in VCPU
FergusonAJ Feb 15, 2022
c632767
Add GetSharedAncestor
emilydolson Feb 21, 2022
e5efa81
Fix minor typo
FergusonAJ Mar 24, 2022
86ed514
Remove old linear algebra classes
FergusonAJ Mar 24, 2022
719cb68
Fix compiler warnings
FergusonAJ Mar 25, 2022
c0f4e68
Update VirtualCPU instructions to match MABE
FergusonAJ Mar 25, 2022
56e5c5c
Add stack accessor to VirtualCPU
FergusonAJ May 10, 2022
5ccc125
Clean VirtualCPUOrg_InstLib
FergusonAJ May 10, 2022
bf6411c
Add rough CombinedBinomialDistribution + example
FergusonAJ May 11, 2022
5b4bf98
Add example from last commit to Makefile
FergusonAJ May 11, 2022
a2164b0
Tweak CombinedBinomial to match other dists.
FergusonAJ May 11, 2022
c51ef5a
Add VCPU methods needed in MABE
FergusonAJ May 11, 2022
4198248
Patch bug in InstLib::GetID
FergusonAJ May 11, 2022
4d2e16e
Merge pull request #2 from devosoft/mabe-systematics
FergusonAJ May 11, 2022
7abd59e
Merge remote-tracking branch 'charles/MABE_devel' into virtual_cpu_merge
FergusonAJ May 18, 2022
eef25f1
Patch power of 2 bug in CombinedBinomial
FergusonAJ May 20, 2022
2ae781a
Update data/Datum test
FergusonAJ May 20, 2022
e619a91
Update EventDrivenGP to work with InstLib change
FergusonAJ May 20, 2022
46084f7
Update VirtualCPU tests
FergusonAJ May 20, 2022
e02ad94
Add missing include to Emscripten error trigger
FergusonAJ May 22, 2022
a633423
Reset distributions after Setup in Comb. Binomial
FergusonAJ May 24, 2022
594799f
Merge branch 'MABE_devel' of github.com:Mercere99/Empirical into virt…
FergusonAJ May 24, 2022
d78d135
Fix assert comparison in UnorderedIndexMap
FergusonAJ May 24, 2022
2eb8b55
Fix bound and add zero case to rand exp and geom
FergusonAJ May 24, 2022
1872701
Add docstrings to CombinedBinomialDistribution
FergusonAJ May 24, 2022
1d7957a
Bump to 20.04 and g++11
emilydolson May 24, 2022
37518ee
Fix indentation
emilydolson May 24, 2022
bd93b8d
Update DFA.hpp
emilydolson May 24, 2022
e497d63
Include limits
emilydolson May 24, 2022
c122b28
Try bumping to 22.04
emilydolson May 25, 2022
439f49a
Update other steps to g++ 11
emilydolson May 25, 2022
d975ed1
Update Catch version
emilydolson May 25, 2022
069425d
Update clang
emilydolson May 25, 2022
3b54f10
Restore DFA.hpp
emilydolson May 25, 2022
476ac80
Restore DFA.hpp
emilydolson May 25, 2022
88122d9
Update DFA.hpp
emilydolson May 25, 2022
de7aa3d
Update force-cover
emilydolson May 25, 2022
76d4682
xvfb needs Ubuntu 20.04?
emilydolson May 25, 2022
279a03d
Remove trailing whitespace
emilydolson May 25, 2022
efd4878
Update force cover for llvm 14
emilydolson May 25, 2022
bcdf742
Merge remote-tracking branch 'upstream/update-g++' into virtual_cpu_m…
FergusonAJ May 25, 2022
931c4a2
Update submodules per Emily's update-g++ branch
FergusonAJ May 25, 2022
300203c
Switch to Catch v2.13.9
FergusonAJ May 25, 2022
a73f0da
Update force-cover to newest version
FergusonAJ May 25, 2022
806a047
Conduct first pass on alphabetizing includes
FergusonAJ May 25, 2022
545f124
Match boilerplate to appease tidy checks
FergusonAJ May 25, 2022
e94617a
Fix newlines at end of files
FergusonAJ May 25, 2022
e2431e9
Add missing license notices
FergusonAJ May 25, 2022
1b3b79e
Remove tabs and fix whitespace
FergusonAJ May 25, 2022
5f49154
Remove trailing whitespace
FergusonAJ May 25, 2022
ec9cd09
Clean up comments in VirtualCPU.Load
FergusonAJ May 25, 2022
069d895
Remove trailing whitespace from VirtualCPU
FergusonAJ May 25, 2022
b3f6744
Ensure nops work in VCPU regardless of inst order
FergusonAJ May 25, 2022
d1619ac
Add constant for VCPU maximum nop insts. in lib.
FergusonAJ May 25, 2022
fd23917
Fix missing flag reset in VirtualCPU
FergusonAJ Jun 20, 2022
a943b5b
Rework reset methods in VirtualCPU
FergusonAJ Jun 28, 2022
7e1a308
Remove trailing whitespace
FergusonAJ Jun 28, 2022
d227523
Fix spacing in VirtualCPU
FergusonAJ Jun 28, 2022
b0279e4
Remove virtual from VirtualCPU::ResetHardware
FergusonAJ Jun 29, 2022
c255c9d
Make more VirtualCPU methods const
FergusonAJ Jun 30, 2022
6cdc08d
Add GetNumInstsCopied method to VirtualCPU
FergusonAJ Jun 30, 2022
78306cf
Switch VCPU inst methods from using index to ID
FergusonAJ Jul 4, 2022
399535c
Track insts. copied and executed in VirtualCPU
FergusonAJ Jul 6, 2022
b4b2024
Check if file exists while loading VCPU genome
FergusonAJ Jul 7, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 19 additions & 23 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
jobs:
tidy:
name: Enforce Tidyness
runs-on: ubuntu-18.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
with:
Expand All @@ -31,7 +31,7 @@ jobs:
- run: ./ci/test_tidy.sh
test:
name: Tests
runs-on: ubuntu-18.04
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
Expand All @@ -50,11 +50,14 @@ jobs:
- uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: Set up GCC
uses: egor-tensin/setup-gcc@v1
with:
version: 11
- run: sudo apt-get update -qq
- run: sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
- run: sudo apt-get update -qq
- run: sudo apt-get install -qq g++-8 cmake build-essential python3-pip python3-virtualenv nodejs tar gzip libpthread-stubs0-dev libc6-dbg gdb
- run: sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-8 90
- run: sudo apt-get install -qq cmake build-essential python3-pip python3-virtualenv nodejs tar gzip libpthread-stubs0-dev libc6-dbg gdb
- run: git fetch origin master:refs/remotes/origin/master
- run: make install-test-dependencies
- run: ${CXX} --version
Expand All @@ -63,46 +66,39 @@ jobs:
make ${TEST_SET} CXX=${CXX}
test-web:
name: Web Tests
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: Set up GCC
uses: egor-tensin/setup-gcc@v1
with:
version: 11
- run: sudo apt-get update -qq
- run: sudo apt-get install -qq g++-8 cmake build-essential python3-pip python3-virtualenv nodejs tar gzip libpthread-stubs0-dev libc6-dbg gdb
- run: sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-8 90
- run: sudo apt-get install -qq cmake build-essential python3-pip python3-virtualenv nodejs tar gzip libpthread-stubs0-dev libc6-dbg gdb
- run: make install-test-dependencies
- name: Run headless test
uses: GabrielBB/xvfb-action@v1
with:
run: make test-web
test-coverage:
name: Measure Test Coverage
runs-on: ubuntu-18.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
with:
submodules: 'recursive'
- run: sudo apt-get update -qq
- run: sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
- run: wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
- run: sudo apt-add-repository "deb https://apt.llvm.org/xenial/ llvm-toolchain-xenial-7 main"
- run: sudo apt-get update -qq
- run: sudo apt-get install -qq g++-8
- run: sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-8 90
- run: sudo apt-get install cmake build-essential python3-virtualenv python3-pip nodejs tar gzip libclang-7-dev llvm llvm-dev libllvm7 llvm-7 llvm-7-dev clang-7 libstdc++-7-dev # might have to happen after we update g++
- run: sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-7 90
- run: sudo update-alternatives --install /usr/bin/llvm-config llvm-config /usr/bin/llvm-config-7 90
- run: sudo update-alternatives --install /usr/bin/llvm-profdata llvm-profdata /usr/bin/llvm-profdata-7 90
- run: sudo update-alternatives --install /usr/bin/llvm-cov llvm-cov /usr/bin/llvm-cov-7 90
- run: sudo apt-get install cmake build-essential python3-virtualenv python3-pip nodejs tar gzip clang llvm-dev libclang-dev
- run: git fetch origin master:refs/remotes/origin/master
- run: make install-test-dependencies
- run: export CXX=clang++-7 && make install-coverage-dependencies
- run: export CXX=clang++-7 && make coverage
- run: export CXX=clang++ && make install-coverage-dependencies
- run: export CXX=clang++ && make coverage
- run: curl -s https://codecov.io/bash | bash
test-documentation:
name: Test Documentation Build
runs-on: ubuntu-18.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
with:
Expand All @@ -119,7 +115,7 @@ jobs:
dst: stats/doc-coverage.json
deploy-dockerhub:
name: Deploy to DockerHub
runs-on: ubuntu-18.04
runs-on: ubuntu-22.04
if: github.ref == 'refs/heads/master'
needs:
- tidy
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ namespace, so it is simple to incorporate into existing projects.
[![CI](https://github.com/devosoft/Empirical/workflows/CI/badge.svg)](https://github.com/devosoft/Empirical/actions?query=workflow%3ACI+branch%3Amaster) [![Documentation Status](https://readthedocs.org/projects/empirical/badge/?version=latest)](https://empirical.readthedocs.io/en/latest/?badge=latest) [![DOI](https://zenodo.org/badge/24824563.svg)](https://zenodo.org/badge/latestdoi/24824563) [![codecov](https://codecov.io/gh/devosoft/Empirical/branch/master/graph/badge.svg)](https://codecov.io/gh/devosoft/Empirical)
[![DockerHub](https://img.shields.io/badge/DockerHub-Hosted-blue)](https://hub.docker.com/r/devosoft/empirical)
![Documentation Coverage](https://img.shields.io/endpoint?url=https%3A%2F%2Fraw.githubusercontent.com%2Fdevosoft%2FEmpirical%2Fgh-storage%2Fstats%2Fdoc-coverage.json)
[![GitHub contributors](https://img.shields.io/github/contributors/devosoft/Empirical.svg?style=flat-square)](https://github.com/devosoft/Empirical/graphs/contributors)


See our [Built With Empirical Gallery](https://empirical.readthedocs.io/en/latest/BuiltWithEmpiricalGallery) for examples of web tools built with Empirical.

Expand Down
2 changes: 1 addition & 1 deletion doc/blogs/Binomial.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ before introducing the next bug?

A **Poisson Distribution** is a continuous version of a Binomial Distribution, used for measuring
the number of independent events that occur in a time period rather than during a specified
number of events.
number of events.
30 changes: 30 additions & 0 deletions doc/library/Evolve/evolve.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Evolution tools

## World

```{eval-rst}
.. doxygenfile:: emp/Evolve/World.hpp
:project: Empirical
:no-link:
```

## Systematics

```{ref} systematics
```

## NK

```{eval-rst}
.. doxygenfile:: emp/Evolve/NK.hpp
:project: Empirical
:no-link:
```

## Selection

```{eval-rst}
.. doxygenfile:: emp/Evolve/World_select.hpp
:project: Empirical
:no-link:
```
195 changes: 195 additions & 0 deletions doc/library/Evolve/systematics.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,195 @@
.. SystematicsDocumentation documentation master file, created by
sphinx-quickstart on Thu May 28 16:40:07 2020.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.


Documentation for Systematics
====================================================

.. toctree::
:maxdepth: 2
:caption: Contents:

modules

Systematics
===========

Systematics is a classification of organisms based on evolutionary (phylogenetic) relationships.

***************
Systematics.h
***************

This file is part of Empirical and is located in ``Empirical/source/Evolve/Systematics.h``

The systematics manager is used to track genotypes, species, clades, or lineages of organisms in a world.

Systematics allows a user to generate data to form phylogenetic trees.

The program can be run with different levels of abstraction, meaning the data can be generated by position,
phenotype, or even genotype if you have a lot of RAM.

**Note**: You are responsible for filling in templates! Adding the template just gives you a place to store your data.

Taxon Specifics
===============

* Taxon - a group of species with similar characteristics
* Genotypes are the most commonly used Taxon

A user can see the type and number of mutations that ocurred to bring about a taxon.

Some information that can be accessed is:

* taxon ID# ``GetID()``
* details of organisms in the taxon ``GetInfo()``
* pointer to the parent group (will return a null pointer if the species was injected) ``GetParent()``
* how many organisms currently exist in the group and how many total organisms have ever existed in the group ``GetNumOrgs()`` or ``GetTotOrgs()``
* how many direct offspring groups exist from this group and how many total extant offspring that exist from this taxa ``GetTotalOffspring()``
* how deep in the tree the node you are examining is ``GetDepth()``
* when did this taxon first appear in the population ``GetOriginationTime()``
* when did the taxon leave the population ``GetDestructionTime()``

New organisms are added to the taxon using ``AddOrg()``.
New offspring are added to the taxon with ``AddOffspring()`` .

Organisms are removed with ``RemoveOrg()``.
Offspring are removed with ``RemoveOffspring()`` .

If there are no more remaining organisms or offspring the taxon will deactivate.


General Systematics Data
=========================

Things that systematics can tell you about a phylogeny and how to access them:

* Are we tracking a synchronous population? ``GetTrackSynchronous()`` ``SetTrackSynchronous()``
* Are we storing all taxa that are still alive in the population? ``GetStoreActive()`` ``SetStoreActive()``
* Are we storing all taxa that are ancestors of the living organisms in the population? ``GetStoreAncestors()`` ``SetStoreAncestors()``
* Are we storing all taxa that have died out, as have all of their descendants? ``GetStoreOutside()`` ``SetStoreOutside()``
* Are we storing any taxa types that have died out? ``GetArchive()`` ``SetArchive()``
* Are we storing the positions of taxa? ``GetStorePosition()`` ``SetStorePosition()``
* How many living organisms are currently being tracked? ``GetTotalOrgs()``
* How many independent trees are being tracked? ``GetNumRoots()``
* What ID will the next taxon have? ``GetNextID()``
* What is the average phylogenetic depth of organisms in the population? ``GetAveDepth()``
* To find the most recent common ancestor (MRCA) use ``GetMRCA()`` or ``GetMRCADepth()`` to find the distance to the MRCA.

**The systematics class tracks the relationships among all organisms bases on the INFO_TYPE
provided. If an offspring has the same value for INFO_TYPE as its parent, it is grouped into
the same taxon. Otherwise a new Taxon is created and the old one is used as its parent in
the phylogeny. If the provided INFO_TYPE is the organism's genome, a traditional phylogeny
is formed, with genotypes. If the organism's behavior/task set is used, then organisms are
grouped by phenotypes. If the organism's position is used, the evolutionary path through
space is tracked. Any other aspect of organisms can be tracked this way as well.**


**Generally, all living organisms' taxa should be tracked and ancestral organisms' taxa should be maintained for lineage.
However, not all dead taxa should be maintained, it gets too big.**

***************************
Diversity and Distinction
***************************

Systematics.h can also be used to find phylogenetic diversity for all extant taxa in the tree,
assuming all edges from parent to child have a length of one.

When all branch lengths are equal, the phylogenetic diversity is the number of internal nodes plus the number of
extant taxa minus 1.

You can also find how distinct a specific taxa is from the rest of the population
based on the amount of unique evolutionary history that it represents.

*****************************
Synchronous Populations
*****************************

A synchronous population is a population in which each generation is a discrete time point
and a completely new set of individual organisms is created for each generation. This means that
an organism and its parent can never exist at the same time.

An asynchronous population is the opposite, where generations overlap and organisms reproduce
when they are ready.

In the systematics manager, synchronicity is controlled with

``GetTrackSynchronous()`` which returns true or false and
``SetTrackSynchronous(input true or false)`` which allows you to use a synchronous or asynchronous population.


Using the Systematics Manager
==============================

The systematics.h file alone will not give you any useful information. You must use a test file in conjunction with the systematics manager
in order to see output.

To retrieve some results we will use the file Systematics.cc
which is located in Empirical/tests/Evolve/Systematics.cc.

To compile to code use this command in the tests directory::

make test-Systematics


**********
Output
**********

Terminal Output::

AddOrg 25 (id1, no parent)

AddOrg -10 (id2; parent id1)

AddOrg 26 (id3, parent id1)

AddOrg 27 (id4, parent id2)

The first line of output shows the first organism in the examined phylogeny. This organism is added with AddOrg
and is assigned an ID of id1. The organism has no parent, as seen in the farthest column of output, meaning that
organism id1 will be the root of the phylogeny and produce offspring.

If we then look at the first number is parenthesis, we see the second organism with and ID of id2. Id2 is a direct descendant of the id1 organism.

Lastly, if we look at id4, we see that its parent is id2, meaning that we have created another node in the tree
as the organisms move through generations, producing new offspring.

The terminal output should also include this section::

Active count: 11 [18|1,0|17] [17|1,2|11] [15|1,0|null] [12|1,1|11] [16|1,0|11] [11|1,3|null] [6|1,0|5] [19|1,0|17] [5|1,1|null] [4|1,0|null] [3|1,0|null]


The 11 at the front refers to the number of total taxa in the phylogeny.

If we look at the first set of numbers: ``[18|1, 0|17]``

The first number in brackets, 18 in this case, is the taxon of the organism where
a mutation occurred. 1, the next number, is the number of mutations that led to this branch.
0 is the number of offspring from this organism. Lastly, 17 is the id of the parent organism.

As for the second set ``[17|1, 2|11]`` -- this is taxon 17, one mutation occurred,
id17 had 2 offspring, and its parent is id11.

The last portion of the output has several lines of 3 numbers.

It should look like this: ::

1 : 0 : -1
2 : 0 : -1
3 : 0 : 0
4 : 0 : 0
5 : 0 : 0
6 : 0 : 0
7 : 0 : 0
8 : 0 : 987
9 : 0 : 986
10 : 0 : 987
11 : 0 : 988
12 : 0 : 987
13 : 0 : 988

The first number is the organism number. The second number is the position of the organism.
The third number is the fitness of the organism at position 0.
1 change: 1 addition & 0 deletions doc/library/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ compiler/compiler
data/data
datastructs/datastructs
debug/debug
Evolve/evolve
functional/functional
io/io
math/math
Expand Down
35 changes: 35 additions & 0 deletions examples/math/CombinedBinomialDistribution.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/**
* @note This file is part of Empirical, https://github.com/devosoft/Empirical
* @copyright Copyright (C) Michigan State University, MIT Software license; see doc/LICENSE.md
* @date 2022-2022
*
* @file CombinedBinomialDistribution.cpp
* @brief Some examples code for using emp::CombinedBinomialDistribution
*/


#include "emp/math/CombinedBinomialDistribution.hpp"
#include "emp/math/Random.hpp"

int main(int argc, char* argv[])
{
if(argc != 4){
std::cout << "Error! Expecting exactly three command line arguments: "
<< "p n num_trials" << std::endl;
emp_assert(false);
}
double p = std::stod(argv[1]);
size_t n = std::stoi(argv[2]);
size_t num_trials = std::stoi(argv[3]);

emp::Random random;
emp::CombinedBinomialDistribution distribution(p, 1);

double mean = 0;

for(size_t i = 0; i < num_trials; i++){
mean += (double)distribution.PickRandom(n, random) / num_trials;
}
std::cout << "Mean after " << num_trials << " trials: " << mean << std::endl;
return 0;
}
2 changes: 1 addition & 1 deletion examples/math/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ CFLAGS_web_debug := $(CFLAGS_all) $(OFLAGS_web_debug) --js-library ../../include
CFLAGS_web_opt := $(CFLAGS_all) $(OFLAGS_web_opt) --js-library ../../include/emp/web/library_emp.js -s EXPORTED_FUNCTIONS="['_main', '_empCppCallback']" -s NO_EXIT_RUNTIME=1
#CFLAGS_web := $(CFLAGS_all) $(OFLAGS_web) --js-library ../../include/emp/web/library_emp.js -s EXPORTED_FUNCTIONS="['_main', '_empCppCallback']" -s DISABLE_EXCEPTION_CATCHING=1 -s NO_EXIT_RUNTIME=1

TARGETS := combos constants Distribution info_theory math Random Range stats
TARGETS := combos constants Distribution info_theory math Random Range stats CombinedBinomialDistribution

default: native

Expand Down
Loading