pub struct Cohort<S = Ackley, A = Agent<S>, T = Team<S, A>>{ /* private fields */ }
Expand description
This is the Cohort class, a container for multiple teams
The cohort allows you to run a set of teams easily to achieve statistical significance:
use cisat::{Parameters, Cohort, problems::Ackley};
let mut x = Cohort::<Ackley>::new(Parameters::default());
x.solve();
Above, we specify one generic parameters Ackley
, which tells the Cohort
which problem to solve.
However, we can get more complciated than that! For instance, we feed in a struct that implements
AgentMethods
to specific which type of agent to use:
use cisat::{Parameters, Cohort, problems::Ackley, Agent};
let mut x = Cohort::<Ackley, Agent<Ackley>>::new(Parameters::default());
x.solve();
Here, we just fed in the in-build Agent
class which already implements AgentMethods
. You can
implement the trait yourself to define a new agent though. The same applies for ‘Team’ and
‘TeamMethods’:
use cisat::{Parameters, Cohort, problems::Ackley, Agent, Team};
let mut x = Cohort::<Ackley, Agent<Ackley>, Team<Ackley, Agent<Ackley>>>::new(Parameters::default());
x.solve();
Implementations§
Source§impl<S, A, T> Cohort<S, A, T>
impl<S, A, T> Cohort<S, A, T>
Sourcepub fn new(parameters: Parameters) -> Cohort<S, A, T>
pub fn new(parameters: Parameters) -> Cohort<S, A, T>
This generates a new cohort
Examples found in repository?
More examples
Sourcepub fn solve(&mut self)
pub fn solve(&mut self)
This runs the cohort using parallelism
Examples found in repository?
More examples
Sourcepub fn get_best_solution_so_far(&mut self) -> f64
pub fn get_best_solution_so_far(&mut self) -> f64
Get the current best solution
Trait Implementations§
Auto Trait Implementations§
impl<S, A, T> Freeze for Cohort<S, A, T>
impl<S, A, T> RefUnwindSafe for Cohort<S, A, T>
impl<S, A, T> Send for Cohort<S, A, T>
impl<S, A, T> Sync for Cohort<S, A, T>
impl<S, A, T> Unpin for Cohort<S, A, T>
impl<S, A, T> UnwindSafe for Cohort<S, A, T>
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