pub struct AdaptiveResourceAllocator { /* private fields */ }Expand description
Adaptive resource allocator
Implementations§
Source§impl AdaptiveResourceAllocator
impl AdaptiveResourceAllocator
pub fn new( strategy: AllocationStrategy, total_budget: f64, min_allocation: f64, max_allocation: f64, random_state: Option<u64>, ) -> Self
Sourcepub fn add_configuration(&mut self, config: ResourceConfiguration)
pub fn add_configuration(&mut self, config: ResourceConfiguration)
Add a new configuration to evaluate
Sourcepub fn allocate_resources(&mut self) -> Vec<(String, f64)>
pub fn allocate_resources(&mut self) -> Vec<(String, f64)>
Get next resource allocations for all active configurations
Sourcepub fn update_configuration(
&mut self,
config_id: &str,
score: f64,
resources_used: f64,
) -> Result<()>
pub fn update_configuration( &mut self, config_id: &str, score: f64, resources_used: f64, ) -> Result<()>
Update configuration with evaluation result
Sourcepub fn prune_configurations(
&mut self,
min_evaluations: usize,
percentile_threshold: f64,
)
pub fn prune_configurations( &mut self, min_evaluations: usize, percentile_threshold: f64, )
Deactivate underperforming configurations
Sourcepub fn get_statistics(&self) -> AllocationStatistics
pub fn get_statistics(&self) -> AllocationStatistics
Get current statistics
Sourcepub fn active_configurations(&self) -> Vec<&ResourceConfiguration>
pub fn active_configurations(&self) -> Vec<&ResourceConfiguration>
Get active configurations
Sourcepub fn best_configuration(&self) -> Option<&ResourceConfiguration>
pub fn best_configuration(&self) -> Option<&ResourceConfiguration>
Get best configuration so far
Auto Trait Implementations§
impl Freeze for AdaptiveResourceAllocator
impl RefUnwindSafe for AdaptiveResourceAllocator
impl Send for AdaptiveResourceAllocator
impl Sync for AdaptiveResourceAllocator
impl Unpin for AdaptiveResourceAllocator
impl UnwindSafe for AdaptiveResourceAllocator
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