{"id":16138209,"url":"https://github.com/ul/harmony","last_synced_at":"2026-02-16T12:33:45.104Z","repository":{"id":11096918,"uuid":"13448509","full_name":"ul/harmony","owner":"ul","description":"Simple harmony search implementation in Clojure.","archived":false,"fork":false,"pushed_at":"2011-06-14T12:26:47.000Z","size":64,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-01-14T18:37:02.176Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":false,"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/ul.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":"2013-10-09T17:10:43.000Z","updated_at":"2014-05-16T15:45:40.000Z","dependencies_parsed_at":"2022-09-06T16:22:35.469Z","dependency_job_id":null,"html_url":"https://github.com/ul/harmony","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ul/harmony","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ul%2Fharmony","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ul%2Fharmony/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ul%2Fharmony/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ul%2Fharmony/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ul","download_url":"https://codeload.github.com/ul/harmony/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ul%2Fharmony/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29507904,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-16T09:05:14.864Z","status":"ssl_error","status_checked_at":"2026-02-16T08:55:59.364Z","response_time":115,"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-10-09T23:33:00.602Z","updated_at":"2026-02-16T12:33:45.079Z","avatar_url":"https://github.com/ul.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# harmony\n\nA simple implementation of harmony search algorithm. \nPlease read the description on [wikipedia](http://en.wikipedia.org/wiki/Harmony_search) for details.\n\n## Description\n\n### harmony.core\n\n`harmony-seq` creates an inifinite sequence of harmony memories\n\n    [\u0026 {:keys [hms hmcr par dims f] :or {hms 30 hmcr 0.9 par 0.3}}]\n\nMost arguments are optional. You only have to provide a sequence of dimensions\nimplementing `Dimension` protocol and a function that takes a sequence of arguments\nand returns a numeric value. \n\nPlease note that the algorithm tries to maximize vector values, so if you want to\nminimize something you should use for example something like:\n\n    #(- 0 my-foo-to-be-minimized)\n\n`harmony-search` is a helper function and returns a harmony memory after a specified \nnumber of iterations\n\nIt takes and additional argument `:n` which specifies the desired number of iterations\n\n    [\u0026 {:keys [hms hmcr par dims f n] :or {hms 30 hmcr 0.9 par 0.3}}]\n\n#### arguments\n\n`hms` - harmony memory size, the number of solution vectors kept in memory. \nUsually between 1 and 100.\n\n`hmcr` - considering rate. Probability that we will use old value in the \nnew candidate vector. Should be between 0 and 1.\n\n`par` - probability that we will slightly modify a value picked from harmony memory.\nShould be between 0 and 1.\n\n`dims` - sequence of dimensions\n\n`f` - evaluation function\n\n###harmony.dimension\n\nContains the definition of `Dimension` protocol and two sample dimensions.\n\n`Dimension` protocol specifies three operations: `get-random [this]` - returns a valid random value;\n`to-bounds [this x]` - returns its argument if it's within allowed range (if any) or a corrected value;\n`modify [this x]` - returns a modified argument value which can exceed allowed range as it will be \ncorrected with `to-bounds`.\n\nThere is one sample dimension: `RealDimension`.\n\n## Usage\n\n    (require '[harmony.core :as hc]\n\t    '[harmony.dimension :as hd])\n\n    ;;create some dimensions \n    (def dims [(hd/get-real-dim 0 5 0.05) (hd/get-real-dim 5 10 0.05)])\n\n    ;;returns the best harmony memory vector after 100 iterations\n    (last (hs/harmony-search :dims dims :f #(apply + %) :n 100))\n\n    ;;returns the best vector from the first harmomy memory that meets the specified condition\n    (last (first (drop-while #(\u003c (first (last %)) 32)\n\t\t\t     (hs/harmony-seq :dims dims :f #(reduce * %)))))\n\n## License\n\nCopyright (C) 2011 Piotr Borzymek\n\nDistributed under the Eclipse Public License, the same as Clojure.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ful%2Fharmony","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ful%2Fharmony","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ful%2Fharmony/lists"}