🚀 🤖
Rust-AB An Agent-Based Simulation engine written in Rust
(parallel and visualization features are excluded)
Rust-AB is a discrete events simulation engine for developing ABM simulation that is written in Rust language.
Rust-AB is designed to be a ready-to-use tool for the ABM community and for this reason the architectural concepts of the well-adopted MASON library were re-engineered to exploit the Rust peculiarities and programming model.
Examples
All the examples are hosted in a separate repository here.
Usage
Add this to your Cargo.toml
:
[dependencies]
rust-ab = { git="https://github.com/rust-ab/rust-ab.git" }
To get started using Rust-AB, see the examples. There's also a template to set up the correct project structure and the required files here.
Parallel execution
Parallel execution can be achieved by passing the parallel
feature when running a simulation and specifying the number of threads to use:
cargo run --release --features parallel -- --nt 4
-- --nt X
whereX
is the number of threads used by the parallel execution.
Model Visualization with Bevy Game Engine
Rust-AB exploits the Bevy Game Engine to support model visualization.
cargo run --release --example --features="visualization"
Visualization FAQs
In case you have troubles compiling your visualization, consult this following list of common errors first before making an issue:
- Wasm related errors due to
bevy_log
: run this command to force thetracing-wasm
dependency to 0.2.0:
cargo update -p tracing-wasm --precise 0.2.0
- "Data remaining" issue or "len is 0 but index is 0" when running a simulation on the web: Force update your wasm-bindgen-cli local installation to version 0.2.79.
- Out of memory error when running a simulation on the web, in chrome: run your simulation with the release profile.
Dependencies
The visualization framework requires certain dependencies to run the simulation properly.
🖥️ Windows: VS2019 build tools🍎 MacOS: No dependencies needed.🐧 Linux: A few dependencies are needed. Check here for a list based on your distribution.
Contributing FAQ
Support conference paper
If you find this code useful in your research, please consider citing:
@ARTICLE{AntelmiASIASIM2019,
author={Antelmi, A. and Cordasco, G. and D’Auria, M. and De Vinco, D. and Negro, A. and Spagnuolo, C.},
title={On Evaluating Rust as a Programming Language for the Future of Massive Agent-Based Simulations},
journal={Communications in Computer and Information Science},
note={Conference of 19th Asia Simulation Conference, AsiaSim 2019 ; Conference Date: 30 October 2019 Through 1 November 2019; Conference Code:233729},
year={2019},
volume={1094},
pages={15-28},
doi={10.1007/978-981-15-1078-6_2},
issn={18650929},
isbn={9789811510779},
}
License
The MIT License
Copyright (c) ISISLab, Università degli Studi di Salerno 2019.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.