80 Commits

Author SHA1 Message Date
a1f2b03b09 Clarified what the proj branch is for. 2023-10-24 10:25:00 +01:00
c1efba26f4 Added type hint to agent type in graph. 2023-10-24 10:24:02 +01:00
33db83ef14 Fixed satisfaction color bar not taking into account the threshold. 2023-10-24 10:17:40 +01:00
6309b5fd4c Agent.threshold is now a static method.
Added note on the project at the end of the delivery date
2023-10-24 10:14:19 +01:00
b7142a86f4 Added colorbar to grid display.
Simplified how agents are defined for `RunParams`.
2023-10-19 14:20:27 +01:00
d625d4b0f5 Improved satisfaction image display. 2023-10-16 21:33:08 +01:00
5046e8f8c1 Added README. 2023-10-16 12:27:21 +01:00
4b3da07b29 Added the ability to output the satisfaction image with GRID_FILE display method. 2023-10-15 13:15:58 +01:00
d5c3c81cf0 Added JSON_OUTPUT execution method.
Added script to parse output of `JSON_OUTPUT` execution method.
2023-10-13 06:00:43 +01:00
31089de57c Moved body of if __name__ == "__main__" to a function. 2023-10-13 05:12:29 +01:00
15a089f6a4 Fixed GAgent not inheriting Agent. 2023-10-13 05:11:08 +01:00
cdc578ded0 Moved all parameter definitions outside of main. 2023-10-12 15:00:28 +01:00
a63085b58f Separated agents into an abstract class with implementations.
Added `GAgent`, an agent that has lies between a gradient.
2023-10-12 14:50:40 +01:00
aebf851576 Added average satisfaction calculation output to json. 2023-10-12 14:46:35 +01:00
adcabbdcca Fixed time calculation being possibly slightly off. 2023-10-07 10:03:43 +01:00
61feed5910 Added DisplayMethod.GRID_FILE to output the graph as a grid to an image file. 2023-10-07 09:49:56 +01:00
a0ed42bc39 Fixed Agent.color not returning a tuple. 2023-10-07 09:48:04 +01:00
73b61e9b4d Added benchmark mode. 2023-10-07 09:34:43 +01:00
5771ebcbdd Cached agents and agent weights in fill_with_agents. 2023-10-07 08:37:39 +01:00
cc8d03a428 Created main function to wrap over if __name__ == "__main__" condition. 2023-10-07 08:32:47 +01:00
4e491245ef Agents are now stored in a separate dictionary.
This speeds up everything considerably, due to the double-indirection of `graph -> node -> agent`.
2023-10-06 15:07:15 +01:00
9a496d0c5b Added logging of graph creation. 2023-10-04 15:56:14 +01:00
2ebd981bcd Debug flags no longer require __debug__.
This ensures we can turn on some of the cheaper debug flags while testing large datasets.
2023-10-04 15:50:59 +01:00
fe6e3cb923 Equilibrium checking is now behind a debug flag. 2023-10-04 15:50:07 +01:00
881e21fdd9 Improved performance of Graph.fill_with_agents. 2023-10-04 15:45:34 +01:00
9e849a5138 Improved performance in Graph.{agent_satisfaction, remove_agent}. 2023-10-04 15:25:20 +01:00
8f05d66d77 Added Grid.update_unsatisfied_nodes_cache_multiple.
This is a more efficient form of calling `update_unsatisfied_nodes_cache` in a loop.
2023-10-04 15:18:46 +01:00
cf7cee5f3b Replaced nx.neighbors with nx.Graph.adj. 2023-10-04 14:40:25 +01:00
a29a89b8af Added Graph.move_agents to efficiently move several nodes at once. 2023-10-04 14:36:35 +01:00
db84512225 Moved random generation to local variable instead of using global.
This avoid anyone using numpy's global random state behind our back and changing the results.
2023-10-04 11:28:33 +01:00
c724edf88d Removed default arguments from caches.
This ensures we don't accidentally leave them uninitialized.
2023-10-04 11:07:00 +01:00
0e34ff2daf Upgraded sanity check to optionally check for all caches. 2023-10-04 11:05:12 +01:00
80b0c6740d Added display method NONE.
This is particularly useful for benchmarking.
2023-10-04 09:35:36 +01:00
1bdf6a3867 update_unsatisfied_nodes_cache now removes satisfied agents from the unsatisfied agents cache.
Note: The variable threshold was removed, as this now caused it to take much longer with the current used seed.
2023-10-04 09:26:35 +01:00
acb29c9cbf Improved messages on some asserts. 2023-10-04 08:49:12 +01:00
33e234374b Fixed usage of set.remove instead of set.discard. 2023-10-04 08:29:22 +01:00
e2c9910364 Fixed an assert message being removed. 2023-10-04 08:22:55 +01:00
23d05f5fba Fixed mis-naming of variable. 2023-10-03 07:26:11 +01:00
426b40907b Time per unsatisfied agent is now printed. 2023-10-02 20:53:35 +01:00
e6136300fa Each agent may now calculate their satisfaction separately. 2023-10-02 20:39:38 +01:00
8607b89b1a Sorted and removes unused imports. 2023-10-02 06:16:23 +01:00
867f09a528 Moved cur_round and logging outside Graph. 2023-10-02 06:15:54 +01:00
6b844b36c6 Each agent may now have a separate satisfaction threshold 2023-10-02 06:13:04 +01:00
9f9810faac Fixed asserts having the wrong syntax.
Added assert on equilibrium to check that all agents are satisfied.
2023-10-02 05:59:59 +01:00
b3665ce2da Agent weights are now normalized before passing to numpy.random.choice. 2023-10-02 05:29:13 +01:00
b8d0207a87 Fixed final round not printing how long it took. 2023-10-02 05:12:33 +01:00
8ba26b5a99 Added type alias for node position. 2023-10-02 05:10:25 +01:00
306c26c8e1 Fixed graph not being drawn when reaching equilibrium 2023-10-02 03:41:45 +01:00
188da6700f Fixed rounds being executed in multiples of rounds_per_display even when reaching equilibrium earlier. 2023-10-02 03:32:22 +01:00
a73d9f8428 Fixed formatting of time not correcting displaying micro and nano seconds. 2023-10-02 03:31:47 +01:00