{"id":24905786,"url":"https://github.com/germanheim/globalsearch-rs","last_synced_at":"2025-04-14T08:12:50.692Z","repository":{"id":275222697,"uuid":"924271216","full_name":"GermanHeim/globalsearch-rs","owner":"GermanHeim","description":"Global optimization with scatter search and local NLP solvers written in Rust","archived":false,"fork":false,"pushed_at":"2025-04-12T21:09:17.000Z","size":422,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-12T22:21:21.515Z","etag":null,"topics":["math","numerical-optimization","optimization","optimization-algorithms","rust","scatter-search"],"latest_commit_sha":null,"homepage":"https://docs.rs/globalsearch","language":"Rust","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/GermanHeim.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","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,"zenodo":null}},"created_at":"2025-01-29T17:58:39.000Z","updated_at":"2025-04-12T21:09:20.000Z","dependencies_parsed_at":"2025-02-15T16:26:04.241Z","dependency_job_id":"28a8fe16-dbc7-4dd4-b4cd-b09909d722ef","html_url":"https://github.com/GermanHeim/globalsearch-rs","commit_stats":null,"previous_names":["germanheim/globalsearch-rs"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GermanHeim%2Fglobalsearch-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GermanHeim%2Fglobalsearch-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GermanHeim%2Fglobalsearch-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GermanHeim%2Fglobalsearch-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GermanHeim","download_url":"https://codeload.github.com/GermanHeim/globalsearch-rs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248843941,"owners_count":21170495,"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","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":["math","numerical-optimization","optimization","optimization-algorithms","rust","scatter-search"],"created_at":"2025-02-02T00:25:12.886Z","updated_at":"2025-04-14T08:12:50.681Z","avatar_url":"https://github.com/GermanHeim.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n    \u003cimg\n        width=\"500\"\n        src=\"https://raw.githubusercontent.com/GermanHeim/globalsearch-rs/main/media/logo.png\"\n        alt=\"GlobalSearch-rs\"\n    /\u003e\n    \u003cp align=\"center\"\u003e\n        Global optimization with scatter search and local NLP solvers written in Rust\n    \u003c/p\u003e\n    \u003cp align=\"center\"\u003e\n        \u003ca href=\"https://docs.rs/globalsearch/latest/globalsearch/\"\u003eDocs\u003c/a\u003e | \u003ca href=\"https://github.com/GermanHeim/globalsearch-rs/tree/main/examples\"\u003eExamples\u003c/a\u003e\n    \u003c/p\u003e\n\u003c/p\u003e\n\n\u003cdiv align=\"center\"\u003e\n    \u003ca href=\"https://crates.io/crates/globalsearch\"\u003e\n        \u003cimg src=\"https://img.shields.io/crates/v/globalsearch?logo=rust\u0026color=E05D44\" alt=\"crates version\" /\u003e\n    \u003c/a\u003e \n    \u003ca href=\"https://github.com/GermanHeim/globalsearch-rs/actions/workflows/globalsearch-rs-CI.yml\"\u003e\n        \u003cimg src=\"https://img.shields.io/github/actions/workflow/status/GermanHeim/globalsearch-rs/globalsearch-rs-CI.yml?branch=main\u0026label=globalsearch%20CI\u0026logo=github\" alt=\"CI\" /\u003e\n    \u003c/a\u003e \n    \u003ca href=\"https://app.codecov.io/gh/GermanHeim/globalsearch-rs\"\u003e\n        \u003cimg src=\"https://img.shields.io/codecov/c/github/GermanHeim/globalsearch-rs?logo=codecov\u0026color=FF0077\u0026token=C2FI2Z26ME\" alt=\"Codecov\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/GermanHeim/globalsearch-rs/blob/main/LICENSE.txt\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/license-MIT-blue\" alt=\"MIT License\" /\u003e\n    \u003c/a\u003e\n\u003c/div\u003e\n\n`globalsearch-rs`: Rust implementation of the _OQNLP_ (_OptQuest/NLP_) algorithm with the core ideas from \"Scatter Search and Local NLP Solvers: A Multistart Framework for Global Optimization\" by Ugray et al. (2007). It combines scatter search metaheuristics with local minimization for global optimization of nonlinear problems.\n\nSimilar to MATLAB's `GlobalSearch` \\[2\\], using argmin, rayon and ndarray.\n\n## Features\n\n- 🐍 [Python Bindings](https://github.com/GermanHeim/globalsearch-rs/tree/main/python)\n\n- 🎯 Multistart heuristic framework for global optimization\n\n- 📦 Local optimization using the argmin crate \\[3\\]\n\n- 🚀 Parallel execution of initial stage using Rayon\n\n## Installation\n\n### Using as a dependency\n\nAdd this to your `Cargo.toml`:\n\n```toml\n[dependencies]\nglobalsearch = \"0.2.0\"\n```\n\nOr use `cargo add globalsearch` in your project directory.\n\n### Building from source\n\n1. Install Rust toolchain using [rustup](https://rustup.rs/).\n2. Clone repository:\n\n   ```bash\n   git clone https://github.com/GermanHeim/globalsearch-rs.git\n   cd globalsearch-rs\n   ```\n\n3. Build the project:\n\n   ```bash\n   cargo build --release\n   ```\n\n## Usage\n\n1. Define a problem by implementing the `Problem` trait.\n\n   ```rust\n   use ndarray::{array, Array1, Array2};\n   use globalsearch::problem::Problem;\n   use globalsearch::types::EvaluationError;\n\n   pub struct MinimizeProblem;\n   impl Problem for MinimizeProblem {\n       fn objective(\u0026self, x: \u0026Array1\u003cf64\u003e) -\u003e Result\u003cf64, EvaluationError\u003e {\n           Ok(\n               ..., // Your objective function here\n           )\n       }\n\n       fn gradient(\u0026self, x: \u0026Array1\u003cf64\u003e) -\u003e Result\u003cArray1\u003cf64\u003e, EvaluationError\u003e {\n           Ok(array![\n               ..., // Optional: Gradient of your objective function here\n           ])\n       }\n\n       fn hessian(\u0026self, x: \u0026Array1\u003cf64\u003e) -\u003e Result\u003cArray2\u003cf64\u003e, EvaluationError\u003e {\n           Ok(array![\n               ..., // Optional: Hessian of your objective function here\n           ])\n       }\n\n       fn variable_bounds(\u0026self) -\u003e Array2\u003cf64\u003e {\n           array![[..., ...], [..., ...]] // Lower and upper bounds for each variable\n       }\n   }\n   ```\n\n   Where the `Problem` trait is defined as:\n\n   ```rust\n   pub trait Problem {\n       fn objective(\u0026self, x: \u0026Array1\u003cf64\u003e) -\u003e Result\u003cf64, EvaluationError\u003e;\n       fn gradient(\u0026self, x: \u0026Array1\u003cf64\u003e) -\u003e Result\u003cArray1\u003cf64\u003e, EvaluationError\u003e;\n       fn hessian(\u0026self, x: \u0026Array1\u003cf64\u003e) -\u003e Result\u003cArray2\u003cf64\u003e, EvaluationError\u003e;\n       fn variable_bounds(\u0026self) -\u003e Array2\u003cf64\u003e;\n   }\n   ```\n\n   Depending on your choice of local solver, you might need to implement the `gradient` and `hessian` methods. Learn more about the local solver configuration in the [argmin docs](https://docs.rs/argmin/latest/argmin/solver/index.html) or the [`LocalSolverType`](https://docs.rs/globalsearch/latest/globalsearch/types/enum.LocalSolverType.html).\n\n   \u003e 🔴 **Note:** Variable bounds are only used in the scatter search phase of the algorithm. The local solver is unconstrained (See [argmin issue #137](https://github.com/argmin-rs/argmin/issues/137)) and therefor can return solutions out of bounds.\n\n2. Set OQNLP parameters\n\n   ```rust\n   use globalsearch::types::{LocalSolverType, OQNLPParams};\n   use globalsearch::local_solver::builders::SteepestDescentBuilder;\n\n   let params: OQNLPParams = OQNLPParams {\n       iterations: 125,\n       wait_cycle: 10,\n       threshold_factor: 0.2,\n       distance_factor: 0.75,\n       population_size: 250,\n       local_solver_type: LocalSolverType::SteepestDescent,\n       local_solver_config: SteepestDescentBuilder::default().build(),\n       seed: 0,\n   };\n   ```\n\n   Where `OQNLPParams` is defined as:\n\n   ```rust\n   pub struct OQNLPParams {\n       pub iterations: usize,\n       pub wait_cycle: usize,\n       pub threshold_factor: f64,\n       pub distance_factor: f64,\n       pub population_size: usize,\n       pub local_solver_type: LocalSolverType,\n       pub local_solver_config: LocalSolverConfig,\n       pub seed: u64,\n   }\n   ```\n\n   And `LocalSolverType` is defined as:\n\n   ```rust\n   pub enum LocalSolverType {\n       LBFGS,\n       NelderMead,\n       SteepestDescent,\n       TrustRegion,\n       NewtonCG,\n   }\n   ```\n\n   You can also modify the local solver configuration for each type of local solver. See [`builders.rs`](https://github.com/GermanHeim/globalsearch-rs/tree/main/src/local_solver/builders.rs) for more details.\n\n3. Run the optimizer\n\n   ```rust\n   use oqnlp::{OQNLP, OQNLPParams};\n   use types::{SolutionSet}\n\n   fn main() -\u003e Result\u003c(), Box\u003cdyn std::error::Error\u003e\u003e {\n        let problem = MinimizeProblem;\n        let params: OQNLPParams = OQNLPParams {\n                iterations: 125,\n                wait_cycle: 10,\n                threshold_factor: 0.2,\n                distance_factor: 0.75,\n                population_size: 250,\n                local_solver_type: LocalSolverType::SteepestDescent,\n                local_solver_config: SteepestDescentBuilder::default().build(),\n                seed: 0,\n            };\n\n        let mut optimizer: OQNLP\u003cMinimizeProblem\u003e = OQNLP::new(problem, params)?;\n\n        // OQNLP returns a solution set with the best solutions found\n        let solution_set: SolutionSet = optimizer.run()?;\n        println!(\"{}\", solution_set)\n\n        Ok(())\n   }\n   ```\n\n## Project Structure\n\n```plaintext\nsrc/\n├── lib.rs # Module declarations\n├── oqnlp.rs # Core OQNLP algorithm implementation\n├── scatter_search.rs # Scatter search component\n├── local_solver/\n│   ├── builders.rs # Local solver configuration builders\n│   └── runner.rs # Local solver runner\n├── filters.rs # Merit and distance filtering logic\n├── problem.rs # Problem trait\n└── types.rs # Data structures and parameters\npython/ # Python bindings\n```\n\n## Dependencies\n\n- [argmin](https://github.com/argmin-rs/argmin)\n- [ndarray](https://github.com/rust-ndarray/ndarray)\n- [rayon](https://github.com/rayon-rs/rayon) [feature: `rayon`]\n- [kdam](https://github.com/clitic/kdam) [feature: `progress_bar`]\n- [rand](https://github.com/rust-random/rand)\n- [thiserror](https://github.com/dtolnay/thiserror)\n- [criterion.rs](https://github.com/bheisler/criterion.rs) [dev-dependency]\n\n## License\n\nDistributed under the MIT License. See [`LICENSE.txt`](https://github.com/GermanHeim/globalsearch-rs/blob/main/LICENSE.txt) for more information.\n\n## References\n\n\\[1\\] Zsolt Ugray, Leon Lasdon, John Plummer, Fred Glover, James Kelly, Rafael Martí, (2007) Scatter Search and Local NLP Solvers: A Multistart Framework for Global Optimization. INFORMS Journal on Computing 19(3):328-340. \u003chttp://dx.doi.org/10.1287/ijoc.1060.0175\u003e\n\n\\[2\\] GlobalSearch. The MathWorks, Inc. Available at: \u003chttps://www.mathworks.com/help/gads/globalsearch.html\u003e (Accessed: 27 January 2025)\n\n\\[3\\] Kroboth, S. argmin{}. Available at: \u003chttps://argmin-rs.org/\u003e (Accessed: 25 January 2025)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgermanheim%2Fglobalsearch-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgermanheim%2Fglobalsearch-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgermanheim%2Fglobalsearch-rs/lists"}