#game-theory #player #model #game #theory

amfiteatr_rl

Extensions providing reinforcement learning implementations for amfiteatr

9 releases (breaking)

Uses new Rust 2024

new 0.7.0 Mar 24, 2025
0.6.0 Feb 20, 2025
0.5.0 Apr 9, 2024
0.4.1 Apr 2, 2024
0.1.0 Jan 15, 2024

#24 in Simulation

Download history 5/week @ 2024-12-04 15/week @ 2024-12-11 137/week @ 2025-02-19 29/week @ 2025-02-26 1/week @ 2025-03-05 97/week @ 2025-03-19

131 downloads per month
Used in 3 crates

Custom license

440KB
7K SLoC

AmfiRL

Framework library for reinforcement learning using data model from amfi crate. Crate contains traits and generic implementation.

Torch dependency

This crate depends on tch which requires that you have Torch installed. Use guide provided by that crate.

For me the procedure looks like this:

  1. Unpacking compiled torchlib for C++/Java; You will get structure like this:
/path/to/libtorch
                | -- bin
                | -- include
                | -- lib
                | ...
  1. Set your environment variables:
export LIBTORCH=/path/to/torch
export LD_LIBRARY_PATH=/path/to/libtorch/lib

CUDA support

This crate tries to support CUDA backed tensor operations. It might be necessary to add following code in build.rs script in your crate:

fn main() {
    let os = std::env::var("CARGO_CFG_TARGET_OS").expect("Unable to get TARGET_OS");
    match os.as_str() {
        "linux" | "windows" => {
            if let Some(lib_path) = std::env::var_os("DEP_TCH_LIBTORCH_LIB") {
                println!("cargo:rustc-link-arg=-Wl,-rpath={}", lib_path.to_string_lossy());
            }
            println!("cargo:rustc-link-arg=-Wl,--no-as-needed");
            println!("cargo:rustc-link-arg=-Wl,--copy-dt-needed-entries");
            println!("cargo:rustc-link-arg=-ltorch");
        }
        _ => {}
    }
}

It solved CUDA backend problem for me link to source.

Examples

Examples are presented in separate crate - amfiteatr_examples

Licence: MIT

Dependencies

~16MB
~314K SLoC