{"id":50488339,"url":"https://github.com/salar-shdk/nia","last_synced_at":"2026-06-02T00:30:27.200Z","repository":{"id":41537994,"uuid":"401066107","full_name":"salar-shdk/nia","owner":"salar-shdk","description":"Nature Inspired Optimization Algorithms","archived":false,"fork":false,"pushed_at":"2023-02-13T18:35:06.000Z","size":67,"stargazers_count":27,"open_issues_count":0,"forks_count":2,"subscribers_count":4,"default_branch":"main","last_synced_at":"2026-05-26T22:31:50.049Z","etag":null,"topics":["algorithm","ant-colony-optimization","artificial-bee-colony","bioinspired","cuckoo-search","differential-evolution","evolutionary-algorithms","evolutionary-programming","genetic-algorithm","grey-wolf-optimizer","huristic","nature-inspired-algorithms","nature-inspired-computation","nia","optimization","optimization-algorithms","particle-swarm-optimization","python","simulated-annealing-algorithm"],"latest_commit_sha":null,"homepage":"","language":"Python","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/salar-shdk.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":"2021-08-29T14:44:36.000Z","updated_at":"2026-01-13T11:17:48.000Z","dependencies_parsed_at":"2023-01-31T06:45:53.386Z","dependency_job_id":null,"html_url":"https://github.com/salar-shdk/nia","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/salar-shdk/nia","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/salar-shdk%2Fnia","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/salar-shdk%2Fnia/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/salar-shdk%2Fnia/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/salar-shdk%2Fnia/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/salar-shdk","download_url":"https://codeload.github.com/salar-shdk/nia/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/salar-shdk%2Fnia/sbom","scorecard":{"id":796251,"data":{"date":"2025-08-11","repo":{"name":"github.com/salar-shdk/nia","commit":"193f03ba660ccb93f350d87e2d6ddbca66439c61"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4.1,"checks":[{"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":"Pinned-Dependencies","score":2,"reason":"dependency not pinned by hash detected -- score normalized to 2","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/python-publish.yml:25: update your workflow using https://app.stepsecurity.io/secureworkflow/salar-shdk/nia/python-publish.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/python-publish.yml:27: update your workflow using https://app.stepsecurity.io/secureworkflow/salar-shdk/nia/python-publish.yml/main?enable=pin","Warn: pipCommand not pinned by hash: .github/workflows/python-publish.yml:32","Warn: pipCommand not pinned by hash: .github/workflows/python-publish.yml:33","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned","Info:   1 out of   1 third-party GitHubAction dependencies pinned","Info:   0 out of   2 pipCommand 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":"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":"Code-Review","score":0,"reason":"Found 0/27 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":"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":10,"reason":"GitHub workflow tokens follow principle of least privilege","details":["Info: topLevel 'contents' permission set to 'read': .github/workflows/python-publish.yml:17","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":"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":"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":"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":"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":"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":"Signed-Releases","score":0,"reason":"Project has not signed or included provenance with any releases.","details":["Warn: release artifact v0.0.2 not signed: https://api.github.com/repos/salar-shdk/nia/releases/50007641","Warn: release artifact v0.0.1 not signed: https://api.github.com/repos/salar-shdk/nia/releases/49331123","Warn: release artifact v0.0.2 does not have provenance: https://api.github.com/repos/salar-shdk/nia/releases/50007641","Warn: release artifact v0.0.1 does not have provenance: https://api.github.com/repos/salar-shdk/nia/releases/49331123"],"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 'main'"],"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 6 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-23T09:05:01.580Z","repository_id":41537994,"created_at":"2025-08-23T09:05:01.580Z","updated_at":"2025-08-23T09:05:01.580Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33800674,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-01T02:00:06.963Z","response_time":115,"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","ant-colony-optimization","artificial-bee-colony","bioinspired","cuckoo-search","differential-evolution","evolutionary-algorithms","evolutionary-programming","genetic-algorithm","grey-wolf-optimizer","huristic","nature-inspired-algorithms","nature-inspired-computation","nia","optimization","optimization-algorithms","particle-swarm-optimization","python","simulated-annealing-algorithm"],"created_at":"2026-06-02T00:30:26.168Z","updated_at":"2026-06-02T00:30:27.192Z","avatar_url":"https://github.com/salar-shdk.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NIA\n\u003ca\u003e\u003cimg align=\"right\" src=\"https://img.shields.io/github/license/salar-shdk/nia\"/\u003e\u003c/a\u003e\n\u003ca\u003e\u003cimg align=\"right\" src=\"https://img.shields.io/pypi/v/nia\"/\u003e\u003c/a\u003e\n\u003ca\u003e\u003cimg align=\"right\" src=\"https://img.shields.io/pypi/pyversions/nia\"/\u003e\u003c/a\u003e\n\u003ca\u003e\u003cimg align=\"right\" src=\"https://img.shields.io/github/languages/code-size/salar-shdk/nia?color=blueviolet\"/\u003e\u003c/a\u003e\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/salar-shdk/nia/raw/main/NIA%20Logo.png\" /\u003e\n\u003c/p\u003e\nNIA is a python package for Nature Inspired Optimization Algorithms which makes optimization process easy and fast.\n\n# Instalation\nCheck [NIA's PyPI page](https://pypi.org/project/nia/) or simply install it using pip:\n\u003ca\u003e\u003cimg align=\"right\" src=\"https://pepy.tech/badge/nia\"/\u003e\u003c/a\u003e\n```\npip install nia\n```\n\n# Usage\nSolve Ackley problem using Genetic Algorithm:\n```python\nfrom nia.algorithms import GeneticAlgorithm\nfrom nia.problems import ackley\n\n\nnia = GeneticAlgorithm(cost_function=ackley,\n                       lower_bond=[-5,-5],\n                       upper_bond=[5,5],\n                                )\nnia.run()\nprint(nia.message);\n```\noutput:  \n\n```\nquit criteria reached best answer is: [-0.02618036 -0.03615453] and best fitness is: 0.0006327163637145361 iteration : 11\n```  \n\nPlot:  \n\u003cp align=\"center\"\u003e\n  \u003cimg alt=\"Result gif\" align=\"center\" src=\"https://user-images.githubusercontent.com/33146532/134220470-742ca835-2b9a-4d1d-9a87-76c337156823.gif\"/\u003e\n\u003c/p\u003e\n\n\n\n## Customization:\n```python\nfrom nia.algorithms import GeneticAlgorithm\n# Specific selection, crossover and muttion algorithms are available under related sub-packages.\nfrom nia.selections import Tournament\nfrom nia.crossovers import RandomSBX\nfrom nia.mutations import Uniform\nimport numpy as np\n\ndef ackley(X):\n    x = X[0]\n    y = X[1]\n    return -20 * np.exp(-0.2 * np.sqrt(0.5 * (x**2 + y**2))) - np.exp(0.5 *\n        (np.cos(2 * np.pi * x) + np.cos(2 * np.pi * y))) + np.e + 20\n\ndef log(ga):\n  print(ga.best)\n\nlower = np.array([-5,-5])\nupper = np.array([5,5])\n\nnia = GeneticAlgorithm(cost_function=ackley,\n                       iteration_function=log,\n                       lower_bond=lower,\n                       upper_bond=upper,\n                       quit_criteria = 0.0001,\n                       num_variable = 2,\n                       num_population = 20,\n                       max_iteration = 100,\n                       crossover = RandomSBX(2),\n                       mutation = Uniform(0.05),\n                       selection = Tournament(20)\n                                )\nnia.run()\nprint(nia.message);\n```  \noutput\n```\nmax iteration reached best answer so far: [-0.02618036 -0.03615453] with best fitness: 0.1786046633597529 iteration : 99\n```\n\n\n# Supported Algorithms :  \n- [x] Genetic algorithm (GeneticAlgorithm)\n- [ ] Differential Evolution  \n- [ ] Evolutionary Programming  \n- [ ] Artificial Immune System  \n- [ ] Clonal Selection Algorithm  \n- [ ] Biogeography-based  \n- [ ] Symbiotic Organisms Search  \n- [ ] Ant Colony Optimization  \n- [x] Artificial Bee Colony (ArtificialBeeColony)\n- [ ] Moth Flame Optimization Algorithm  \n- [ ] Cuckoo Search  \n- [ ] Green Herons Optimization Algorithm  \n- [ ] Bat Algorithm  \n- [ ] Whale Optimization Algorithm  \n- [ ] Krill Herd  \n- [ ] Fish-swarm Algorithm  \n- [ ] Grey Wolf Optimizer  \n- [ ] Shuffle frog-leaping Algorithm  \n- [ ] Cat Swarm Optimization  \n- [ ] Flower Pollination Algorithm  \n- [ ] Invasive Weed Optimization  \n- [ ] Water Cycle Algorithm  \n- [ ] Teaching–Learning-Based Optimization  \n- [x] Particle Swarm Optimization (ParticleSwarmOptimization)\n- [ ] Simulated Annealing Algorithm  \n- [ ] Gravitational Search Algorithm  \n- [ ] Big Bang - Big Crunch  \n\n# Supported Selection Operators :  \n- [x] Rank (Rank)\n- [x] Tournament (Tournament)  \n\n# Supported Cross Over Operators :  \n- [x] K-Point (KPoint)\n- [x] SBX (SBX)  \n- [x] Random SBX (RandomSBX)\n\n# Supported Mutation Operators :  \n- [x] Uniform (Uniform) \n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsalar-shdk%2Fnia","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsalar-shdk%2Fnia","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsalar-shdk%2Fnia/lists"}