mirror of
https://github.com/gsi-upm/soil
synced 2024-11-21 18:52: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
|
||||
number_of_nodes=50
|
||||
max_time=1000
|
||||
max_time=10000
|
||||
num_trials=1
|
||||
timeout=10
|
||||
|
||||
|
Binary file not shown.
22
soil.py
22
soil.py
@ -82,8 +82,8 @@ class BigMarketModel(BaseNetworkAgent):
|
||||
if(self.id < 2): # Empresa
|
||||
self.enterpriseBehaviour()
|
||||
else: # Usuario
|
||||
#self.userBehaviour()
|
||||
pass
|
||||
self.userBehaviour()
|
||||
|
||||
yield self.env.timeout(settings.timeout)
|
||||
|
||||
|
||||
@ -113,6 +113,7 @@ class BigMarketModel(BaseNetworkAgent):
|
||||
|
||||
|
||||
|
||||
|
||||
def userBehaviour(self):
|
||||
|
||||
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 #
|
||||
#################
|
||||
|
||||
print("Empresa1")
|
||||
print (enterprise1Status)
|
||||
print("Empresa2")
|
||||
print (enterprise2Status)
|
||||
# print("Empresa1")
|
||||
# print (enterprise1Status)
|
||||
# print("Empresa2")
|
||||
# print (enterprise2Status)
|
||||
|
||||
for x in range(0, settings.number_of_nodes):
|
||||
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]:
|
||||
if tiempo != 'id':
|
||||
prec = 2
|
||||
@ -434,6 +427,7 @@ for x in range(0, settings.number_of_nodes):
|
||||
emotionStatusAux2.append((output,tiempo,None))
|
||||
G.add_node(x, enterprise2emotion= emotionStatusAux2)
|
||||
|
||||
print("Done!")
|
||||
|
||||
#lista = nx.nodes(G)
|
||||
#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