Skip to content

Commit

Permalink
ActivityDrivenModel: fixed sign in homophily
Browse files Browse the repository at this point in the history
  • Loading branch information
Moritz Sallermann committed Oct 15, 2023
1 parent 1c90d26 commit f8b1778
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/models/ActivityDrivenModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ void Seldon::ActivityAgentModel::iteration()
{

// Implement the weight for the probability of agent `idx_agent` contacting agent `j`
// Not normalised since, this is taken care of by the reservoir sampling
// Not normalised since this is taken care of by the reservoir sampling
auto weight_callback = [idx_agent, this]( size_t j ) {
if( idx_agent == j ) // The agent does not contact itself
return 0.0;
return std::pow(
std::abs( this->agents[idx_agent].data.opinion - this->agents[j].data.opinion ), this->homophily );
std::abs( this->agents[idx_agent].data.opinion - this->agents[j].data.opinion ), -this->homophily );
};

Seldon::reservoir_sampling_A_ExpJ( m, network.n_agents(), weight_callback, contacted_agents, gen );
Expand Down

0 comments on commit f8b1778

Please sign in to comment.