rurel
Library Listed Dormant
Flexible, reusable reinforcement learning (Q learning) implementation
- Downloads
- 150
- Dependents
- 0
- Stars
- 165
- Forks
- 19
- Contributors
- 8
- Commits
- 59
- Latest release
- 0.6.0 ·
About
Rurel is a flexible, reusable reinforcement learning (Q learning) implementation in Rust.
In Cargo.toml:
rurel = "0.6.0"
An example is included. This teaches an agent on a 21x21 grid how to arrive at 10,10, using actions (go left, go up, go right, go down):
cargo run --example eucdist
Getting started
There are two main traits you need to implement: rurel::mdp::State and rurel::mdp::Agent.
A State is something which defines a Vec of actions that can be taken from this state, and has a certain reward. A State needs to define the corresponding action type A.
An Agent is something which has a current state, and given an action, can take the action and evaluate the next state.
Example
Let's implement the example in cargo run --example eucdist. We want to make an agent which is taught how to arrive at 10,10 on a 21x21 grid.
First, let's define a State, which should represent a position on a 21x21, and the correspoding Action, which is either up, down, left or right.
Read the full README
use rurel::mdp::State;
#[derive(PartialEq, Eq, Hash, Clone)]
struct MyState { x: i32, y: i32 }
#[derive(PartialEq, Eq, Hash, Clone)]
struct MyAction { dx: i32, dy: i32 }
impl State for MyState {
type A = MyAction;
fn reward(&self) -> f64 {
// Negative Euclidean distance
-((((10 - self.x).pow(2) + (10 - self.y).pow(2)) as f64).sqrt())
}
fn actions(&self) -> Vec<MyAction> {
vec![MyAction { dx: 0, dy: -1 }, // up
MyAction { dx: 0, dy: 1 }, // down
MyAction { dx: -1, dy: 0 }, // left
MyAction { dx: 1, dy: 0 }, // right
]
}
}
Then define the agent:
use rurel::mdp::Agent;
struct MyAgent { state: MyState }
impl Agent<MyState> for MyAgent {
fn current_state(&self) -> &MyState {
&self.state
}
fn take_action(&mut self, action: &MyAction) -> () {
match action {
&MyAction { dx, dy } => {
self.state = MyState {
x: (((self.state.x + dx) % 21) + 21) % 21, // (x+dx) mod 21
y: (((self.state.y + dy) % 21) + 21) % 21, // (y+dy) mod 21
}
}
}
}
}
That's all. Now make a trainer and train the agent with Q learning, with learning rate 0.2, discount factor 0.01 and an initial value of Q of 2.0. We let the trainer run for 100000 iterations, randomly exploring new states.
use rurel::AgentTrainer;
use rurel::strategy::learn::QLearning;
use rurel::strategy::explore::RandomExploration;
use rurel::strategy::terminate::FixedIterations;
let mut trainer = AgentTrainer::new();
let mut agent = MyAgent { state: MyState { x: 0, y: 0 }};
trainer.train(&mut agent,
&QLearning::new(0.2, 0.01, 2.),
&mut FixedIterations::new(100000),
&RandomExploration::new());
After this, you can query the learned value (Q) for a certain action in a certain state by:
trainer.expected_value(&state, &action) // : Option<f64>
Development
- Run
cargo fmt --allto format the code. - Run
cargo clippy --all-targets --all-features -- -Dwarningsto lint the code. - Run
cargo testto test the code.
Compatibility
- Runs on
- GPU support unknown
What shows it
- no dependency or feature matches a backend row
- Native code
- None found
- No native code found
- Python bindings
- No Python binding crate found
- License
- MPL-2.0
Compare with similar projects
Order: strongest tier first, then most downloads, then name, with unmeasured values last. A library counts downloads over 30 days. An app counts binary downloads per release. An app with none counts its crate downloads over 30 days. ML Rust runs this catalogue, so its closest project always gets a row.
| Project | Downloads | Dependents | Stars | Latest release | Runs on (GPU) | Native code | License |
|---|---|---|---|---|---|---|---|
|
Flexible, reusable reinforcement learning (Q learning) implementation |
150 downloads over 30 days | 0 | 165 | 0.6.0 | GPU support unknown | No native code found | MPL-2.0 |
|
A fast, extensible reinforcement learning framework in Rust |
80 downloads over 30 days | 0 | 204 | 0.8.1 | GPU support unknown | Binds native code: lapack-sys | MIT |
|
Open AI environments bindings for Rust |
75 downloads over 30 days | 2 | 70 | 2.2.1 | GPU support unknown | No native code found | Apache-2.0 OR MIT |
|
bevy_rl Listed
Build environments for reinforcement learning with bevy |
33 downloads over 30 days | 1 | 104 | 0.17.0 | WebGPU | No native code found | Apache-2.0 OR MIT |
|
Trains GPT-style language models from a YAML config and a tokenized dataset: dense GQA transformers, Mamba 1, 2 and 3, MLA and MoE layers on CPU or CUDA. Runs the training loop, optimizer, checkpoints, evaluation and metrics on boostr, and builds speech corpora through voxr. |
27 downloads over 30 days | Not applicable | 8 | 0.1.1 | CUDA | Binds native code: nvml-wrapper-sys (feature cuda) | Apache-2.0 |
|
Rust implementation of real-coded genetic algorithm for solving optimization problems and training of neural networks. The latter is also known as neuroevolution. |
9 downloads over 30 days | 0 | 20 | 0.2.1 | GPU support unknown | No native code found | GPL-3.0 |
|
Reinforcement learning library written in Rust |
Not measured | Not applicable | 24 | Not measured | Not measured | Not measured | None stated |
Why ListedNo archive, New or Featured rule places it, so it is Listed.
What it lacks for Featured
- It has 0 active dependents and 0 new dependents in 365 days. Featured needs 11 active dependents or 9 new dependents in 365 days. The repository route reads 165 stars, 19 forks and 8 contributors. It needs 4,539 stars, 434 forks and 79 contributors together.
- The project is dormant and not finished. Dormancy rule
What else the check found
- The last activity is on 25 Jun 2024, 867 days ago. That reaches the 365 days the rules expect, so the project is dormant. Dormancy rule
- The oldest outside issue waits 1203 days for a reply, past the limit of 270. No maintainer replied in 365 days. Rot signals rule
Not measured: Latest release fails cargo check.
Exact rules: Listed, Featured library. The check on applied thresholds version 9.
Every rule outcome, as the check records it
expected-interval: version 0.6.0 base 140, raised to the 365-day floor: E = 365 daysdormancy: last activity 2024-06-25, 867 days ago, E = 365: dormantrot: oldest unanswered issue 1203 days (limit 270), no maintainer reply in 365 daysfeatured: not featured: active_users 0 < 11 and new_adopters 0 < 9 and repository route stars 165 (needs 4539), forks 19 (needs 434), contributors 8 (needs 79); dormant and not stablelisted: listed: no archive, new or featured rule applies
Measurements and sources
Each signal row shows the raw value, its source and the fetch date. The Sources list gathers every distinct source on this page. Movement needs more history.
Sources6 sources
- Description: the crates.io description
- crates.io database dump, fetched
- RustSec advisory database, fetched
- GitHub repository, fetched
- crates.io package, fetched
- GitHub contributors, fetched
Adoption0 active dependents, 0 new dependents in 365 days1 not measured
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| Active dependents | 0 | crates.io database dump | Yes | |
| New dependents (365 days) | 0 | crates.io database dump | Yes | |
| Peak active dependents | 0 | crates.io database dump | Yes | |
| Active dependents as a share of the peak | 1 | crates.io database dump | Yes | |
| Binary downloads per release | Not measured | Yes |
MaintenanceLatest human commit: 2 years ago3 not measured
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| Latest human commit | 2024-06-25 | GitHub repository | Yes | |
| Latest release | 2024-06-25 | crates.io database dump | Yes | |
| First release | 2017-03-05 | crates.io database dump | Yes | |
| Latest version | 0.6.0 | crates.io database dump | Yes | |
| Days the oldest outside issue waits for a reply | 1203 | GitHub repository | Yes | |
| Maintainer replies over 365 days | 0 | GitHub repository | Yes | |
| Repository archived | false | GitHub repository | Yes | |
| Repository gone | false | GitHub repository | Yes | |
| Release commit or manifest in the repo | true | crates.io package | Yes | |
| Published docs | true | crates.io database dump | Yes | |
| Latest release fails cargo check | Not measured | Yes | ||
| Build check date | Not measured | Yes | ||
| Build check toolchain | Not measured | Yes |
SecurityUnpatched vulnerabilities: none
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| Unpatched vulnerabilities past the grace window | none | RustSec advisory database | Yes | |
| RustSec unmaintained advisory | none | RustSec advisory database | Yes | |
| Deprecation notice | none | crates.io database dump | Yes | |
| Deprecated requirement | none | crates.io database dump | Yes |
Distribution11 releases, 150 downloads over 30 days5 not measured
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| Releases | 11 | crates.io database dump | Yes | |
| Downloads over 30 days | 150 | crates.io database dump | Yes | |
| Binary downloads over the last 3 releases | Not measured | Yes | ||
| Homebrew installs on request over 365 days | Not measured | Yes | ||
| Repology repository families | Not measured | Yes | ||
| Docker pull growth over 90 days | Not measured | Yes | ||
| Docker pulls at the growth baseline | Not measured | Yes | ||
| Every version a prerelease | false | crates.io database dump | Yes | |
| Every version 0.0.x | false | crates.io database dump | Yes | |
| Every version yanked | false | crates.io database dump | Yes | |
| Crate deleted from crates.io | false | crates.io database dump | Yes |
Repository165 stars, 19 forks, 8 contributors, 59 commits. Stars alone never qualify a project.
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| GitHub stars | 165 | GitHub repository | Yes — one part of the repository route | |
| GitHub forks | 19 | GitHub repository | Yes — one part of the repository route | |
| Contributors with a GitHub account | 8 | GitHub contributors | Yes — one part of the repository route | |
| Commits on the default branch | 59 | GitHub repository | No | |
| Repository's main crate left out of the entry | none | crates.io database dump | Yes |
Facts that never count
| Signal | Value | Source | Fetched | Counts |
|---|---|---|---|---|
| License | MPL-2.0 | crates.io database dump | No | |
| Runs on, from listed crates and their direct dependencies | GPU support unknown | crates.io database dump | No | |
| What shows each backend | no dependency or feature matches a backend row | crates.io database dump | No | |
| Native code, from listed crates and their dependencies | No native code found | crates.io database dump | No | |
| Python bindings, from direct dependencies of listed crates | No Python binding crate found | crates.io database dump | No | |
| Crates that depend on a listed crate directly | 0 | crates.io database dump | No |
Corrections and review history
No correction applies to this entry.
Judgments
A judgment enters only through an approved issue and a merged pull request.
No judgment applies to this entry.