kernel package¶
Submodules¶
kernel.actions module¶
Definition of the class ActionSet
kernel.agentCreation module¶
Agent Creation
The agents are created using dependency injection The definitions of the agents that will be used in the simulation are in the yaml file
kernel.basicAgents module¶
Definition of the class Agent
-
class
kernel.basicAgents.Agent(simulation, model, agent_number, agent_def)[source]¶ Bases:
objectThis is the basic agent class
-
class
kernel.basicAgents.DiscreteEventAgent(simulation, model, agent_number, agent_def)[source]¶ Bases:
kernel.basicAgents.Agent
-
class
kernel.basicAgents.EventAgent(simulation, model, agent_number, agent_def)[source]¶ Bases:
kernel.basicAgents.Agent
kernel.basicObservers module¶
Definition of the class Observer
-
class
kernel.basicObservers.Observer(name, model, simulation, entity_class, agent_vars, path_to_results)[source]¶ Bases:
objectThe observer classs - This class observe the agents and collects data
-
add_observables_keys()[source]¶ Add general observable variables from the agent (model, simulation, scenario, run, step, time, agent_name)
-
create_observables()[source]¶ Create the dictionary of observable variables (for the observation file)
-
define_observable_entity(entity_class)[source]¶ Defines the type of agent that will be observed by this observer
-
kernel.basicScenarios module¶
Definition of the class Scenario
-
class
kernel.basicScenarios.AgentVar(name, var_type, var_dist, value)[source]¶ Bases:
objectAn agent var
-
class
kernel.basicScenarios.Scenario(simulation, model, name, parameters, variables, agents_init)[source]¶ Bases:
object- Class that contains
- the definitions of a scenario
-
execute_scenario()[source]¶ Execute the scenario The simulation executes an pre-scenario and a post-scenario for each scenario
-
initialize_agents_vars()[source]¶ The scenario object initializes the variables dict from the yaml agent variables definition (for each scenario)
-
initialize_parameters()[source]¶ Initialize the scenario parameters The parameters (names and values) come from scenario yaml definition
kernel.basicSchedule module¶
Definition of the class Schedule
-
class
kernel.basicSchedule.EventSchedule(name, model)[source]¶ Bases:
kernel.basicSchedule.ScheduleAn Event Schedule
-
class
kernel.basicSchedule.MixedSchedule(name, model)[source]¶ Bases:
kernel.basicSchedule.ScheduleA mixed schedule for random execution
-
class
kernel.basicSchedule.PoolSchedule(name, model)[source]¶ Bases:
kernel.basicSchedule.ScheduleA pool schedule
kernel.basicSpaces module¶
The space class and the associated classes
kernel.decision_mechanism module¶
Definition of the class Decision_Mechanism
kernel.ecos_p_config module¶
kernel.event module¶
Definition of the class Event
kernel.main module¶
Model Creation
This method reads a json file, creates de Simulation object The simulation object has all classes and specifications to execute de simulation The agents, schedule, spaces, observers, scenarios, initial values (for the scenarios) are all defined in the yaml file After the simulation object is created, the simulation is executed (all scenarios, and all runs in each scenario) The results of the scenarios are writen in files in the folder runs
-
kernel.main.execute_simulation(path_to_model, model_config, simulation_defs)[source]¶ This is the main simulation method without a graphical interface. This method receives 3 parameters: path_to_model - The path to the model that is executing model_config - The configuration file for the model that is executing simulation_defs - The model and simulation definition file
kernel.memory module¶
Definition of the class Memory
kernel.model module¶
Definition of the class Model
This class receives a json file with the definition of the simulation scenario and then creates the simulation with all simulation objects
-
class
kernel.model.Model(simulation, json_simulation_defs, path_to_results)[source]¶ Bases:
objectModel Basic Class Receives the json file name and read it Creates all objects in the Simulation
-
agents_by_type()[source]¶ Returns a dict with all agents in the simulation ordered by type (agent specific class)
-
create_observers(path_to_results)[source]¶ Access the ObserverFactory (ObserverCreator). Create the Observers
-
create_schedule(schedule_def)[source]¶ Creates the model schedule using the json schedule definition
-
kernel.observerCreation module¶
Definition of the class Observer Inspired on datacollection.py from mesa abm https://mesa.readthedocs.io/en/master/
kernel.scenarioCreation module¶
Scenario Creation
The Scenarios are created using dependency injection The definition of the Scenarios that will be used in the simulation are in the yaml file
kernel.scheduleCreation module¶
Schedule Creation
The schedule is created using dependency injection The definition of the schedule that will be used in the simulation is in the yaml file
kernel.simulation module¶
Simulation Class (This implements a batch simulation)
kernel.spaceCreation module¶
Space Creation
The spaces are created using dependency injection The definition of the spaces that will be used in the simulation is in the yaml file