From 0a80da0eefa3fa48d26bca84910ba7102c6d35a5 Mon Sep 17 00:00:00 2001 From: JesusMSM Date: Mon, 14 Dec 2015 12:57:21 +0100 Subject: [PATCH] Comportamiento usuario empezado --- soil.py | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/soil.py b/soil.py index bd2d984..7449b71 100644 --- a/soil.py +++ b/soil.py @@ -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: