1
0
mirror of https://github.com/gsi-upm/soil synced 2024-12-22 08:18:13 +00:00

Comportamiento usuario empezado

This commit is contained in:
JesusMSM 2015-12-14 12:57:21 +01:00
parent f9a47bc9ef
commit 0a80da0eef

29
soil.py
View File

@ -50,18 +50,37 @@ class BigMarketModel(BaseNetworkAgent):
networkStatus[self.id][self.env.now]=0
if self.id == 0: #Empresa 1
self.state['id']=0
self.tweet_probability_1 = settings.tweet_probability_1
self.tweet_probability = settings.tweet_probability_1
elif self.id == 1: #Empresa 2
self.state['id']=1
self.tweet_probability_2 = settings.tweet_probability_2
self.tweet_probability = settings.tweet_probability_2
else: #Usuarios normales
self.state['id']=2
self.tweet_probability_users = settings.tweet_probability_users
self.tweet_probability_about = settings.tweet_probability_about
self.sentiment_about = settings.sentiment_about
self.tweet_probability = settings.tweet_probability_users
self.tweet_relevant_probability = settings.tweet_relevant_probability
self.tweet_probability_about = settings.tweet_probability_about #Lista
self.sentiment_about = settings.sentiment_about #Lista
def run(self):
while True:
##Usuario
if random.random() < self.tweet_probability: #Twittea
if random.random() < self.tweet_relevant_probability: #Twittea algo relevante
#Probabilidad de tweet para cada empresa
for i in range(len(self.tweet_probability_about)):
if random.random() < self.tweet_probability_about[i]:
#Se ha cumplido la condicion, evaluo los sentimientos hacia esa empresa
if self.sentiment_about[i] < 0:
#NEGATIVO
elif self.sentiment_about[i] == 0:
#NEUTRO
else:
#POSITIVO
aware_neighbors_1_time_step=[]
#Outside effects
if random.random() < settings.innovation_prob: