From 744a70cf1d8ce324bee423336be6338aab0bf46c Mon Sep 17 00:00:00 2001 From: Henri Bourcereau Date: Sun, 3 Aug 2025 20:32:06 +0200 Subject: [PATCH] bot train graph --- bot/src/dqn/burnrl/environment.rs | 2 +- bot/src/dqn/burnrl/main.rs | 2 +- justfile | 8 +++++--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/bot/src/dqn/burnrl/environment.rs b/bot/src/dqn/burnrl/environment.rs index dd75b73..5716fa1 100644 --- a/bot/src/dqn/burnrl/environment.rs +++ b/bot/src/dqn/burnrl/environment.rs @@ -91,7 +91,7 @@ impl Environment for TrictracEnvironment { type ActionType = TrictracAction; type RewardType = f32; - const MAX_STEPS: usize = 1000; // Limite max pour éviter les parties infinies + const MAX_STEPS: usize = 700; // Limite max pour éviter les parties infinies fn new(visualized: bool) -> Self { let mut game = GameState::new(false); diff --git a/bot/src/dqn/burnrl/main.rs b/bot/src/dqn/burnrl/main.rs index e7f9722..9a3a16f 100644 --- a/bot/src/dqn/burnrl/main.rs +++ b/bot/src/dqn/burnrl/main.rs @@ -9,7 +9,7 @@ type Backend = Autodiff>; type Env = environment::TrictracEnvironment; fn main() { - println!("> Entraînement"); + // println!("> Entraînement"); let conf = dqn_model::DqnConfig { num_episodes: 40, // memory_size: 8192, // must be set in dqn_model.rs with the MEMORY_SIZE constant diff --git a/justfile b/justfile index c2d85a8..d4f14c4 100644 --- a/justfile +++ b/justfile @@ -24,10 +24,12 @@ pythonlib: trainbot: #python ./store/python/trainModel.py # cargo run --bin=train_dqn # ok - cargo build --release --bin=train_dqn_burn - #LD_LIBRARY_PATH=./target/release ./target/release/train_dqn_burn - LD_LIBRARY_PATH=./target/release ./target/release/train_dqn_burn | tee >&2 | sed s/,//g | awk '{print $4}' | feedgnuplot --lines --points --unset grid # cargo run --bin=train_dqn_burn # utilise debug (why ?) + cargo build --release --bin=train_dqn_burn + LD_LIBRARY_PATH=./target/release ./target/release/train_dqn_burn | tee /tmp/train.out +plottrainbot: + cat /tmp/train.out | awk -F '[ ,]' '{print $5}' | feedgnuplot --lines --points --unset grid + #tail -f /tmp/train.out | awk -F '[ ,]' '{print $5}' | feedgnuplot --lines --points --unset grid debugtrainbot: cargo build --bin=train_dqn_burn RUST_BACKTRACE=1 LD_LIBRARY_PATH=./target/debug ./target/debug/train_dqn_burn