Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Network refactor and reluctant Activity driven model #28

Merged
merged 34 commits into from
Mar 18, 2024
Merged

Conversation

MSallermann
Copy link
Member

No description provided.

MSallermann and others added 30 commits March 14, 2024 17:37
Helps to write commit messages, that are conforming to CONTRIBUTING.md.
Pointed out that Seldon contains a commit template
under `.gitmessage`. Might be useful for contributors.

Co-authored-by: Amrita Goswami <[email protected]>
Change Network to a class templated on the AgentType.
All functions were moved to the hpp file.

Co-authored-by: Moritz Sallermann <[email protected]>
WIP commit, with simulation run functions and IO commented out. But hey
presto, it compiles!

Co-authored-by: Moritz Sallermann <[email protected]>
AgentType has to be included in simulation and model. TODO: Fix IO
functions

Co-authored-by: Moritz Sallermann <[email protected]>
Some of the tests work now. However, IO does not yet work. TODO: Models
need to use agents from Network.

Co-authored-by: Moritz Sallermann <[email protected]>
We had to change the models to take agents from network. Some tests
work now. TODO: Activity driven model test. Also agents should
be private not public, in network.

Co-authored-by: Moritz Sallermann <[email protected]>
TODO: Activity driven model test
TODO: Fix the bot and single agent test. x(t) somehow does not work.

Co-authored-by: Moritz Sallermann <[email protected]>
The analytical solution was not being computed correctly because the of
a reference that should have been a copy (and was before the refactor)
- cleaned up the code after running clang-format.
- using NetworkT instead of using Network, to not shadow the Network
class
- also put the `typename` in `using typename NetworkT::WeightT` etc.
- renamed unittests so that they dont have any whitepsace, i.empty
"Test_Activity Driven" -> "Test_Activity_Driven", because such paths are
nicer to work with
Started to remove unique_ptr in Simulation class. Broken at the moment
Since model actually relies on polymorphic behaviour, it was wrong to
not access it via a pointer to the base class.

Co-authored-by: Amrita Goswami <[email protected]>
The ModelBase class is unnecessary now that simulation is templated on
the agent type. Therefore, it has been removed.

Further, `model.n_iterations()` is now a getter function for
`model._n_iterations` and there is a new `mode.initialize_iterations()`
function that contains behaviour that needs to be exectued before a
`simulation.run()` is started.
Since Simulation is now templated on the agent type, this is not needed.

Co-authored-by: Amrita Goswami <[email protected]>
Forgot to run the simulations in main function so far. Yes, really.
Created SimulationInterface to run simulations with different agent
types via a common interface.

Co-authored-by: Amrita Goswami <[email protected]>
Some TODO comments that were no longer needed have been removed.

Co-authored-by: Amrita Goswami <[email protected]>
Straight forward and may be useful in the future. Default type is double

Co-authored-by: Amrita Goswami <[email protected]>
Indentation of a comment in network and std::is_same_v<T> instead of
std::is_same<T>::value
Template Network on the agent type
Just to be consistent with the rest of the nomenclature.

Co-authored-by: Amrita Goswami <[email protected]>
The ActivityDrivenModel driven model has been extended with a concept,
that we call reluctance. This quantifies how receptive to others'
opinions an agent is.
Reluctance is an per agent quantity and therefore the IO had to be
changed slightly.
The bots can be thought of as agents with infinite reluctance.

TODO: generation of distributions for reluctance, possibly correlated
with activities.

Co-authored-by: Amrita Goswami <[email protected]>
Will be used later to draw the reluctances, it's a normal distribution
truncated to the interval [eps, infty].
ActivityDrivenModel::generate_agents_from_power_law(), now also
generates the reluctances from a truncated normal distribution.
Optionally they can be correlated with the activities.

TODO: parsing of the config file to control these options

Co-authored-by: Amrita Goswami <[email protected]>
Reluctance options are not part of ConfigParser. Defaults are set and
some checks are completed. Also added an example with the reluctance.
TODO: Make a unit test on the ActivityDrivenModel with reluctances.

Co-authored-by: Moritz Sallermann <[email protected]>
We modified the unit test with one bot and one agent to now include
the reluctance (of the agent).

Co-authored-by: Moritz Sallermann <[email protected]>
Otherwise, we can't figure out why the tests fail on the CI

Co-authored-by: Moritz Sallermann <[email protected]>
We now set the width of the distribution (before truncating)
for the reluctant agents to a smaller value, so that tests on
the CI are comparable

Co-authored-by: Moritz Sallermann <[email protected]>
Testing has shown that our implementation of the covariance factor was
unsatisfactory in several regards. Since, at the time, it is not so
trivial to improve, we have removed it.
The activities and reluctances can, of course, still be arbitrarily
correlated -- simply by reading in an initial opinions file.

Co-authored-by: Amrita Goswami <[email protected]>
Seldon can now optionally print files starting from a user-defined
value which is greater than 0. Right now the zeroth iteration
files are always created (if outputs are enabled).
amritagos and others added 4 commits March 17, 2024 23:09
Now the user can optionally disable outputting the initial opinions
and network. By default, the initial opinions and network are always
printed.
Changed the variable deciding when to start outputting files to the more
intuitive `start_output`, as opposed to the old `start_print_iteration`

Co-authored-by: Moritz Sallermann <[email protected]>
@MSallermann MSallermann merged commit 0fd353b into main Mar 18, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants