|
1 | 1 | # DecisionsOnNetworks |
2 | 2 | Simulation software to study consensus collective decisions on random networks with synchronous and asynchronous decision models. |
| 3 | + |
| 4 | +This code allows you to generate all data and results presented in the article |
| 5 | + |
| 6 | +Andreagiovanni Reina, Thomas Bose, Vaibhav Srivastava, and James A. R. Marshall, "Asynchrony rescues statistically-optimal group decisions from information cascades through emergent leaders" _The Royal Society Open Science_ (under review) |
| 7 | + |
| 8 | + |
| 9 | +## Dependencies |
| 10 | + |
| 11 | +The Python code has been run with Python 3.6.8 and has the following dependencies from external libraries: |
| 12 | +* configparser |
| 13 | +* json |
| 14 | +* math |
| 15 | +* numpy |
| 16 | +* matplotlib |
| 17 | +* scipy |
| 18 | +* networkx |
| 19 | +* itertools |
| 20 | + |
| 21 | +## Generate the data |
| 22 | + |
| 23 | + |
| 24 | +#### Figure 2 |
| 25 | + |
| 26 | +In order to reproduce the results reported in Figure 2 of the paper, that is, synchronous collective signal detection, you need to run the script |
| 27 | +``` |
| 28 | +DecisionsOnNetworks/scripts/submitSynch.sh |
| 29 | +``` |
| 30 | +which will exectute a large number of simulations for all conisidered conditions. |
| 31 | +On line [160 of `submitSynch.sh`](https://github.com/DiODeProject/DecisionsOnNetworks/blob/published_code/scripts/submitSynch.sh#L160) you can change the command to execute the Python code using the method that you prefer (default it is by submitting SLURM jobs). |
| 32 | + |
| 33 | +If you wish to submit a single simulation run, for a specific condition, for the synchronous collective signal detection, you can do it by running the command: |
| 34 | +``` |
| 35 | +cd DecisionsOnNetworks/src |
| 36 | +python3 DecNet/DecisionProcess.py ../conf/DecNet.config |
| 37 | +``` |
| 38 | +You can modify any parameters in the configuration file `DecisionsOnNetworks/conf/DecNet.config`. |
| 39 | +Once the process had terminated, you can find the results in the folder `DecisionsOnNetworks/data`, which will include the text file `out.txt` (with the data used to generate the paper's Figures), and a graphical representation of each iteration step of each simulation as pdf files. |
| 40 | + |
| 41 | + |
| 42 | +#### Figure 3 |
| 43 | + |
| 44 | +In order to reproduce the results reported in Figure 3 of the paper, that is, asynchronous collective sequential sampling, you need to run the script |
| 45 | +``` |
| 46 | +DecisionsOnNetworks/scripts/submitAsynch.sh |
| 47 | +``` |
| 48 | +which will exectute a large number of simulations for all conisidered conditions. |
| 49 | +On line [139 of `submitAsynch.sh`](https://github.com/DiODeProject/DecisionsOnNetworks/blob/published_code/scripts/submitAsynch.sh#L139) you can change the command to execute the Python code using the method that you prefer (default it is by submitting SLURM jobs). |
| 50 | + |
| 51 | +If you wish to submit a single simulation run, for a specific condition, for the asynchronous collective sequential sampling, you can do it by running the command: |
| 52 | +``` |
| 53 | +cd DecisionsOnNetworks/src |
| 54 | +python3 AsynchKicks/DecisionProcess.py ../conf/AsynchK.config |
| 55 | +``` |
| 56 | +You can modify any parameters in the configuration file `DecisionsOnNetworks/conf/AsynchK.config`. |
| 57 | +Once the process had terminated, you can find the results in the folder `DecisionsOnNetworks/data`, which will include text files `out.txt` with the information of the decision of the agents at the end of each simulation, the text file `out_cas.txt` with the cascade size of each simulation, and a graphical representation of each iteration step for each simulation as pdf files. |
| 58 | + |
| 59 | +## Plot the data |
| 60 | + |
| 61 | +#### Figure 1 |
| 62 | + |
| 63 | +The graphics of Figure 1 have been generated using the Mathematica notebook `DecisionsOnNetworks/plots/paperPlots.nb`. |
| 64 | + |
| 65 | +#### Figure 2 and 3 and Supplementary Figures SF1, SF2, SF3, and SF6 |
| 66 | + |
| 67 | +The data generated with the Python simulator have been plotted using the Mathematica notebook `DecisionsOnNetworks/plots/paperPlots.nb`. |
| 68 | + |
| 69 | +#### Figure 3(b) and Supplementary Figures SF4 and SF5 |
| 70 | + |
| 71 | +For Figure 3(b) and Supplementary Figures SF4 and SF5, the data generated with the Python simulator have been plotted using the R script `DecisionsOnNetworks/plots/plotKicks.R`, calling the function `plotCascadeOnRank()`. |
| 72 | + |
| 73 | + |
0 commit comments