pub trait OptimizationStrategy: Send + Sync {
// Required methods
fn name(&self) -> &str;
fn priority(&self) -> u32;
fn is_applicable(&self, input: &DecisionInput) -> bool;
fn evaluate<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
input: &'life1 DecisionInput,
criteria: &'life2 DecisionCriteria,
) -> Pin<Box<dyn Future<Output = DecisionResult<Vec<Decision>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn validate<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
decision: &'life1 Decision,
criteria: &'life2 DecisionCriteria,
) -> Pin<Box<dyn Future<Output = DecisionResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn learn<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
decision: &'life1 Decision,
outcome: &'life2 DecisionOutcome,
) -> Pin<Box<dyn Future<Output = DecisionResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn get_stats(&self) -> Value;
}Expand description
Trait for optimization strategies
Required Methods§
Sourcefn is_applicable(&self, input: &DecisionInput) -> bool
fn is_applicable(&self, input: &DecisionInput) -> bool
Check if this strategy is applicable to the given input
Sourcefn evaluate<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
input: &'life1 DecisionInput,
criteria: &'life2 DecisionCriteria,
) -> Pin<Box<dyn Future<Output = DecisionResult<Vec<Decision>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn evaluate<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
input: &'life1 DecisionInput,
criteria: &'life2 DecisionCriteria,
) -> Pin<Box<dyn Future<Output = DecisionResult<Vec<Decision>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Sourcefn validate<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
decision: &'life1 Decision,
criteria: &'life2 DecisionCriteria,
) -> Pin<Box<dyn Future<Output = DecisionResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn validate<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
decision: &'life1 Decision,
criteria: &'life2 DecisionCriteria,
) -> Pin<Box<dyn Future<Output = DecisionResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Sourcefn learn<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
decision: &'life1 Decision,
outcome: &'life2 DecisionOutcome,
) -> Pin<Box<dyn Future<Output = DecisionResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn learn<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
decision: &'life1 Decision,
outcome: &'life2 DecisionOutcome,
) -> Pin<Box<dyn Future<Output = DecisionResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Learn from a decision outcome
§Arguments
decision- The original decisionoutcome- The outcome that was observed
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".