1
0
mirror of https://github.com/gsi-upm/soil synced 2025-08-23 19:52:19 +00:00
* Pandas integration
* Improved environment
* Logging and data dumps
* Tests
* Added Finite State Machine models
* Rewritten ipython notebook and documentation
This commit is contained in:
J. Fernando Sánchez
2017-06-20 17:45:43 +02:00
parent 764177c634
commit e1be3a730e
110 changed files with 32706 additions and 57437 deletions

24
examples/complete.yml Normal file
View File

@@ -0,0 +1,24 @@
---
name: simple
dir_path: "/tmp/"
num_trials: 3
max_time: 100
interval: 1
network_params:
generator: complete_graph
n: 10
network_agents:
- agent_type: CounterModel
weight: 1
state:
id: 0
- agent_type: AggregatedCounter
weight: 0.2
environment_agents: []
environment_params:
am_i_complete: true
default_state:
incidents: 0
states:
- name: 'The first node'
- name: 'The second node'

View File

@@ -0,0 +1,17 @@
default_state: {}
environment_agents: []
environment_params: {prob_neighbor_spread: 0.0, prob_tv_spread: 0.01}
interval: 1
max_time: 20
name: Sim_prob_0
network_agents:
- agent_type: NewsSpread
state: {has_tv: false}
weight: 1
- agent_type: NewsSpread
state: {has_tv: true}
weight: 2
network_params: {generator: erdos_renyi_graph, n: 500, p: 0.1}
num_trials: 1
states:
- {has_tv: true}

View File

@@ -0,0 +1,20 @@
import soil
import random
class NewsSpread(soil.agents.FSM):
@soil.agents.default_state
@soil.agents.state
def neutral(self):
r = random.random()
if self['has_tv'] and r < self.env['prob_tv_spread']:
return self.infected
return
@soil.agents.state
def infected(self):
prob_infect = self.env['prob_neighbor_spread']
for neighbor in self.get_neighboring_agents(state_id=self.neutral.id):
r = random.random()
if r < prob_infect:
neighbor.state['id'] = self.infected.id
return

View File

@@ -0,0 +1,2 @@
balkian Torvalds {}
anonymous Torvalds {}

14
examples/torvalds.yml Normal file
View File

@@ -0,0 +1,14 @@
---
name: torvalds_example
max_time: 1
interval: 2
agent_type: CounterModel
default_state:
skill_level: 'beginner'
network_params:
path: 'torvalds.edgelist'
states:
Torvalds:
skill_level: 'God'
balkian:
skill_level: 'developer'