{"id":22561752,"url":"https://github.com/ccssmnn/hego","last_synced_at":"2025-10-05T18:16:00.627Z","repository":{"id":43745799,"uuid":"323981025","full_name":"ccssmnn/hego","owner":"ccssmnn","description":"Metaheuristics / Blackbox Optimization Algorithms for Go: Simulated Annealing, Genetic Algorithm, Ant Colony Optimization, Tabu Search, Particle Swarm Optimization ...","archived":false,"fork":false,"pushed_at":"2025-06-27T12:17:10.000Z","size":130,"stargazers_count":58,"open_issues_count":1,"forks_count":9,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-09-09T00:46:31.502Z","etag":null,"topics":["ant-colony-optimization","evolutionary-algorithm","genetic-algorithm","go","optimization","optimization-algorithms","particle-swarm-optimization","simulated-annealing","tabu-search"],"latest_commit_sha":null,"homepage":"","language":"Go","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/ccssmnn.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":"2020-12-23T19:03:18.000Z","updated_at":"2025-08-08T01:01:28.000Z","dependencies_parsed_at":"2022-08-31T13:42:34.003Z","dependency_job_id":null,"html_url":"https://github.com/ccssmnn/hego","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ccssmnn/hego","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ccssmnn%2Fhego","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ccssmnn%2Fhego/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ccssmnn%2Fhego/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ccssmnn%2Fhego/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ccssmnn","download_url":"https://codeload.github.com/ccssmnn/hego/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ccssmnn%2Fhego/sbom","scorecard":{"id":269400,"data":{"date":"2025-08-11","repo":{"name":"github.com/ccssmnn/hego","commit":"6dc06b7643df6c8e7af172374eae0828f5642dee"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.8,"checks":[{"name":"Code-Review","score":3,"reason":"Found 3/8 approved changesets -- score normalized to 3","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":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","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":"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":"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":"Maintained","score":1,"reason":"2 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 1","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"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":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/codecov.yml:1","Warn: no topLevel permission defined: .github/workflows/go.yml:1","Info: no jobLevel write permissions found"],"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":"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":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codecov.yml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/ccssmnn/hego/codecov.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codecov.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/ccssmnn/hego/codecov.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/codecov.yml:25: update your workflow using https://app.stepsecurity.io/secureworkflow/ccssmnn/hego/codecov.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/go.yml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/ccssmnn/hego/go.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/go.yml:16: update your workflow using https://app.stepsecurity.io/secureworkflow/ccssmnn/hego/go.yml/master?enable=pin","Info:   0 out of   4 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   1 third-party GitHubAction dependencies pinned"],"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":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: 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":"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":"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":"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"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 29 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"}}]},"last_synced_at":"2025-08-17T12:57:43.374Z","repository_id":43745799,"created_at":"2025-08-17T12:57:43.374Z","updated_at":"2025-08-17T12:57:43.374Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278495268,"owners_count":25996558,"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-10-05T02:00:06.059Z","response_time":54,"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":["ant-colony-optimization","evolutionary-algorithm","genetic-algorithm","go","optimization","optimization-algorithms","particle-swarm-optimization","simulated-annealing","tabu-search"],"created_at":"2024-12-07T22:09:33.426Z","updated_at":"2025-10-05T18:16:00.621Z","avatar_url":"https://github.com/ccssmnn.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Gitpod ready-to-code](https://img.shields.io/badge/Gitpod-ready--to--code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/ccssmnn/hego) [![stability-unstable](https://img.shields.io/badge/stability-unstable-yellow.svg)](https://github.com/emersion/stability-badges#unstable) [![codecov](https://codecov.io/gh/ccssmnn/hego/branch/master/graph/badge.svg?token=F52EAPT69U)](https://codecov.io/gh/ccssmnn/hego) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![Go Report Card](https://goreportcard.com/badge/github.com/ccssmnn/hego)](https://goreportcard.com/report/github.com/ccssmnn/hego) [![Go Reference](https://pkg.go.dev/badge/github.com/ccssmnn/hego.svg)](https://pkg.go.dev/github.com/ccssmnn/hego)\n\n# hego\n\nhego aims to provide a consistent API for several metaheuristics (black box optimization algorithms) while being performant.\n\nEven though most of the metaheuristics might fit to any kind of optimization problem most of them have some caveats / advantages in different fields. hego allows you to rapidly try different algorithms and experiment with the parameters in order to solve your problems in the best possible time-to-quality ratio.\n\n## Algorithms\n\nCurrently the following algorithms are implemented:\n\n- Simulated Annealing (SA)\n- Genetic Algorithm (GA)\n- Ant Colony Optimization (ACO)\n- Tabu Search (TS)\n- Evolution Strategies (ES) (continuous only)\n- Particle Swarm Optimization (PSO) (continuous only)\n\nAll algorithms are implemented for finding minimum values.\n\n## Usage\n\nhego is able to solve your optimization problems when the algorithm specific interface is implemented. This approach allows you to use hego for various problem encodings. For example integer- or boolean vectors, graphs, structs etc.\n\nFor basic vector types (int, bool and float64) helper methods implemented in the subpackages `hego/crossover` and `hego/mutate` allow you to experiment with different parameter variants of the algorithms.\n\nSome algorithms however are only designed for specific sets of optimization problems. In these cases the algorithms provide an easier call signature that only requires the objective and the initial guess or initializer functions. (Evolution Strategies, Particle Swarm Optimization)\n\nhego has a rich examples directory. It is ordered by problem type and shows how to apply hego's algorithms to these types of problems:\n\n- Traveling Salesman Problem, an integer encoded permutation problem for finding the shortest path to visit all cities ([wikipedia](https://en.wikipedia.org/wiki/Travelling_salesman_problem))\n- Knapsack Problem, a binary encoded combinatorial optimization problem to select items to get be best value while respecting the maximum weight ([wikipedia](https://en.wikipedia.org/wiki/Knapsack_problem))\n- Rastrigin Function, a non convex function with a large number of local minima ([wikipedia](https://en.wikipedia.org/wiki/Rastrigin_function))\n- Nurse Scheduling Problem, a scheduling problem for assigning shifts to nurses with constraints ([wikipedia](https://en.wikipedia.org/wiki/Nurse_scheduling_problem))\n- Vehicle Routing Problem, a combination of Knapsack and Traveling Salesman problem ([wikipedia](https://en.wikipedia.org/wiki/Vehicle_routing_problem))\n\n**NOTE**: The examples goal is to show how hego can be applied to these problem types. The goal is not to show the current state of the art solution approaches. If you have improvement ideas for the examples performance, feel free to open a PR.\n\n## Example\n\nThis example uses Simulated Annealing (SA) for optimizing the Rastrigin Function:\n\n```golang\npackage main\n\nimport (\n\t\"fmt\"\n\t\"math\"\n\n\t\"github.com/ccssmnn/hego\"\n\t\"github.com/ccssmnn/hego/mutate\"\n)\n\nfunc rastringin(x, y float64) float64 {\n\treturn 10*2 + (x*x - 10*math.Cos(2*math.Pi*x)) + (y*y - 10*math.Cos(2*math.Pi*y))\n}\n\n// state is a two element vector, it will implement the State interface for Simulated Annealing\ntype state []float64\n\n// Neighbor produces another state by adding gaussian noise to the current state\nfunc (s state) Neighbor() hego.AnnealingState {\n\treturn state(mutate.Gauss(s, 0.3))\n}\n\n// Energy returns the energy of the current state. Lower is better\nfunc (s state) Energy() float64 {\n\treturn rastringin(s[0], s[1])\n}\n\nfunc main() {\n\tinitialState := state{5.0, 5.0}\n\n\tsettings := hego.SASettings{}\n\tsettings.MaxIterations = 100000\n\tsettings.Verbose = 10000\n\tsettings.Temperature = 10.0       // choose temperature in the range of the systems energy\n\tsettings.AnnealingFactor = 0.9999 // decrementing the temperature leads to convergence, we want to reach convergence when approaching the end of iterations\n\n\t// start simulated annealing algorithm\n\tresult, err := hego.SA(initialState, settings)\n\n\tif err != nil {\n\t\tfmt.Printf(\"Got error while running Anneal: %v\", err)\n\t}\n\tfinalState := result.State\n\tfinalEnergy := result.Energy\n\tfmt.Printf(\"Finished Simulated Annealing in %v! Result: %v, Value: %v \\n\", result.Runtime, finalState, finalEnergy)\n}\n```\n\nIt logs:\n\n```\n   Iteration             Temperature                  Energy\n           0                   9.999                      50\n       10000      3.6782426032832705      3.0986994133146712\n       20000      1.3530821730781113       4.227542078387473\n       30000       0.497746224098313       2.336322174938326\n       40000      0.1831014468548652     0.30639618340376096\n       50000     0.06735588984342127     0.03177535766328887\n       60000    0.024777608121224735     0.02194743246350228\n       70000    0.009114716851579779   0.0030078958948340784\n       80000    0.003352949278962375    0.012710941747947402\n       90000   0.0012334194303957732    0.004538678651899275\n       99999   0.0004537723395901116   0.0008388313144696014\n\nDone after 108.647155ms!\nFinished Simulated Annealing in 108.647155ms! Result: [0.0010647353926910566 -0.001759125670646859], Value: 0.0008388313144696014\n```\n\n## Contributing\n\nThis repo is accepting PR's and welcoming issues. Feel free to contribute in any kind if\n\n- you find any bugs\n- you have ideas to make this library easier to use\n- you have ideas on how to improve the performance\n- you miss algorithm XY\n\n## License\n\nThe MIT License (MIT). [License](https://github.com/ccssmnn/hego)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fccssmnn%2Fhego","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fccssmnn%2Fhego","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fccssmnn%2Fhego/lists"}