{ "info": { "author": "Lambda Life", "author_email": "lambdalife@henrywoody.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "

Holland

\n

Genetic Algorithm Library for Python

\n\n> Computer programs that \"evolve\" in ways that resemble natural selection can solve complex problems even their creators do not fully understand\n\n\n\n
\n PyPI\n Build\n\tCoverage\n Documentation Status\n \"License:\n
\n\n\n\n### Description\n\nHolland is a simple, flexible package for implementing the Genetic Algorithm in Python. The program is designed to act on an arbitrary evaluation function with arbitrary encoding of individuals within a population, both of which are provided by the user.\n\n### Installing\n\nHolland is available via the [Python Package Index (PyPI)](https://pypi.org/project/holland/) and can be installed with:\n\n```shell\npip install holland\n```\n\n### Usage\n\n[Full Documentation](https://hollandpy.readthedocs.io/en/latest/)\n\n**Hello World!**\n\n```python\nfrom holland import Evolver\nfrom holland.library import get_uniform_crossover_function\nfrom holland.utils import bound_value\nimport random\n\n\n# Define a fitness function\ndef fitness_function(genome):\n message = genome[\"message\"]\n target = \"Hello World!\"\n score = 0\n for i in range(len(message)):\n score += abs(ord(target[i]) - ord(message[i]))\n return score\n\ndef mutation_function(value):\n mutated_value = ord(value) * random.random() * 2\n return chr(bound_value(mutated_value, minimum=32, maximum=126, to_int=True))\n\n# Define genome parameters for individuals\ngenome_params = {\n \"message\": {\n \"type\": \"[str]\",\n \"size\": len(\"Hello World!\"),\n \"initial_distribution\": lambda: chr(random.randint(32, 126)),\n \"crossover_function\": get_uniform_crossover_function(),\n \"mutation_function\": mutation_function,\n \"mutation_rate\": 0.15\n }\n}\n\n# Define how to select individuals for reproduction\nselection_strategy = {\"pool\": {\"top\": 10}}\n\n# Run Evolution\nevolver = Evolver(\n fitness_function,\n genome_params,\n selection_strategy,\n should_maximize_fitness=False\n)\nfinal_population = evolver.evolve(stop_conditions={\"target_fitness\": 0})\n```\n\nWith sample run:\n\n> Generation: 0; Top Score: 201:     N~flx.JGcu-*\n>\n> Generation: 1; Top Score: 98:       Xljlw);mj]f \n>\n> Generation: 2; Top Score: 64:       =c}kk SmsYf \n>\n> Generation: 3; Top Score: 37:       Kcjlk$Vms]f \n>\n> Generation: 4; Top Score: 24:       Cdjkn Smshf \n>\n> Generation: 5; Top Score: 16:       Idjln Vmshf \n>\n> Generation: 6; Top Score: 14:       Idjln Voshf \n>\n> Generation: 7; Top Score: 11:       Hdjln Vmslf \n>\n> Generation: 8; Top Score: 9:         Hdjln Voslf \n>\n> Generation: 9; Top Score: 8:         Hdjln Vosle \n>\n> Generation: 10; Top Score: 7:       Hdmln Vosle \n>\n> Generation: 11; Top Score: 6:       Hdlln Vosle \n>\n> Generation: 12; Top Score: 5:       Hdllo Vosle \n>\n> Generation: 13; Top Score: 4:       Hdllo Vosle!\n>\n> Generation: 14; Top Score: 3:       Hello Vosle!\n>\n> Generation: 15; Top Score: 2:       Hello Wosle!\n>\n> Generation: 16; Top Score: 2:       Hello Wosle!\n>\n> Generation: 17; Top Score: 1:       Hello Worle!\n>\n> Generation: 18; Top Score: 1:       Hello Worle!\n>\n> Generation: 19; Top Score: 1:       Hello Worle!\n>\n> Generation: 20; Top Score: 0:       Hello World!\n\nBest Genome:\n\n```python\n{\n 'message': ['H', 'e', 'l', 'l', 'o', ' ', 'W', 'o', 'r', 'l', 'd', '!']\n}\n```\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/lambdalife/holland", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "holland", "package_url": "https://pypi.org/project/holland/", "platform": "", "project_url": "https://pypi.org/project/holland/", "project_urls": { "Homepage": "https://github.com/lambdalife/holland" }, "release_url": "https://pypi.org/project/holland/0.0.2/", "requires_dist": null, "requires_python": "", "summary": "Genetic Algorithm Library", "version": "0.0.2" }, "last_serial": 4372727, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "ec00d6639ffc580905053a8839d8dcb4", "sha256": "3058e931ce9ca0d682a2236e01c135c89db5616b3af61c4be965f1494c0d214a" }, "downloads": -1, "filename": "holland-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "ec00d6639ffc580905053a8839d8dcb4", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 43081, "upload_time": "2018-10-13T01:02:05", "url": "https://files.pythonhosted.org/packages/14/8e/5062e76f2af900321840370a27f6aacc2788d94604b3652cbcab2d7d5697/holland-0.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "da3862e74ba92dda42ee08dda8720e78", "sha256": "50b2d485e2bd09e0568b5727fd3668c3b35b0ac8ccd4592aa09e8e445a71cc56" }, "downloads": -1, "filename": "holland-0.0.1.tar.gz", "has_sig": false, "md5_digest": "da3862e74ba92dda42ee08dda8720e78", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 30882, "upload_time": "2018-10-13T01:02:06", "url": "https://files.pythonhosted.org/packages/f2/72/adf4c63e5327f17f1623ae05f5862594b08af32100d5a80c503e0c283c40/holland-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "eab79f94d6c3513db5215e4165880460", "sha256": "5d162a58f247a403ac022e8a6098713d6787ee48cb56f9ce358075e2c46bfd63" }, "downloads": -1, "filename": "holland-0.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "eab79f94d6c3513db5215e4165880460", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 44247, "upload_time": "2018-10-13T20:22:05", "url": "https://files.pythonhosted.org/packages/08/9b/904dee2038b3cf7f1cef38e448ac48b736e944a3fa6c22f2f78252f9e959/holland-0.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "54506acdfe530a167cd28535ef33f556", "sha256": "b043e4c11801cb6dd27795abe225ddf40bd378c761d663d63bfbc73e2f7d4942" }, "downloads": -1, "filename": "holland-0.0.2.tar.gz", "has_sig": false, "md5_digest": "54506acdfe530a167cd28535ef33f556", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 32025, "upload_time": "2018-10-13T20:22:06", "url": "https://files.pythonhosted.org/packages/c5/2a/c8e43a1b4a269857ad3b042c3ae71312c3a07cf775df71d5c77275b2277a/holland-0.0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "eab79f94d6c3513db5215e4165880460", "sha256": "5d162a58f247a403ac022e8a6098713d6787ee48cb56f9ce358075e2c46bfd63" }, "downloads": -1, "filename": "holland-0.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "eab79f94d6c3513db5215e4165880460", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 44247, "upload_time": "2018-10-13T20:22:05", "url": "https://files.pythonhosted.org/packages/08/9b/904dee2038b3cf7f1cef38e448ac48b736e944a3fa6c22f2f78252f9e959/holland-0.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "54506acdfe530a167cd28535ef33f556", "sha256": "b043e4c11801cb6dd27795abe225ddf40bd378c761d663d63bfbc73e2f7d4942" }, "downloads": -1, "filename": "holland-0.0.2.tar.gz", "has_sig": false, "md5_digest": "54506acdfe530a167cd28535ef33f556", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 32025, "upload_time": "2018-10-13T20:22:06", "url": "https://files.pythonhosted.org/packages/c5/2a/c8e43a1b4a269857ad3b042c3ae71312c3a07cf775df71d5c77275b2277a/holland-0.0.2.tar.gz" } ] }