{"id":19021433,"url":"https://github.com/timerertim/knevo","last_synced_at":"2025-09-16T20:29:05.921Z","repository":{"id":45880202,"uuid":"397821155","full_name":"TimerErTim/Knevo","owner":"TimerErTim","description":"Knevo is a neuroevolution library for Java and Kotlin written purely in Kotlin, featuring multiple neuroevolution algorithms, serialization and multi-threading.","archived":false,"fork":false,"pushed_at":"2022-03-07T12:36:23.000Z","size":311,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-08-31T00:52:17.395Z","etag":null,"topics":["jvm","machine-learning","neural-network","neuroevolution"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TimerErTim.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-08-19T04:58:11.000Z","updated_at":"2024-07-16T09:03:43.000Z","dependencies_parsed_at":"2022-09-11T07:00:17.292Z","dependency_job_id":null,"html_url":"https://github.com/TimerErTim/Knevo","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/TimerErTim/Knevo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimerErTim%2FKnevo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimerErTim%2FKnevo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimerErTim%2FKnevo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimerErTim%2FKnevo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TimerErTim","download_url":"https://codeload.github.com/TimerErTim/Knevo/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimerErTim%2FKnevo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273953488,"owners_count":25197316,"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","status":"online","status_checked_at":"2025-09-06T02:00:13.247Z","response_time":2576,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["jvm","machine-learning","neural-network","neuroevolution"],"created_at":"2024-11-08T20:21:48.826Z","updated_at":"2025-09-16T20:29:00.861Z","avatar_url":"https://github.com/TimerErTim.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Knevo\n\n[\n![license: MIT](https://img.shields.io/github/license/TimerErTim/Knevo?color=blue\u0026style=flat-square)\n](https://github.com/TimerErTim/Knevo/blob/master/LICENSE)\n[\n![GitHub Workflow Status](\nhttps://img.shields.io/github/workflow/status/TimerErTim/Knevo/Check?style=flat-square\n)\n](https://github.com/TimerErTim/Knevo/actions/workflows/check.yml)\n[\n![Sonatype Nexus (Releases)](\nhttps://img.shields.io/nexus/r/eu.timerertim.knevo/knevo?server=https%3A%2F%2Fs01.oss.sonatype.org\u0026style=flat-square\n)\n](https://search.maven.org/artifact/eu.timerertim.knevo/knevo)\n![Maintenance](https://img.shields.io/maintenance/yes/2021?style=flat-square)\n\nA neuroevolution library for Java and Kotlin written purely in Kotlin, featuring multiple neuroevolution algorithms,\nserialization and multi-threading.\n\n## Table of Contents\n\n1. [Installation](#installation)\n2. [Content](#content)\n3. [Usage](#usage)\n4. [License](#license)\n5. [Project State](#project-state)\n\n## Installation\n\nFrom Maven Central:\n\nMaven\n\n```xml\n\u003cdependencies\u003e\n    \u003cdependency\u003e\n        \u003cgroupId\u003eeu.timerertim.knevo\u003c/groupId\u003e\n        \u003cartifactId\u003eknevo\u003c/artifactId\u003e\n        \u003cversion\u003e0.2.0-RC\u003c/version\u003e\n    \u003c/dependency\u003e\n\u003c/dependencies\u003e\n```\n\nGradle Groovy\n\n```groovy\ndependencies {\n    implementation 'eu.timerertim.knevo:knevo:0.2.0-RC'\n}\n```\n\nGradle KTS\n\n```kotlin\ndependencies {\n    implementation(\"eu.timerertim.knevo:knevo:0.2.0-RC\")\n}\n```\n\n## Content\n\nAlgorithms:\n\n- [x] [Instinct](https://towardsdatascience.com/neuro-evolution-on-steroids-82bd14ddc2f6)\n- [ ] [NEAT](http://nn.cs.utexas.edu/keyword?stanley:ec02)\n- [ ] [SUNA](https://paperswithcode.com/paper/spectrum-diverse-neuroevolution-with-unified)\n- [ ] [AGENT]()\n\nFeatures:\n\n- Serialization\n- Multithreading using Coroutines\n- Custom Activation Functions\n\n## Usage\n\n### Environment\n\nYou must implement the `Environment` interface and override the `evaluateFitness(population: List\u003cGenome\u003e)` function.\n\nFor each `Genome` in the population, you want to set its fitness.\n\n### Instances\n\nEverything requires an Instance. It is the interface to an algorithm implementation.\n\n```kotlin\nval instance = InstinctInstanceBuilder(2, 1)\n    .mutateAddSelfConnectionChance(0F)\n    .mutateAddRecurrentConnectionChance(0F)\n    .mutateRemoveConnectionChance(2.15F)\n    .hiddenActivations(Sigmoid(), Tanh(), Step(), Sign(), Linear(), Sinus(), Relu(), Selu(), Silu())\n    .outputActivations(Sign())\n    .build()\n```\n\n```kotlin\nval network = instance.Network()\nprintln(network(floatArrayOf(0F, 1F)))\n```\n\nThe Instance can be set globally, so you don't have to explicitly specify the Instance everytime.\n\n```kotlin\nglobalInstinctInstance = InstinctInstance(2, 1)\n```\n\n```kotlin\nval network = Network()\nprintln(network(floatArrayOf(0F, 1F)))\n```\n\n### Training\n\nYou can use individual `Networks` like above. However, you typically want to make use of a bigger population.\n\n```kotlin\nval pool = Pool(\n    populationSize = 500,\n    select = Tournament(10)\n)\n```\n\nYou can use this and some environment to write a training loop.\n\n```kotlin\ndo {\n    pool.evolve(environment)\n} while(pool.topFitness \u003c 100)\n```\n\nFinally, the trained `Genome` can be retrieved.\n\n```kotlin\nval network = pool.topGenome\n```\n\n### Coroutines\n\nThis library supports multithreading by using Coroutines. `Populations` are separated into batches, which are processed\nin parallel. This behavior can be configured on every `Population`.\n\n```kotlin\nval pool = PoolBuilder()\n    .populationSize(200)\n    .batchSize(50)\n    .build()\n```\nNote that when using this feature, the `Environment` has to be thread safe as multiple `Genomes` are evaluated in\nparallel.\n\n### Serialization\n\nYou can easily save any `Network` or `Pool`:\n\n```kotlin\nnetwork.save(\"out/my_trained_network.knv\")\n```\n\nAnd load it as easily:\n\n```kotlin\nval network: InstinctNetwork = load(\"out/my_trained_network.knv\") ?: Network()\n```\n\nBecause the load function returns null if the specified file does not yet exist, you can easily define an\ninitiative `Network` or `Pool`.\n\n## License\n\nKnevo is licensed under the [MIT License](LICENSE).\n\n## Project State\n\nI, the project owner, am currently attending\nthe [higher technical college of Grieskirchen](https://github.com/HTBLA-Grieskirchen). My education takes me about as\nmuch time as a full time job, not counting homework and similar tasks. In addition, I also have a part-time job. Because\nof this, the development pace is not as fast as one may expect. Nonetheless, I like to extend this library as demanded.\nJust be aware that development might be or become a little slow.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimerertim%2Fknevo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftimerertim%2Fknevo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimerertim%2Fknevo/lists"}