pub struct Crowd {
pub characters: Vec<CrowdCharacter>,
pub config: CrowdConfig,
}Expand description
The generated crowd of CrowdCharacter instances.
Fields§
§characters: Vec<CrowdCharacter>All characters in generation order.
config: CrowdConfigThe config that produced this crowd.
Implementations§
Source§impl Crowd
impl Crowd
Sourcepub fn get(&self, id: usize) -> Option<&CrowdCharacter>
pub fn get(&self, id: usize) -> Option<&CrowdCharacter>
Look up a character by id.
Sourcepub fn mean_params(&self) -> HashMap<String, f32>
pub fn mean_params(&self) -> HashMap<String, f32>
Compute the mean value of each parameter across the crowd.
Sourcepub fn std_params(&self) -> HashMap<String, f32>
pub fn std_params(&self) -> HashMap<String, f32>
Compute the standard deviation of each parameter across the crowd.
Sourcepub fn diversity_score(&self) -> f32
pub fn diversity_score(&self) -> f32
Mean pairwise parameter distance (diversity score).
Sourcepub fn by_class(&self, class: &VariationClass) -> Vec<&CrowdCharacter>
pub fn by_class(&self, class: &VariationClass) -> Vec<&CrowdCharacter>
Return all characters that belong to the given VariationClass.
Sourcepub fn class_distribution(&self) -> HashMap<VariationClass, usize>
pub fn class_distribution(&self) -> HashMap<VariationClass, usize>
Count characters per variation class.
Sourcepub fn sorted_by(&self, param: &str) -> Vec<&CrowdCharacter>
pub fn sorted_by(&self, param: &str) -> Vec<&CrowdCharacter>
Return references to characters sorted in ascending order by param.
Characters missing the requested parameter are placed at the end.
Auto Trait Implementations§
impl Freeze for Crowd
impl RefUnwindSafe for Crowd
impl Send for Crowd
impl Sync for Crowd
impl Unpin for Crowd
impl UnsafeUnpin for Crowd
impl UnwindSafe for Crowd
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more