use async_trait::async_trait;
use serde::{Deserialize, Serialize};
pub trait Genome: Clone + Send + Sync {}
#[async_trait]
pub trait FitnessFunction<G: Genome>: Send + Sync {
async fn fitness(&self, genome: &G) -> f64;
}
#[async_trait]
pub trait AsyncFitnessFunction<G: Genome>: Send + Sync {
async fn fitness(&self, genome: &G) -> f64;
}
#[derive(Debug, Clone)]
pub struct GeneticParameters;
#[derive(Debug, Clone)]
pub enum SelectionMethod {
Tournament,
Roulette,
}
pub trait GeneticConstraint<G: Genome>: Send + Sync {
fn is_valid(&self, genome: &G) -> bool;
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct GeneticSolution<G: Genome> {
pub genome: G,
pub fitness: f64,
}
#[derive(Debug, Clone)]
pub struct AsyncGeneticEngine<G: Genome> {
_phantom: std::marker::PhantomData<G>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct TextGenome {
pub text: String,
}