Commit cf8d25f3 authored by Amit Goldenberg's avatar Amit Goldenberg

This is just an attempt of

parent ce363a46
......@@ -5,18 +5,18 @@ from scipy.stats import truncnorm
import matplotlib.animation as animation
from ComplexNetworkSim import NetworkAgent, Sim
# all the packages
preference_list = []
class ColEmo(NetworkAgent):
def __init__(self, state, initialiser):
NetworkAgent.__init__(self, state, initialiser)
self.preference = np.random.normal(0,self.globalSharedParameters['preference']) #this is the defree of preference (regulation) each participants has.
self.gamma = self.globalSharedParameters['gamma'] # the decay term.
self.gamma = 1 #self.globalSharedParameters['gamma'] # the decay term.
#fixed variables (for now)
self.event = 0.5 #self.globalSharedParameters['event'] # rate of experience - low numbers mean
self.bump = 2#globalSharedParameters['bump']
self.noise = 0.02 # noise term
self.conform = truncnorm.rvs(0.2,0.6) # this is the degree of conformity each participant has.
self.thresh = np.random.normal(4,0.5)
self.event = self.globalSharedParameters['event'] # rate of experience - low numbers mean less chance
self.bump = 0#globalSharedParameters['bump']
#self.noise = np.random.normal(0.09, 0.15) # noise term
self.conform = truncnorm.rvs(0.28,0.6) #np.random.normal(0.28,0.2) #this is the degree of conformity each participant has.
self.thresh = -1# np.random.normal(3,0.5)
#print "thresh %s" %self.thresh
# define selfstatevector to be similar to state (for the animation)
self.stateVector = self.state # each participant in this package recieves a variable (state)
......@@ -26,15 +26,17 @@ class ColEmo(NetworkAgent):
while True:
self.set_local_avg()
influence = (self.state-self.local_avg)*self.conform # certain conform ratio
"""
if influence >0:
influence = influence
else:
influence = 0
"""
# I made this cose for situations in which influence is = 0 (when there are no people that express their emotions)
#print "influence %s" %influence
emotion = (self.state*self.gamma) - influence + self.preference # the individual emotion
emotion = (self.state*self.gamma) - influence + self.preference +np.random.normal(0, 0.15) # the individual emotion
# this part forms the emotional bump that a participant recieves using the experience ratio.
self.event = self.event*0.95
self.event = self.event*1
if self.flip() == "bump": # if the flip condition fit the bump - than we need to bump.
self.state = emotion + self.bump # can be changed
elif self.flip() == "no_bump":
......@@ -71,6 +73,5 @@ class ColEmo(NetworkAgent):
self.local_avg = self.stateVector
"""
def flip(self):
return "no_bump" if random.random() > self.event else "bump"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment