{"id":24628276,"url":"https://github.com/nikhilr612/safire","last_synced_at":"2025-03-20T02:29:12.758Z","repository":{"id":273079197,"uuid":"918647108","full_name":"nikhilr612/safire","owner":"nikhilr612","description":"A small library for simulated annealing using arrayfire.","archived":false,"fork":false,"pushed_at":"2025-01-26T04:52:26.000Z","size":13,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-26T05:23:47.154Z","etag":null,"topics":["annealing","arrayfire","data-parallelism","optimization-algorithms","rust"],"latest_commit_sha":null,"homepage":"","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/nikhilr612.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-01-18T13:46:37.000Z","updated_at":"2025-01-26T04:52:30.000Z","dependencies_parsed_at":"2025-01-26T05:21:07.782Z","dependency_job_id":null,"html_url":"https://github.com/nikhilr612/safire","commit_stats":null,"previous_names":["nikhilr612/safire"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikhilr612%2Fsafire","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikhilr612%2Fsafire/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikhilr612%2Fsafire/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikhilr612%2Fsafire/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nikhilr612","download_url":"https://codeload.github.com/nikhilr612/safire/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244538290,"owners_count":20468677,"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":["annealing","arrayfire","data-parallelism","optimization-algorithms","rust"],"created_at":"2025-01-25T05:14:47.761Z","updated_at":"2025-03-20T02:29:12.753Z","avatar_url":"https://github.com/nikhilr612.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SaFire 🔥\n\nSAFire is a Rust library that implements simulated annealing optimization algorithms using ArrayFire for efficient computation, especially on GPUs.\n\n## Overview\n\nSafire provides both sequential and data-parallel implementations of simulated annealing, making it suitable for both small-scale and large-scale optimization problems. The library leverages ArrayFire's GPU acceleration capabilities to perform efficient parallel computations.\n\n### Features\n\n- ✅ Sequential simulated annealing implementation\n- ✅ Synchronous data-parallel simulated annealing\n- 📊 Common benchmark functions included:\n  - Rastrigin function\n  - Ackley function\n  - Schwefel function\n- 🔧 Flexible API for custom optimization problems\n- 🚀 GPU acceleration support via ArrayFire\n- 🔄 Customizable temperature schedules\n- 🎯 Automatic parameter validation\n\n## Installation\n\nAdd this to your `Cargo.toml`:\n\n```toml\n[dependencies]\nsafire = { git = \"https://github.com/nikhilr612/safire\" }\n```\n\n## Usage\n\n```rust\nuse safire::{parsa, lsops::random_perturbation, testfunctions};\nuse arrayfire as af;\n\nfn main() {\n    let start = af::constant(1.0f32, af::dim4!(2, 1));\n    let schedule = (0..20).map(|i| 800.0 * 0.8f32.powi(i));\n\n    // Perform synchronous data-parallel simulated annealing.\n    // For sequential counter-part see [`safire::seqsa::minimize`].\n    let result = parsa::minimize_numeric(\n        800,                    // batch size\n        10,                     // chain length\n        0.01,                   // Boltzmann constant\n        \u0026start,                 // starting point\n        testfunctions::rastrigin, // objective function\n        |x| random_perturbation(x, 0.4), // neighbor function\n        schedule,\n    );\n\n    // `result` now has an array of solution candidates.\n    // ... use result ...\n}\n```\n\n\u003e **Note**: The first run of GPU-enabled functions may be slower due to JIT compilation and device initialization by ArrayFire. Subsequent runs will be significantly faster.\n\n## Benchmark Functions\n\nSafire includes several standard test functions for benchmarking optimization algorithms:\n\n- **Rastrigin Function**: Non-convex function with many local minima (global minimum at x = 0)\n- **Ackley Function**: Continuous, multimodal function (global minimum at x = 0)\n- **Schwefel Function**: Complex function with many local minima (global minimum at x ≈ 420.9687)\n\n## Implementation Details\n\n### Sequential Simulated Annealing\n- Traditional implementation suitable for single-solution optimization\n- Flexible temperature scheduling\n- Customizable neighbor generation and energy functions\n- Seeded random number generation for reproducibility\n\n### Data-Parallel Simulated Annealing\n- Synchronous parallel implementation optimized for GPU execution\n- Efficient batch processing of multiple chains simultaneously\n- Configurable chain length and batch size\n- Direct GPU memory management via ArrayFire\n\n## Dependencies\n\n- [ArrayFire](https://github.com/arrayfire/arrayfire): For efficient array operations and GPU computing\n\n## License\n\nThis project is licensed under the MIT License - see the LICENSE file for details.\n\n## References\n1. Ferreiro, A.M. et al. (2012) 'An efficient implementation of parallel simulated annealing algorithm in gpus', Journal of Global Optimization, 57(3), pp. 863–890. doi:10.1007/s10898-012-9979-z.\n2. Kirkpatrick, S., Gelatt, C.D. and Vecchi, M.P. (1983) 'Optimization by simulated annealing', Science, 220(4598), pp. 671–680. doi:10.1126/science.220.4598.671.\n3. Czech, A., \u0026 Wieloch, B. (2016). Data-parallel simulated annealing using graphics processing units. Journal of Parallel and Distributed Computing.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnikhilr612%2Fsafire","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnikhilr612%2Fsafire","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnikhilr612%2Fsafire/lists"}