{"id":17141509,"url":"https://github.com/iskandr/genepool","last_synced_at":"2025-04-13T10:20:25.255Z","repository":{"id":1474889,"uuid":"1717354","full_name":"iskandr/genepool","owner":"iskandr","description":"Framework for writing evolutionary optimization algorithms in OCaml","archived":false,"fork":false,"pushed_at":"2013-09-19T21:11:49.000Z","size":99,"stargazers_count":11,"open_issues_count":1,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-27T01:46:36.183Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://www.rubinsteyn.com/genepool/","language":"OCaml","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/iskandr.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}},"created_at":"2011-05-08T01:21:16.000Z","updated_at":"2022-09-13T16:06:10.000Z","dependencies_parsed_at":"2022-07-29T18:39:39.549Z","dependency_job_id":null,"html_url":"https://github.com/iskandr/genepool","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iskandr%2Fgenepool","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iskandr%2Fgenepool/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iskandr%2Fgenepool/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iskandr%2Fgenepool/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iskandr","download_url":"https://codeload.github.com/iskandr/genepool/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248696053,"owners_count":21147060,"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":[],"created_at":"2024-10-14T20:25:36.194Z","updated_at":"2025-04-13T10:20:25.226Z","avatar_url":"https://github.com/iskandr.png","language":"OCaml","funding_links":[],"categories":[],"sub_categories":[],"readme":"GenePool is a framework for writing evolutionary optimization algorithms in OCaml. This library is not a complete solution but rather is a generic skeleton which takes care of the plumbing and nuisances of optimization. You provide GenePool with functions that give meaning to fitness and reproduction and after a specified number of generation, GenePool returns an array of the best \"genomes\" it evolved. \n\nThe interface to GenePool is extremely simple. It consists of a single function evolve whose type is:\n```ocaml\n    ('genome, 'fitness) ga_spec -\u003e ga_params -\u003e 'genome array * 'fitness\n```\nAs you can tell from the signature, GenePool is polymorphic over both the representation of the genome and the type of fitness values. Typically your genome will be an array and fitness will be expressed as either an int or float. However, nothing stops you from using different types if your problem requires them.\nThe first parameter is a record (of type ga_spec) which encodes how evolution will proceed for your specific problem.\n\n```ocaml\n(*\n\tGA Specification\n\t-----------------------------------------------------------------------\n\t\tevaluate  - assign a fitness to a genome\n\t\tmutatate  - given a genome, create an altered copy\n\t\tcrossover - given two genomes, combine them\n\t\tgenRandom - produce a random genome from scratch\n\t\tseed      - optional initial seed population\n\t\treport    - optional function to output information \n\t\t            about the best genome of each generation \n\t\tstop      - optional stopping predicate\n*)\n\ntype ('genome, 'fitness) ga_spec = {\n  evaluate : 'genome -\u003e 'fitness;\n  mutate : 'genome -\u003e 'genome;\n  crossover : 'genome * 'genome -\u003e 'genome;\n  genRandom: unit -\u003e 'genome;\n  seed: 'genome array option;\n  report: (int -\u003e 'genome -\u003e 'fitness -\u003e unit) option;\n  stop: (int \u003e 'genome -\u003e 'fitness -\u003e bool) option\n}\n```\n\nSome parameters (ie, the maximum number of generations, the number of genomes which survive each generations, etc...) are universal across all optimization algorithms. These are provided in another record, whose type is ga_params.\n\n\n```ocaml \n(*\n\tGA Parameters\n\t--------------------------------------------------------------------\n\tnRandom - how many random genomes should we generate at the beginning\n\tnSurvivors - how many genomes survive of each generation \n\tnMutations - # genomes generated by asexual reproduction each generation\n\tnCrossovers - # genomes by sexual reproduction each generation \n\ttimeLimit - seconds until algorithm termination \n\tmaxGen - maximum number of generations until algorithm termination \n*)\n\ntype ga_params = {\n  nRandom: int;\n  nSurvivors: int;\n  nMutations: int;\n  nCrossovers: int;\n  timeLimit:float;\n  maxGen: int\n}\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiskandr%2Fgenepool","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiskandr%2Fgenepool","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiskandr%2Fgenepool/lists"}