{"id":22624596,"url":"https://github.com/barrettotte/population-genetics-sim","last_synced_at":"2025-03-29T03:16:41.229Z","repository":{"id":114090991,"uuid":"153957029","full_name":"barrettotte/Population-Genetics-Sim","owner":"barrettotte","description":"Simulate basic population genetics on fake creatures' DNA. Concepts of mutation, crossover, fitness distribution covered. Prototype algorithm for ProcJam 2018","archived":false,"fork":false,"pushed_at":"2018-10-28T18:27:19.000Z","size":97,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-03T13:13:13.001Z","etag":null,"topics":["genetic-analysis","genetics","population-genetics","python","simulation"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/barrettotte.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2018-10-20T23:24:59.000Z","updated_at":"2020-07-31T16:30:31.000Z","dependencies_parsed_at":"2023-06-12T14:00:25.219Z","dependency_job_id":null,"html_url":"https://github.com/barrettotte/Population-Genetics-Sim","commit_stats":{"total_commits":8,"total_committers":1,"mean_commits":8.0,"dds":0.0,"last_synced_commit":"6459d19953ca62b56b9d39a9edba260306e120ae"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barrettotte%2FPopulation-Genetics-Sim","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barrettotte%2FPopulation-Genetics-Sim/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barrettotte%2FPopulation-Genetics-Sim/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barrettotte%2FPopulation-Genetics-Sim/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/barrettotte","download_url":"https://codeload.github.com/barrettotte/Population-Genetics-Sim/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246131335,"owners_count":20728303,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["genetic-analysis","genetics","population-genetics","python","simulation"],"created_at":"2024-12-09T00:16:59.278Z","updated_at":"2025-03-29T03:16:41.200Z","avatar_url":"https://github.com/barrettotte.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Population Genetics\nSimulate basic population genetics on fake creatures' DNA. Concepts of mutation, crossover, fitness distribution covered\n\nUsed for ProcJam 2018, repo located here https://github.com/barrettotte/ProcJam-2018\n\n\n## Process\n* **Initialize** - Population N random DNA\n* **Selection** - Evaluate fitness, generate mating pool\n* **Reproduction** - Repeat N times, pick parents based on \"weighted random\" of mating rate\n* **Crossover** - Combine DNA through some crossover method\n* **Mutation** - Mutate child based on mutation rate\n* Add child to new generation\n* Discard old population\n* Repeat until ideal organism within ideal error is found\n\n### Additional Process\n* A percentage of \"Top\" fitness organisms will asexually reproduce to keep their ideal DNA in the mating pool.\n* There is a small chance a random organism will asexually reproduce\n* There is a small chance that Parent 1 will not pass any DNA and will be replaced by newly generated DNA.\n* An \"Ideal Error\" was introduced to speed up the algorithm's execution time, since it always got close, but sometimes never made a fitness value of 0.\n\n## Summary\n* This script will simulate a generation of \"creatures\" generation after generation until the ideal color allele is found.\n* Each creature has one allele in their \"DNA\" for color and is passed to offspring based on fundamentals of genetics (crossover, mutation). \n* Depending on how close the creature's color allele is to the ideal allele, it is given a fitness value which affects its chances of reproducing with another creature.\n* This is meant to be a prototype before ProcJam 2018 to work out any janky behavior before implementing in C# and Unity.\n\n## Sources:\n* Basics of bitwise crossover/mutation http://www.obitko.com/tutorials/genetic-algorithms/crossover-mutation.php\n* Noun and Adjective Lists https://github.com/aaronbassett/Pass-phrase\n\n\n## Results\n```\nSearching for Ideal DNA: {'color': ['00000000', '11111111', '00000000']}\nParameters: \n   Generation Size: 1000\n   Mutation Chance: 0.006\n   Mystery DNA Chance: 0.001\n   Asexual Reproduction Chance: 0.001\n   Top Organisms Asexually Reproduce: 0.001\n   Fitness Weights: [1, 2, 4, 6, 8]\n   Ideal Organism Allowable Error: 5\n\n\nResults of Test 01: \n   The Ideal Organism Found: ID: 00061-00194, Name: determined detail, Fitness: 5\n   DNA: {'color': ['00000010', '11111110', '00000010']}\n   Total Generations Created: 61\n   Total Organisms Created:   61000\n   Executed for 1.662 seconds\n\n\nResults of Test 02: \n   The Ideal Organism Found: ID: 00019-00160, Name: subdued friction, Fitness: 5\n   DNA: {'color': ['00000001', '11111100', '00000001']}\n   Total Generations Created: 19\n   Total Organisms Created:   19000\n   Executed for 0.522 seconds\n\n\nResults of Test 03: \n   The Ideal Organism Found: ID: 00123-00461, Name: jagged growth, Fitness: 5\n   DNA: {'color': ['00000000', '11111100', '00000010']}\n   Total Generations Created: 123\n   Total Organisms Created:   123000\n   Executed for 3.438 seconds\n\n\nResults of Test 04: \n   The Ideal Organism Found: ID: 00085-00707, Name: knowledgeable collar, Fitness: 5\n   DNA: {'color': ['00000001', '11111011', '00000000']}\n   Total Generations Created: 85\n   Total Organisms Created:   85000\n   Executed for 2.381 seconds\n\n\nResults of Test 05: \n   The Ideal Organism Found: ID: 00030-00794, Name: festive agreement, Fitness: 4\n   DNA: {'color': ['00000001', '11111110', '00000010']}\n   Total Generations Created: 30\n   Total Organisms Created:   30000\n   Executed for 0.835 seconds\n\n\nResults of Test 06: \n   The Ideal Organism Found: ID: 00147-00003, Name: auspicious burn, Fitness: 5\n   DNA: {'color': ['00000001', '11111111', '00000100']}\n   Total Generations Created: 147\n   Total Organisms Created:   147000\n   Executed for 4.258 seconds\n\n\nResults of Test 07: \n   The Ideal Organism Found: ID: 00247-00272, Name: snotty number, Fitness: 5\n   DNA: {'color': ['00000001', '11111100', '00000001']}\n   Total Generations Created: 247\n   Total Organisms Created:   247000\n   Executed for 6.816 seconds\n\n\nResults of Test 08: \n   The Ideal Organism Found: ID: 00088-00328, Name: cuddly spark, Fitness: 2\n   DNA: {'color': ['00000000', '11111110', '00000001']}\n   Total Generations Created: 88\n   Total Organisms Created:   88000\n   Executed for 2.443 seconds\n\n\nResults of Test 09: \n   The Ideal Organism Found: ID: 00090-00693, Name: frightened brass, Fitness: 2\n   DNA: {'color': ['00000000', '11111101', '00000000']}\n   Total Generations Created: 90\n   Total Organisms Created:   90000\n   Executed for 2.547 seconds\n\n\nResults of Test 10: \n   The Ideal Organism Found: ID: 00001-00021, Name: macabre government, Fitness: 3\n   DNA: {'color': ['00000000', '11111111', '00000011']}\n   Total Generations Created: 1\n   Total Organisms Created:   1000\n   Executed for 0.042 seconds\n\n\nRan Simulation 10 Time(s).\n   Average Error - 4.1\n   Average Execution Time - 2.494\n   Average Generated Generations - 90.1\n   Average Generated Organisms - 89100.0\n\n```\n## Console Raw\n![https://github.com/barrettotte/Population-Genetics-Sim/blob/master/consoleRaw.PNG](https://github.com/barrettotte/Population-Genetics-Sim/blob/master/consoleRaw.PNG)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbarrettotte%2Fpopulation-genetics-sim","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbarrettotte%2Fpopulation-genetics-sim","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbarrettotte%2Fpopulation-genetics-sim/lists"}