From f68e9577d699ddab11359851b946295643725def Mon Sep 17 00:00:00 2001 From: Rowan Torbitzky-Lane Date: Tue, 29 Apr 2025 01:41:38 -0500 Subject: [PATCH] start on random instruction --- src/gp/utils.rs | 17 +++++++++++++++++ src/gp/variation.rs | 4 ++++ 2 files changed, 21 insertions(+) diff --git a/src/gp/utils.rs b/src/gp/utils.rs index 3b609eb..e497d32 100644 --- a/src/gp/utils.rs +++ b/src/gp/utils.rs @@ -1,6 +1,23 @@ +use crate::gp::args::ClosingType; +use crate::push::state::Gene; use rand::Rng; +use rand::seq::IndexedRandom; use rust_decimal::prelude::*; +pub fn random_instruction( + instructions: Vec, + closing_type: ClosingType, + rng: &mut impl Rng, +) -> Gene { + match closing_type { + ClosingType::Specified => return instructions.choose(rng).unwrap().clone(), + ClosingType::Balanced => { + let + } + _ => todo!(), + } +} + pub fn gaussian_noise_factor(rng: &mut impl Rng) -> Decimal { let u0f64: f64 = rng.random(); let u1f64: f64 = rng.random(); diff --git a/src/gp/variation.rs b/src/gp/variation.rs index fa3392e..c36c02b 100644 --- a/src/gp/variation.rs +++ b/src/gp/variation.rs @@ -125,6 +125,10 @@ fn alternation( } } +fn uniform_addition(plushy: Vec, instructions: Vec, umad_rate: Decimal) { + let mut new_plushy: Vec = vec![]; +} + #[cfg(test)] mod tests { use super::*;