1
0
mirror of https://github.com/gsi-upm/soil synced 2025-08-23 19:52:19 +00:00

All settings as JSON and documentation updated

This commit is contained in:
Tasio Mendez
2017-05-16 14:02:50 +02:00
parent 23fc9671c3
commit a643735ddb
20 changed files with 90 additions and 81 deletions

View File

@@ -9,7 +9,7 @@ A model defines the behaviour of the agents with a view to assessing their effec
In practice, a model consists of at least two parts:
* Python module: the actual code that describes the behaviour.
* Setting up the variables in the Simulation Settings JSON file.
* Setting up the variables in the Settings JSON file.
This separation allows us to run the simulation with different agents.
@@ -25,10 +25,10 @@ All the models are imported to the main file. The initialization look like this:
networkStatus = {} # Dict that will contain the status of every agent in the network
sentimentCorrelationNodeArray = []
for x in range(0, settings.number_of_nodes):
for x in range(0, settings.network_params["number_of_nodes"]):
sentimentCorrelationNodeArray.append({'id': x})
# Initialize agent states. Let's assume everyone is normal.
init_states = [{'id': 0, } for _ in range(settings.number_of_nodes)]
init_states = [{'id': 0, } for _ in range(settings.network_params["number_of_nodes"])]
# add keys as as necessary, but "id" must always refer to that state category
A new model have to inherit the BaseBehaviour class which is in the same module.
@@ -77,7 +77,7 @@ passed as a parameter to the simulation.
}
In this file you will also define the models you are going to simulate. You can simulate as many models as you want.
The simulation returns one result for each model. For the usage, see :doc:`usage`.
The simulation returns one result for each model, executing each model separately. For the usage, see :doc:`usage`.
Example Model
=============

View File

@@ -8,18 +8,19 @@ Simulation Settings
Once installed, before running a simulation, you need to configure it.
* In the settings.py file you will find the configuration of the network.
* In the Settings JSON file you will find the configuration of the network.
.. code:: python
# Network settings
network_type = 1
number_of_nodes = 1000
max_time = 50
num_trials = 1
timeout = 2
{
"network_type": 1,
"number_of_nodes": 1000,
"max_time": 50,
"num_trials": 1,
"timeout": 2
}
* In the Simulation Settings JSON file, you will find the configuration of the models.
* In the Settings JSON file, you will also find the configuration of the models.
Network Types
=============
@@ -40,7 +41,7 @@ Models Settings
===============
After having configured the simulation, the next step is setting up the variables of the models.
For this, you will need to modify the Simulation Settings JSON file.
For this, you will need to modify the Settings JSON file again.
.. code:: json
@@ -76,7 +77,7 @@ For this, you will need to modify the Simulation Settings JSON file.
}
In this file you will define the different models you are going to simulate. You can simulate as many models
as you want.
as you want. Each model will be simulated separately.
After setting up the models, you have to initialize the parameters of each one. You will find the parameters needed
in the documentation of each model.
@@ -90,7 +91,7 @@ After setting all the configuration, you will be able to run the simulation. All
.. code:: bash
python soil.py
python3 soil.py
The simulation will return a dynamic graph .gexf file which could be visualized with
`Gephi <https://gephi.org/users/download/>`__.