diff --git a/clase_base.py b/clase_base.py deleted file mode 100644 index 76ae3e7..0000000 --- a/clase_base.py +++ /dev/null @@ -1,74 +0,0 @@ -import random -import time - -settings = { - "empresas": ["BBVA", "Santander"] -} - -class BaseNetworkAgent: - - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) - self.id = random.random() - - @property - def env(self): - class T(object): - pass - - temp = T() - temp.now = time.time() - return temp - - -def agentes_a_json(agentes): - final = {} - for agente in agentes: - for stamp, attrs in self._attrs.items(): - for a in attrs: - if a not in final: - final[a] = {} - final[a][stamp] = attrs[a] - return final - -class ComportamientoBase(BaseNetworkAgent): - def __init__(self, *args, **kwargs): - self._attrs = {} - - @property - def attrs(self): - now = self.env.now - if now not in self._attrs: - self._attrs[now] = {} - return self._attrs[now] - - @attrs.setter - def attrs(self, value): - self._attrs[self.env.now] = value - - def run(self): - while True: - self.step(self.env.now) - #yield self.env.timeout(settings.timeout) - - def step(self, now): - pass - - def a_json(self): - final = {} - for stamp, attrs in self._attrs.items(): - for a in attrs: - if a not in final: - final[a] = {} - final[a][stamp] = attrs[a] - return final - -class NuevoComportamiento(ComportamientoBase): - - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) - self.empresas = settings["empresas"] - - def step(self, now): - for i in self.empresas: - self.attrs['sentimiento_empresa_%s' % i] = random.random() diff --git a/models.py b/models.py index 006a6d0..82f03cf 100644 --- a/models.py +++ b/models.py @@ -1,12 +1,5 @@ -from nxsim import NetworkSimulation from nxsim import BaseNetworkAgent -from nxsim import BaseLoggingAgent -from random import randint -from pprint import pprint -from matplotlib import pyplot as plt import random -import numpy as np -import networkx as nx import settings settings.init() @@ -16,7 +9,7 @@ settings.init() ############################## def init(): global networkStatus - networkStatus={} # Dict that will contain the status of every agent in the network + networkStatus = {} # Dict that will contain the status of every agent in the network sentimentCorrelationNodeArray=[] for x in range(0, settings.number_of_nodes): @@ -223,13 +216,11 @@ class SentimentCorrelationModel(ComportamientoBase): if(numanger_prob): - self.state['id'] = 2 sentimentCorrelationNodeArray[self.id][self.env.now]=2 self.time_awareness[self.state['id']-1] = self.env.now diff --git a/soil.py b/soil.py index 4999ff8..c2275d1 100644 --- a/soil.py +++ b/soil.py @@ -1,10 +1,6 @@ -#from clase_base import * from models import * from nxsim import NetworkSimulation -from nxsim import BaseNetworkAgent from nxsim import BaseLoggingAgent -import random -import numpy as np import networkx as nx import settings import models diff --git a/status.png b/status.png deleted file mode 100644 index 4a50398..0000000 Binary files a/status.png and /dev/null differ