mirror of
https://github.com/gsi-upm/soil
synced 2024-11-13 23:12:28 +00:00
Comportamiento de usuarios incluido
This commit is contained in:
parent
cf1dedf459
commit
75b4186332
Binary file not shown.
@ -22,7 +22,7 @@ def init():
|
|||||||
|
|
||||||
network_type=1
|
network_type=1
|
||||||
number_of_nodes=50
|
number_of_nodes=50
|
||||||
max_time=1000
|
max_time=10000
|
||||||
num_trials=1
|
num_trials=1
|
||||||
timeout=10
|
timeout=10
|
||||||
|
|
||||||
|
Binary file not shown.
22
soil.py
22
soil.py
@ -82,8 +82,8 @@ class BigMarketModel(BaseNetworkAgent):
|
|||||||
if(self.id < 2): # Empresa
|
if(self.id < 2): # Empresa
|
||||||
self.enterpriseBehaviour()
|
self.enterpriseBehaviour()
|
||||||
else: # Usuario
|
else: # Usuario
|
||||||
#self.userBehaviour()
|
self.userBehaviour()
|
||||||
pass
|
|
||||||
yield self.env.timeout(settings.timeout)
|
yield self.env.timeout(settings.timeout)
|
||||||
|
|
||||||
|
|
||||||
@ -113,6 +113,7 @@ class BigMarketModel(BaseNetworkAgent):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def userBehaviour(self):
|
def userBehaviour(self):
|
||||||
|
|
||||||
if random.random() < self.tweet_probability: #Twittea
|
if random.random() < self.tweet_probability: #Twittea
|
||||||
@ -403,21 +404,13 @@ status_census = [sum([1 for node_id, state in g.items() if state['id'] == 1]) fo
|
|||||||
# Visualization #
|
# Visualization #
|
||||||
#################
|
#################
|
||||||
|
|
||||||
print("Empresa1")
|
# print("Empresa1")
|
||||||
print (enterprise1Status)
|
# print (enterprise1Status)
|
||||||
print("Empresa2")
|
# print("Empresa2")
|
||||||
print (enterprise2Status)
|
# print (enterprise2Status)
|
||||||
|
|
||||||
for x in range(0, settings.number_of_nodes):
|
for x in range(0, settings.number_of_nodes):
|
||||||
emotionStatusAux=[]
|
emotionStatusAux=[]
|
||||||
|
|
||||||
# for tiempo in emotionStatus[x]:
|
|
||||||
# if tiempo != 'id':
|
|
||||||
# prec = 2
|
|
||||||
# output = math.floor(emotionStatus[x][tiempo] * (10 ** prec)) / (10 ** prec) #Para tener 2 decimales solo
|
|
||||||
# emotionStatusAux.append((output,tiempo,None))
|
|
||||||
# G.add_node(x, emotion= emotionStatusAux)
|
|
||||||
# del emotionStatusAux[:]
|
|
||||||
for tiempo in enterprise1Status[x]:
|
for tiempo in enterprise1Status[x]:
|
||||||
if tiempo != 'id':
|
if tiempo != 'id':
|
||||||
prec = 2
|
prec = 2
|
||||||
@ -434,6 +427,7 @@ for x in range(0, settings.number_of_nodes):
|
|||||||
emotionStatusAux2.append((output,tiempo,None))
|
emotionStatusAux2.append((output,tiempo,None))
|
||||||
G.add_node(x, enterprise2emotion= emotionStatusAux2)
|
G.add_node(x, enterprise2emotion= emotionStatusAux2)
|
||||||
|
|
||||||
|
print("Done!")
|
||||||
|
|
||||||
#lista = nx.nodes(G)
|
#lista = nx.nodes(G)
|
||||||
#print('Nodos: ' + str(lista))
|
#print('Nodos: ' + str(lista))
|
||||||
|
BIN
status.png
BIN
status.png
Binary file not shown.
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
Loading…
Reference in New Issue
Block a user