Skip to content

Experiment

This document describes the Experiment class, which simulates the evolution of task activities for multiple agents performing multiple tasks. The model is a nonlinear dynamical system with structured interactions and an external task cue.

------------------------------------

Experiment

Class to represent an experiment. This Experiment class models and simulates a system with interacting agents and tasks, solving a nonlinear dynamical system defined by agent behaviors, communication structure and task correlations, system parameters and external inputs. The Experiment class simulates the evolution of the task activities of the agents over time,
and is also defined by the initial state of the system and the parameters of the simulation, such as total time of the simulation and number of task switches. The class contains a solver for simulating system evolution over time.

__init__(self,
         number_of_agents=4,
         number_of_tasks=2,
         communication_graph=None,
         task_graph=None,
         alpha=0.03,
         beta=0.01,
         gamma=0.02,
         delta=0.0,
         d=0.2,
         tau=10.0,
         g=None,
         bias_value=0.1,
         initial_state=None,
         total_time=2000,
         initial_steps=0,
         reverse=False,
         number_of_switches=4,
         number_of_informed=None)

Parameters

  • number_of_agents : int, optional

    • Number of agents in the system. Must be greater than 0. Default is 4.

  • number_of_tasks : int, optional

    • Number of tasks the agents have to perform. Must be greater than 0. Default is 2.

  • communication_graph : 2D numpy array, optional

    • The graph between agents. A positive value means that the agents have a positive interaction, a negative value means that the agents have a negative interaction. A null value means that the agents can not communicate. Typically, the diagonal is 1 (intra-agent-communication).

      If None, then the default is a fully connected graph where all agents can communicate.

      The shape of the matrix is (number_of_agents, number_of_agents).

  • task_graph : 2D numpy array, optional

    • The graph between tasks. A positive value means that the tasks are positively correlated, a negative value means that the tasks are negatively correlated. A null value means that the tasks are not correlated.

      Typically, the diagonal is 1 (same-task correlation). If None, then the default is diagonal 1 (positive self correlation) and off-diagonal values are -1 (negative correlations with the other tasks).

      The shape of the matrix is (number_of_tasks, number_of_tasks).

  • alpha : float, optional

    • Parameter of the dynamical system's equations that represents the weight of the same agent- same task interactions. Must be greater than or equal to 0. Default is 0.03.

  • beta : float, optional

    • Parameter of the dynamical system's equations that represents the weight of the same agent- different task interactions. Must be greater than or equal to 0. Default is 0.01.

  • gamma : float, optional

    • Parameter of the dynamical system's equations that represents the weight of the different agent- same task interactions. Must be greater than or equal to 0. Default is 0.02.

  • delta : float, optional

    • Parameter of the dynamical system's equations that represents the weight of the different agent- different task interactions. Must be greater than or equal to 0. Default is 0.0.

  • d : float, optional

    • Parameter of the dynamical system's equations that represents the weight of the decay term.

      Must be greater than or equal to 0. Default is 0.2.

  • tau : float, optional

    • Parameter of the dynamical system's equations that represents the time constant. Must be greater than 0. Default is 10.0.

  • g : 1D numpy array, optional

    • The g vector of the dynamical system's equations, representing the gain values of the agents and regulating the slope of the saturation function. The shape of the array is (number_of_agents,).

      Default is a gaussian vector with mean 3.0 and standard deviation 1.0.

  • bias_value : float, optional

    • The bias value of the dynamical system's equations that represents the weight of the cue vector of the experiment. Must be greater than or equal to 0. Default is 0.1.

  • initial_state : 1D numpy array, optional

    • The initial state of the system, representing the task activity states at the start of the experiment. The shape of the array is (number_of_agents*number_of_tasks,).

      Default is an array of zero for all agents on all tasks.

  • total_time : int, optional

    • The total time of the simulation in time units. Must be greater than 0. Default is 2_000.

  • initial_steps : int, optional

    • The number of initial steps in the experiment, where the agents don't receive the task cue. Must be greater than or equal to 0. Must be less than total_time. Default is 0.

  • reverse : bool, optional

    • If True, the task cue vector is reversed in the experiment. Default is False.

  • number_of_switches : int, optional

    • The number of task switches in the experiment. Must be greater than or equal to 0. Must be less than or equal to total_time. Must be greater than or equal to 0. Default is 4.

  • number_of_informed : int, optional

    • The number of agents that are informed in the experiment (agents that receive the task cue vector). Must be less than or equal to number_of_agents and non-negative.

      Default is number_of_agents.

solve(self,
      **kwargs)

Solve the dynamical system defined by the experiment's parameters and initial state. The system is solved using the scipy solve_ivp function. The system is solved for the total time of the experiment, with a maximum step of 1_000 and using the Radau integration method. The system is solved for each time unit, and the task activity states of the agents are returned over time in the experiment.

Parameters

  • kwargs** : optional

    • Additional keyword arguments to pass to the solve_ivp function.

Return

  • zs.y : 2D numpy array

    • The task activity states of the agents over time in the experiment.

      The shape of the array is (number_of_agents*number_of_tasks, total_time).