use crate::genetic::Genotype;
use std::fmt::Debug;
pub trait BinaryEncoded {}
pub trait ValueEncoded {}
pub trait PermutationEncoded {}
pub trait TreeEncoded: Genotype {}
impl<V> Genotype for Vec<V>
where
V: Clone + Debug + PartialEq + Send + Sync,
{
type Dna = V;
}
impl BinaryEncoded for Vec<bool> {}
impl<V> ValueEncoded for Vec<V> {}
impl<V> PermutationEncoded for Vec<V> {}
#[cfg(feature = "fixedbitset")]
mod fixedbitset_genotype {
use super::{BinaryEncoded, Genotype};
use fixedbitset::FixedBitSet;
impl Genotype for FixedBitSet {
type Dna = bool;
}
impl BinaryEncoded for FixedBitSet {}
}
#[cfg(feature = "smallvec")]
mod smallvec_genotype {
use super::{BinaryEncoded, Genotype, PermutationEncoded, ValueEncoded};
use smallvec::{Array, SmallVec};
use std::fmt::Debug;
impl<A, V> Genotype for SmallVec<A>
where
A: Array<Item = V> + Sync,
V: Clone + Debug + PartialEq + Send + Sync,
{
type Dna = V;
}
impl<A> BinaryEncoded for SmallVec<A> where A: Array<Item = bool> {}
impl<A> ValueEncoded for SmallVec<A> where A: Array {}
impl<A> PermutationEncoded for SmallVec<A> where A: Array {}
}