{"id":26378432,"url":"https://github.com/cyypherus/swift-slime","last_synced_at":"2025-07-30T14:32:57.204Z","repository":{"id":164120142,"uuid":"490927486","full_name":"cyypherus/swift-slime","owner":"cyypherus","description":"A lightweight stochastic optimizer based on slime mold (Slime Mold Algorithm)","archived":false,"fork":false,"pushed_at":"2022-06-18T23:44:20.000Z","size":43022,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-03T00:32:28.994Z","etag":null,"topics":["algorithm","optimization","optimization-algorithms","stochastic-optimization","swift"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"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/cyypherus.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-05-11T02:18:36.000Z","updated_at":"2023-03-28T11:41:26.000Z","dependencies_parsed_at":null,"dependency_job_id":"b8956faa-5af2-4060-80ec-47453839f875","html_url":"https://github.com/cyypherus/swift-slime","commit_stats":null,"previous_names":["cyypherus/swift-slime","ejjonny/swift-slime"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/cyypherus/swift-slime","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cyypherus%2Fswift-slime","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cyypherus%2Fswift-slime/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cyypherus%2Fswift-slime/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cyypherus%2Fswift-slime/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cyypherus","download_url":"https://codeload.github.com/cyypherus/swift-slime/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cyypherus%2Fswift-slime/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267882819,"owners_count":24160212,"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-07-30T02:00:09.044Z","response_time":70,"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":["algorithm","optimization","optimization-algorithms","stochastic-optimization","swift"],"created_at":"2025-03-17T04:51:55.064Z","updated_at":"2025-07-30T14:32:57.100Z","avatar_url":"https://github.com/cyypherus.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Slime\n\nThis is a Swift implementation of a Slime Mold Algorithm - a stochastic optimizer - generally based on this [paper](https://doi.org/10.1016/j.future.2020.03.055)\n\nThe only dependency required by Slime is `SwiftNumerics`\n\n# Visual Examples\nSearching for the global maxima of \n`-abs(x + 100000) - abs(y + 100000) + sin(10 * x)`\n\n \u003cimg src=\"/ex1.gif?raw=true\" width=\"500px\"\u003e\n \nSearching for the shortest path visiting 50 locations (traveling salesman)\n\n \u003cimg src=\"/ex2.gif?raw=true\" width=\"500px\"\u003e\n\n# Use the Slime\n\nIn a SwiftPM project:\n\nAdd the following line to the dependencies in your Package.swift file:\n\n```swift\n.package(url: \"https://github.com/ejjonny/slime\", from: \"2.0.0\"),\n```\n\nAdd Slime as a dependency for your target:\n\n```swift\n.target(\n    name: \"MyTarget\", \n    dependencies: [\n        .product(name: \"Slime\", package: \"Slime\"),\n    ]\n),\n```\n\nAdd `import Slime` to your swift file.\n\n```swift\nvar slime = Slime(\n                populationSize: 10,\n                maxIterations: 100,\n                lower: SIMD2(-1, -1),\n                upper: SIMD2(1, 1),\n                method: .minimize, // Use .maximize if higher fitness values are better\n                fitnessEvaluation: { vector in\n                    let x = vector[0]\n                    let y = vector[1]\n                    // Return a fitness value Double using the proposed vector\n                }\n            )\nslime.run() // This runs the fitness evaluation many times, among other busy work, \u0026 will usually be expensive\n\nslime.bestCells // An array of the top 3 Cells. Use Cell.position for the associated vectors\n```\n\nThis example is using a 2 dimensional solution space. The algorithm will work with any number of vector components if you're looking for a solution in *hyperspace*.\n\n# More Info\n\n*[wikiversity](https://en.wikiversity.org/wiki/Slime_Mould_Algorithm)*\n\u003e *\"Slime mold algorithm (SMA) is a population-based optimization technique which is proposed based on the oscillation style of slime mold in nature. The SMA has a unique mathematical model that simulates positive and negative feedbacks of the propagation wave of slime mold. It has a dynamic structure with a stable balance between global and local search drifts.\"*\n\n# TODO:\n\n- Readme walkthrough of the math used in the algorithm\n- Explore some deterministic changes\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcyypherus%2Fswift-slime","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcyypherus%2Fswift-slime","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcyypherus%2Fswift-slime/lists"}