diff --git a/README.md b/README.md new file mode 100644 index 0000000000000000000000000000000000000000..8592fdcd2fa6a4368904da2c50597dcfccbff647 --- /dev/null +++ b/README.md @@ -0,0 +1,42 @@ +#Collective-Risk Dilemma + Q-learning +This repo contains files that support the project of studying Q-learning agents +in a collective-risk dilemma. + +--- + +To test the data of the thesis, **uncomment any code blocks in main.py/main()** + and run: + +$ python3 main.py + +--- + +Most methods in main.py have the flexibility of passing different number of +parameters in **kwargs. If not specified, a parameter will be defaulted with +the value defined in __init__() methods. + +To extend the tests, stackBar() and t_test() in main.py were implemented +with the flexibility of specifying which parameter is of interest. +Simply pass a list or tuple to the method with the interested keyword, as +part of **kwargs. + +E.g. `stackBar(0, Actions, repeat=repeat, alpha=[0, 0.1, 0.2, 0.3, 0.4, 0.5, 0 +.6, 0.7, 0.8, 0.9, 1])` +compares on different alpha value, while + +`stackBar(0, Actions, repeat=repeat, threshold=[0.1, 0.2, 0.3, 0.4, 0.5, 0.6, +0.7, 0.8, 0.9, 1])` compares on thresholds. + + +--- + +The graph.py implemented a 'small-world network' model for agent pairing. +Current tests found no significant effect on observed results. The model is +kept for further study, but only well-mixed graphs were deployed so far. + +--- + +Author: Liyao Zhu `liyaoz@student.unimelb.edu.au` + +Last Update: 11 Jun. 2019 + diff --git a/main.py b/main.py index 923934ef2b8330037d494ab27f103b8272a8c9fe..1146634b27645c348b95bf22ad8627f692e291b7 100644 --- a/main.py +++ b/main.py @@ -275,9 +275,9 @@ def main(): """Fig. 2""" - # data = rep(repeat=repeat, N=100, alpha=0.8, R=8) - # stackPlot(data, r=0, Iterations=I, Actions=Actions, - # legendLoc='lower right') + data = rep(repeat=repeat, N=100, alpha=0.8, R=8) + stackPlot(data, r=0, Iterations=I, Actions=Actions, + legendLoc='lower right') """Fig. 3""" @@ -370,7 +370,5 @@ def main(): # print(stats.ttest_ind(base, compare)) - - if __name__ == '__main__': main() \ No newline at end of file