This commit is contained in:
parent
d51035270d
commit
f68e9577d6
@ -1,6 +1,23 @@
|
|||||||
|
use crate::gp::args::ClosingType;
|
||||||
|
use crate::push::state::Gene;
|
||||||
use rand::Rng;
|
use rand::Rng;
|
||||||
|
use rand::seq::IndexedRandom;
|
||||||
use rust_decimal::prelude::*;
|
use rust_decimal::prelude::*;
|
||||||
|
|
||||||
|
pub fn random_instruction(
|
||||||
|
instructions: Vec<Gene>,
|
||||||
|
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 {
|
pub fn gaussian_noise_factor(rng: &mut impl Rng) -> Decimal {
|
||||||
let u0f64: f64 = rng.random();
|
let u0f64: f64 = rng.random();
|
||||||
let u1f64: f64 = rng.random();
|
let u1f64: f64 = rng.random();
|
||||||
|
@ -125,6 +125,10 @@ fn alternation(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn uniform_addition(plushy: Vec<Gene>, instructions: Vec<Gene>, umad_rate: Decimal) {
|
||||||
|
let mut new_plushy: Vec<Gene> = vec![];
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user