Files
foxhunt/crates/ml/tests/ppo_continuous_bounds_test.rs
jgrusewski 9c3d741a08 refactor: restructure repo — crates/, bin/, testing/ layout
Move 17 library crates into crates/, CLI binary into bin/fxt,
consolidate 10 test crates into testing/, split config crate
from deployment config files.

Root directory reduced from 38+ to ~17 directories.
All Cargo.toml paths and build.rs proto refs updated.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 11:56:00 +01:00

37 lines
1.0 KiB
Rust

use ml::hyperopt::adapters::ppo::PPOParams;
use ml::hyperopt::traits::ParameterSpace;
#[test]
fn test_continuous_bounds_returns_6_parameters() {
let bounds = PPOParams::continuous_bounds();
assert_eq!(bounds.len(), 6, "Should have 6 parameter bounds");
}
#[test]
fn test_minibatch_size_bounds_correct() {
let bounds = PPOParams::continuous_bounds();
let minibatch_bounds = bounds[5]; // 6th parameter
assert_eq!(minibatch_bounds.0, 64.0);
assert_eq!(minibatch_bounds.1, 230.0);
}
#[test]
fn test_all_bounds_valid() {
let bounds = PPOParams::continuous_bounds();
for (i, (min, max)) in bounds.iter().enumerate() {
assert!(min < max, "Parameter {} has invalid bounds", i);
}
}
#[test]
fn test_lr_bounds_match_dqn_insights() {
let bounds = PPOParams::continuous_bounds();
// Policy LR upper bound should be 5e-5 (ln = -9.903)
assert!((bounds[0].1 - 5e-5_f64.ln()).abs() < 1e-6);
// Value LR upper bound should be 5e-3 (ln = -5.298)
assert!((bounds[1].1 - 5e-3_f64.ln()).abs() < 1e-6);
}