{"id":13413356,"url":"https://github.com/tomcraven/goga","last_synced_at":"2026-01-16T19:35:49.036Z","repository":{"id":42083741,"uuid":"44605875","full_name":"tomcraven/goga","owner":"tomcraven","description":"Golang Genetic Algorithm","archived":false,"fork":false,"pushed_at":"2022-04-13T07:09:30.000Z","size":2292,"stargazers_count":224,"open_issues_count":2,"forks_count":19,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-08-14T04:02:02.702Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tomcraven.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-10-20T12:50:51.000Z","updated_at":"2025-07-18T16:57:23.000Z","dependencies_parsed_at":"2022-08-12T04:22:00.903Z","dependency_job_id":null,"html_url":"https://github.com/tomcraven/goga","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/tomcraven/goga","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomcraven%2Fgoga","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomcraven%2Fgoga/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomcraven%2Fgoga/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomcraven%2Fgoga/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tomcraven","download_url":"https://codeload.github.com/tomcraven/goga/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomcraven%2Fgoga/sbom","scorecard":{"id":892372,"data":{"date":"2025-08-11","repo":{"name":"github.com/tomcraven/goga","commit":"f4ca47f4d42189d3c2292226a4e8fa970c2edd07"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":0,"reason":"Found 1/24 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: GNU General Public License v3.0: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 8 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-24T12:21:22.438Z","repository_id":42083741,"created_at":"2025-08-24T12:21:22.438Z","updated_at":"2025-08-24T12:21:22.438Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28481887,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T11:59:17.896Z","status":"ssl_error","status_checked_at":"2026-01-16T11:55:55.838Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":[],"created_at":"2024-07-30T20:01:38.498Z","updated_at":"2026-01-16T19:35:49.008Z","avatar_url":"https://github.com/tomcraven.png","language":"Go","readme":"# goga [![Build Status](https://travis-ci.org/tomcraven/goga.svg?branch=master)](https://travis-ci.org/tomcraven/goga) [![Coverage Status](https://coveralls.io/repos/tomcraven/goga/badge.svg?branch=master\u0026service=github)](https://coveralls.io/github/tomcraven/goga?branch=master) [![Go Report Card](https://goreportcard.com/badge/github.com/tomcraven/goga)](https://goreportcard.com/report/github.com/tomcraven/goga)\n\nGolang implementation of a genetic algorithm. See ./examples for info on how to use the library.\n\n## Overview\nGoga is a genetic algorithm solution written in Golang. It is used and configured by injecting different behaviours into the main genetic algorithm object. The main injectable components are the simulator, selector and mater.\n\nThe simulator provides a function that accepts a single genome and assigns a fitness score to it. The higher the fitness, the better the genome has done in the simulation. A genome can be simulated by however the application sees fit as long as it can be encoded into a bitset of 0s and 1s. A simulator also provides a function to tell the algorithm when to stop.\n\nThe selector object takes a popualtion of genomes and the total fitness and returns a genome from the population that it has chosen. A common implementation is roulette in which a random value between 0..totalFitness is generated and the genomes are cycled through subtracting their fitness away from this random number. Then this number goes below 0 then a genome has been 'selected'. The idea is that a genome with a higher fitness will be more likely to be chosen.\n\nA mater accepts two genomes from the selector and combines them to produce two others. There are some common predefined mating algorithms but the user is also free to define their own.\n\nAs genomes that have a fitness are more likely to mate, the program will slowly work its way towards what it thinks is an optimal solution.\n\n## Examples\nThis section will talk through any example programs using this library.\n\n#### examples/string_matcher.go\nTo run:\n```\ncd examples\ngo run string_matcher.go\n```\n\nThe string matcher is a program that can be configured with any string and the goga library will attempt to generate a bitset that decodes to this string. Each character is representated by 8 bits in each genome.\n\nThere are some configuration constants just above the main function, use this to configure the string you'd like the algorithm to match to.\n```\nconst (\n\tkTargetString = \"abcdefghijklmnopqrstuvwxyz\"\n\t// ...\n)\n```\n\nThe elite consumer is called after each simulation with the best genome of that iteration. It prints it out along with the iteration number and the fitness for that particular genome. A typical output might look something like this:\n```\n1 \t Øoâ|-7rPKw\n                   D( \t 71\n2 \t Xnæ=írVÏw\nT3 \t 74\n3 \t \u0018oî,ë.2wës\n\u0004# \t 81\n4 \t XOà|m,\u0010WOz\nD\" \t 84\n5 \t XOålo,rWorD# \t 89\n6 \t XOìlo.0WozD# \t 91\n7 \t Xgflm,pWorND# \t 93\n8 \t Xgllo,0WorD# \t 96\n9 \t Xgllo.0WorNd# \t 97\n10 \t Xello.0WorNd# \t 98\n11 \t Hello,0WorNd# \t 100\n12 \t Hello,0WorNd# \t 100\n13 \t Hello, WorNd# \t 101\n14 \t Hello, Wornd! \t 103\n15 \t Hello, Wornd! \t 103\n16 \t Hello, World! \t 104\n151.88245ms\n```\nYou can see the string slowly becoming more like the input string as there are more iterations.\n\n#### examples/image_matcher.go\nTo run:\n```\ncd examples\ngo run image_matcher.go \u003cpath_to_image\u003e\n```\n\nImage matcher takes an input image and attempts to produce an output image that is as close to it as possible only using RGBA coloured rectangles and circles. There are a few parameters at the top of the file that are interesting to fiddle with:\n```\nnumShapes = 100\npopulationSize = 1000\nmaxIterations = 9999999\nbitsPerCoordinateNumber = 9\nparallelSimulations = 24\nmaxCircleRadiusFactor = 3\n```\n* numShapes - the number of shapes that are used when the algorithm re-creates the input image\n* populationSize - the number of genomes in each population. Each genome can be decoded into a picture. A high value will mean each iteration takes longer, and usually results in the algorithm finding its optimal solution in less iterations.\n* maxIterations - the maximum number of simulations/iterations to run. Providing a huge number will essentially run until the algorithm has figured out what it thinks is an optimal solution.\n* bitsPerCoordinateNumber - Each shape is positioned using coordinates. A rect is represented by the top left and bottom right coordinates, and a circle by its centre. A coordinate is made up of two numbers, each number is represented by this many bits. The number generated is used to calculate a percentage of the overall width/height of the image for the coordinate to be positioned at. For example, if bitsPerCoordinateNumber is 8, that means the maximum value a coordinte can be is ```0b11111111```, or ```255```. To calculate the coordinates number relative to the image's width and height we normalise this and apply the decimal to the pictures dimensions. For example, if our X coordinate produced by the algorithm is 233, and our images width is 120. ```( 233 / 255 ) * 120 == 109 == our X coordinate```. Setting this to a high value means the algorithm has more accuracy when placing shapes. A low value of 2 or 3 also creates some interesting effects.\n* parallelSimulations - The number of simulations to run in parallel. A higher value usually means each iteration takes less time, up to a certain point.\n* maxCircleRadiusFactor - A number to divide a circles radius by. 1 will mean a circles radius can be anywhere between 1 and max( inputImageWidth, inputImageHeight ). From experimenting, restricting the radius a little creates 'better' images quicker\n\nThe script outputs the 'best' genome from each iteration to \"elite.png\" as well as the original overlayed in \"elite_with_original.png\".\n\nHere's an example of what can be generated. Input, output and both overlayed over the top of each other:\n\n![input](https://cloud.githubusercontent.com/assets/5236109/10744734/01031bda-7c34-11e5-94ab-795afba114c1.gif)\n![output](https://cloud.githubusercontent.com/assets/5236109/10744673/97a7aea8-7c33-11e5-8cfe-ea66489d8d9c.png)\n![overlayed](https://cloud.githubusercontent.com/assets/5236109/10744674/9ad23fa8-7c33-11e5-88d9-aff565cca6c4.png)\n","funding_links":[],"categories":["Machine Learning","\u003cspan id=\"机器学习-machine-learning\"\u003e机器学习 Machine Learning\u003c/span\u003e","General Machine Learning libraries","机器学习","Relational Databases"],"sub_categories":["Search and Analytic Databases","\u003cspan id=\"高级控制台用户界面-advanced-console-uis\"\u003e高级控制台用户界面 Advanced Console UIs\u003c/span\u003e","Vector Database","Advanced Console UIs","SQL 查询语句构建库","检索及分析资料库","交流"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomcraven%2Fgoga","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftomcraven%2Fgoga","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomcraven%2Fgoga/lists"}