Trait bourse_de::agents::Agent

source ·
pub trait Agent {
    // Required method
    fn update<R: RngCore>(&mut self, env: &mut Env, rng: &mut R);
}
Expand description

Homogeneous agent set functionality

A set of agents that implement this trait can then be included in a struct using the Agents macro to combine multiple agent types.

§Examples

use bourse_de::Env;
use bourse_de::agents::{Agent, Agents, AgentSet};
use rand::RngCore;

struct AgentType{}

impl Agent for AgentType {
    fn update<R: RngCore>(
        &mut self, env: &mut Env, _rng: &mut R
    ) {}
}

#[derive(Agents)]
struct MixedAgents {
    a: AgentType, b: AgentType
}

Required Methods§

source

fn update<R: RngCore>(&mut self, env: &mut Env, rng: &mut R)

Update the state of the agent(s)

§Argument
  • env - Reference to a Env simulation environment
  • rng - Random generator

Object Safety§

This trait is not object safe.

Implementors§