Trait AgentMethods

Source
pub trait AgentMethods<S: Solution>: Send {
    // Required methods
    fn new(id: usize, parameters: Parameters) -> Self;
    fn iterate(&mut self);
    fn get_best_solution_so_far(&mut self) -> S;
    fn get_current_solution(&mut self) -> S;
    fn communicate(&mut self, solutions: Vec<S>);
}
Expand description

This is a trait for implementing new agents

Required Methods§

Source

fn new(id: usize, parameters: Parameters) -> Self

Generates a new agent

Source

fn iterate(&mut self)

Iterates on the solution

Source

fn get_best_solution_so_far(&mut self) -> S

Gets the best solution found by the agent so far

Source

fn get_current_solution(&mut self) -> S

Gets the current solution of the agent

Source

fn communicate(&mut self, solutions: Vec<S>)

Agent accepts rival solutions and interacts

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§