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

Deffuant model #33

Merged
merged 17 commits into from
Mar 22, 2024
Merged

Deffuant model #33

merged 17 commits into from
Mar 22, 2024

Conversation

MSallermann
Copy link
Member

Implemented the basic Deffuant model. See the first model in https://www.worldscientific.com/doi/abs/10.1142/s0219525900000078.

amritagos and others added 6 commits March 19, 2024 18:27
The ConfigParser sets variables and checks them, so defaults should not
live inside the class

Co-authored-by: Moritz Sallermann <[email protected]>
Now you can use the draw_k_from_n function without repitition while
optionally including or excluding a particular index from 0 to N

Co-authored-by: Moritz Sallermann <[email protected]>
This compiles but segfaults when you run the example. Some
silly prints inside simulation for ad-hoc debugging.

Co-authored-by: Moritz Sallermann <[email protected]>
More clarity. The public interface of a class should be the most visible

Co-authored-by: Amrita Goswami <[email protected]>
Implemented a simple unit test with two agents for the basic deffuant
model. Also initialize the agents uniformly on the interval [0,1] in the
constructor (like we do in the DeGroot model).

Co-authored-by: Amrita Goswami <[email protected]>
MSallermann and others added 11 commits March 20, 2024 13:45
This function sorts the adjacency list by neighbour idx and removes
doubly counted edges by summing up their weight.

Co-authored-by: Amrita Goswami <[email protected]>
Also fixed the clear() function and removed some prints in test_network
Generates a neighbour list such that agents are on a square lattice, and
each agent has 4 neighbours. PBCs are implemented. TODO: perhaps move
from size_t to int?

Co-authored-by: Moritz Sallermann <[email protected]>
To reduce unnecessary commits with minor formatting changes, we have
pinned clang-format to 18.1.1. Different versions of clang-format
apparently produce different outputs.

Co-authored-by: Moritz Sallermann <[email protected]>
Implemented the Deffuant model with a square lattice neighbour list.
TODO: Actually parse these options.

Co-authored-by: Moritz Sallermann <[email protected]>
We now support an implementation of the Deffuant model on a square
lattice. TODO: unit test!
We use a 16x16 lattice and observe the formation of two stable clusters.

Co-authored-by: Amrita Goswami <[email protected]>
Utility function that parses a string that is in teh format of a
comma separated list and executes a callback function for each entry
in the list.
Also added a unit test for it.
Started to implement the Deffuant model with vectors. To minimize code
duplication we refactored the `ModelDeffuant` class in the following
way:
    - We introduced `DeffuantModelAbstract<AgentT>` which is a template
      class and implement the behaviour that is common to both the basic
      Deffuant model and the vector deffuant model
    - The basic deffuant model is now a specialization of
     `DeffuantModelAbstract<SimpleAgent>`, where all the behaviour
      specific to the basic Deffuant model is implemented via template
      specialization and explicit instantiation in a separate .cpp
      source code file
    - The same was done with the vector Deffuant model, but it is not
      fully implemented yet.

To simplify the notation they are availabe to the rest of the code via:
`using DeffuantModel = DeffuantModelAbstract<SimpleAgent>;`
`using DeffuantModelVector = DeffuantModelAbstract<DiscreteVectorAgent>;`

Co-authored-by: Amrita Goswami <[email protected]>
Implemented the Hamming distance, needed for the vector Deffuant model.

Co-authored-by: Amrita Goswami <[email protected]>
Also hacked in the generation of the initial agents by hardcoding the
dimensionality <--- TODO

Co-authored-by: Amrita Goswami <[email protected]>
@amritagos amritagos merged commit 42a1837 into develop Mar 22, 2024
4 checks passed
@amritagos amritagos deleted the deffuant branch March 22, 2024 16:39
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