This program developed entirely under Python reproduces a simple stochastic agent-based model of corruption using Monte Carlo method. It also contains code for the implementation of a non-stationary Markov model designed specifically for the model.
It basically has 3 main files that run independently:
The first two programs refer to the non-stationary Markov model. The
main.py uses the class puebloClase in the
Clases to create a village where the Monte Carlo algorithm will be used.
The code itself also has functions to create scale-free and Erdös-Renyi networks that the program uses for the simulations.
The networks are to be saved in the
Input folder for the program to use them properly. Also, the classes that generate
them is in the
Clases/RedClase.py. There you'll find two different classes depending on which type of network you want
In case you want to generate networks and use them separately from the main program a folder named
Output with the same
structure as the
Input folder must be created. Also, examples of networks with N=1000 and k=6 have been saved in zip
files in the
To run the program you must create a folder named
Resultados with the following folders in it:
Depending on the program you want to run (two folders for Markov [
Estacionario] and one for Monte Carlo). After that,
the folders are created automatically by the program.
Everything should be self explanatory just looking at the files. However I will explain it here too: to run the
main program, the route for the settings file is
Settings/settings.ini. Due to the high times of
compuyting, I strongly recommend not to change the parameters for the networks (N=1000 and k=6) other than
archivoRed = True, the program will try to find networks in the
[Ejecucion] part, the parameter
metodo can't be changed or the program will stop working.
[Version], 2 is used for the 4p model and the parameters
[Sistema] won't be considered.
If everything is set correctly, a folder inside
MontecarloPar will be created.
Settings/SettingsES.py should be edited for this. It's just roughly the same as before.
The code in the folder
Scripts generates a file
Slider.html whose result can be seen here.
It is a dynamic phase portrait, the parameters and model can be changed live.
This is an academic study and the code uploaded here is only written by Javier Gamazo.