summaryrefslogtreecommitdiff
path: root/candle-examples/examples/reinforcement-learning/main.rs
blob: 34115b228a07cdcaee2c0370fe8f778a880f287a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#[cfg(feature = "mkl")]
extern crate intel_mkl_src;

#[cfg(feature = "accelerate")]
extern crate accelerate_src;

use candle::Result;
use clap::{Parser, Subcommand};

mod gym_env;
mod vec_gym_env;

mod ddpg;
mod dqn;
mod policy_gradient;

#[derive(Parser)]
struct Args {
    #[command(subcommand)]
    command: Command,
}

#[derive(Subcommand)]
enum Command {
    Pg,
    Ddpg,
    Dqn,
}

fn main() -> Result<()> {
    let args = Args::parse();
    match args.command {
        Command::Pg => policy_gradient::run()?,
        Command::Ddpg => ddpg::run()?,
        Command::Dqn => dqn::run()?,
    }
    Ok(())
}