Leviathan_no_group
LevApproximation Class Reference

#include <LevApproximation.h>

Public Member Functions

 LevApproximation (float delta_, float sigma_, unsigned int nbAgents_, unsigned int nbGossips_, float rangeInitOpinions_=0)
 
void updateInflus ()
 
void averageInteraction ()
 
void writeOpinions (std::string fileName)
 
unsigned int getNbAgents ()
 
float z (IdAgent i, IdAgent j)
 
float influCircum (IdAgent i, IdAgent j)
 
float F (IdAgent i, IdAgent j)
 
float F2 (IdAgent i, IdAgent j)
 
float G (IdAgent i, IdAgent j)
 
float G2 (IdAgent i, IdAgent j)
 
float FG_ijji (IdAgent i, IdAgent j)
 
float Fx (IdAgent i, IdAgent j, IdAgent k, IdAgent l)
 
float Gx (IdAgent i, IdAgent j, IdAgent k, IdAgent l)
 
float J (IdAgent i, IdAgent j, IdAgent g)
 
float J2 (IdAgent i, IdAgent j, IdAgent g)
 
float Jx (IdAgent i, IdAgent j, IdAgent g, IdAgent k, IdAgent l)
 
float JJ (IdAgent i, IdAgent j, IdAgent g, IdAgent k, IdAgent l, IdAgent m)
 

Public Attributes

float delta
 
float sigma
 
unsigned int gossip
 
unsigned int nbStep
 
std::vector< float > startReputation
 
NVector< 3, float > opinions
 
NVector< 4, float > avgMulti
 
NVector< 2, float > influences
 
NVector< 2, float > dInfluences
 
NVector< 2, float > deltaOpinions
 
float delta2Sur3
 
NVector< 2, float > equi
 

Detailed Description

This class use a mathematical approximation to compute the change of opinions of agents

Constructor & Destructor Documentation

◆ LevApproximation()

LevApproximation::LevApproximation ( float  delta_,
float  sigma_,
unsigned int  nbAgents_,
unsigned int  nbGossips_,
float  rangeInitOpinions_ = 0 
)

Constructor

Parameters
delta_the amplitude of the uniformly distributed errors in the reception of the opinions
sigma_defines the shape of the propagation function (the more sigma is small, the more the function is tilted)
nbAgents_number of agents in the simulation
nbGossips_the number of agents subject of gossip in each pair interaction
rangeInitOpinions_the starting inequalities between agents (reputations are uniformly distributed, and this parameter define the range between higher and lower agent)

Member Function Documentation

◆ averageInteraction()

void LevApproximation::averageInteraction ( )

compute the approximation of the average change of opinions of all agents and update those values

◆ getNbAgents()

unsigned int LevApproximation::getNbAgents ( )
inline

return the number of agents

◆ updateInflus()

void LevApproximation::updateInflus ( )

update the values of influences and dInfluences

◆ writeOpinions()

void LevApproximation::writeOpinions ( std::string  fileName)

write the values of x_ii, x_ji and equi in a file

Parameters
filenamethe name of the created file

◆ z()

float LevApproximation::z ( IdAgent  i,
IdAgent  j 
)

return different values used in the approximation

Member Data Documentation

◆ avgMulti

NVector<4, float> LevApproximation::avgMulti

average of opinion multiplication : avgMulti[i][j][k][l]=avg(a=x_ij*a=x_kl)

◆ delta

float LevApproximation::delta

the amplitude of the uniformly distributed errors in the reception of the opinions

◆ delta2Sur3

float LevApproximation::delta2Sur3

just a shortcut for pow(delta,2)/3

◆ deltaOpinions

NVector<2, float> LevApproximation::deltaOpinions

deltaOpinions[i][j]=opinion[i][i]-opinion[i][j] at start

◆ dInfluences

NVector<2, float> LevApproximation::dInfluences

the derivative of influences : dInfluences[i][j] = derivative of influences of j on i at the start

◆ equi

NVector<2, float> LevApproximation::equi

equi[t][i] = equilibrium opinion of i at the step t

◆ gossip

unsigned int LevApproximation::gossip

the number of agents subject of gossip in each pair interaction

◆ influences

NVector<2, float> LevApproximation::influences

the influences of agents : influences[i][j]=starting influence of j on i

◆ nbStep

unsigned int LevApproximation::nbStep

number of steps done yet (1 pair interaction per agent per step)

◆ opinions

NVector<3, float> LevApproximation::opinions

all the average opinions at different time step opinions[t][i][j] : the change of opinion of i about j

◆ sigma

float LevApproximation::sigma

defines the shape of the propagation function (the more sigma is small, the more the function is tilted)

◆ startReputation

std::vector<float> LevApproximation::startReputation

the starting reputation of agents


The documentation for this class was generated from the following files: