mirror of
https://github.com/gsi-upm/soil
synced 2024-11-22 11:12:29 +00:00
Update SOIL Tutorial.ipynb
Cambiado infectados por infected y alguna traducción más
This commit is contained in:
parent
584c88b108
commit
c3479f224b
@ -179,14 +179,14 @@
|
|||||||
],
|
],
|
||||||
"source": [
|
"source": [
|
||||||
"for x in range(0, settings.number_of_nodes):\n",
|
"for x in range(0, settings.number_of_nodes):\n",
|
||||||
" for empresa in models.networkStatus[\"agente_%s\"%x]:\n",
|
" for enterprise in models.networkStatus[\"agent_%s\"%x]:\n",
|
||||||
" emotionStatusAux=[]\n",
|
" emotionStatusAux=[]\n",
|
||||||
" for tiempo in models.networkStatus[\"agente_%s\"%x][empresa]:\n",
|
" for time in models.networkStatus[\"agent_%s\"%x][enterprise]:\n",
|
||||||
" prec = 2\n",
|
" prec = 2\n",
|
||||||
" output = math.floor(models.networkStatus[\"agente_%s\"%x][empresa][tiempo] * (10 ** prec)) / (10 ** prec) #Para tener 2 decimales solo\n",
|
" output = math.floor(models.networkStatus[\"agent_%s\"%x][enterprise][time] * (10 ** prec)) / (10 ** prec) #Para tener 2 decimales solo\n",
|
||||||
" emotionStatusAux.append((output,tiempo,None))\n",
|
" emotionStatusAux.append((output,time,None))\n",
|
||||||
" attributes = {}\n",
|
" attributes = {}\n",
|
||||||
" attributes[empresa] = emotionStatusAux\n",
|
" attributes[enterprise] = emotionStatusAux\n",
|
||||||
" G.add_node(x, attributes)\n",
|
" G.add_node(x, attributes)\n",
|
||||||
"\n",
|
"\n",
|
||||||
"\n",
|
"\n",
|
||||||
@ -221,31 +221,31 @@
|
|||||||
"\n",
|
"\n",
|
||||||
"attribute_plot = 'status'\n",
|
"attribute_plot = 'status'\n",
|
||||||
"for time in range(0, settings.max_time):\n",
|
"for time in range(0, settings.max_time):\n",
|
||||||
" value_infectados = 0\n",
|
" value_infected = 0\n",
|
||||||
" value_neutral = 0\n",
|
" value_neutral = 0\n",
|
||||||
" value_cured = 0\n",
|
" value_cured = 0\n",
|
||||||
" value_vaccinated = 0\n",
|
" value_vaccinated = 0\n",
|
||||||
" real_time = time * settings.timeout\n",
|
" real_time = time * settings.timeout\n",
|
||||||
" activity= False\n",
|
" activity= False\n",
|
||||||
" for x in range(0, settings.number_of_nodes):\n",
|
" for x in range(0, settings.number_of_nodes):\n",
|
||||||
" if attribute_plot in models.networkStatus[\"agente_%s\" % x]:\n",
|
" if attribute_plot in models.networkStatus[\"agent_%s\" % x]:\n",
|
||||||
" if real_time in models.networkStatus[\"agente_%s\" % x][attribute_plot]:\n",
|
" if real_time in models.networkStatus[\"agent_%s\" % x][attribute_plot]:\n",
|
||||||
" if models.networkStatus[\"agente_%s\" % x][attribute_plot][real_time] == 1: ##Representar infectados\n",
|
" if models.networkStatus[\"agent_%s\" % x][attribute_plot][real_time] == 1: ##Represent infected\n",
|
||||||
" value_infectados += 1\n",
|
" value_infected += 1\n",
|
||||||
" activity = True\n",
|
" activity = True\n",
|
||||||
" if models.networkStatus[\"agente_%s\" % x][attribute_plot][real_time] == 0: ##Representar neutrales\n",
|
" if models.networkStatus[\"agent_%s\" % x][attribute_plot][real_time] == 0: ##Represent neutrals\n",
|
||||||
" value_neutral += 1\n",
|
" value_neutral += 1\n",
|
||||||
" activity = True\n",
|
" activity = True\n",
|
||||||
" if models.networkStatus[\"agente_%s\" % x][attribute_plot][real_time] == 2: ##Representar cured\n",
|
" if models.networkStatus[\"agent_%s\" % x][attribute_plot][real_time] == 2: ##Represent cured\n",
|
||||||
" value_cured += 1\n",
|
" value_cured += 1\n",
|
||||||
" activity = True\n",
|
" activity = True\n",
|
||||||
" if models.networkStatus[\"agente_%s\" % x][attribute_plot][real_time] == 3: ##Representar vaccinated\n",
|
" if models.networkStatus[\"agent_%s\" % x][attribute_plot][real_time] == 3: ##Represent vaccinated\n",
|
||||||
" value_vaccinated += 1\n",
|
" value_vaccinated += 1\n",
|
||||||
" activity = True\n",
|
" activity = True\n",
|
||||||
"\n",
|
"\n",
|
||||||
" if activity:\n",
|
" if activity:\n",
|
||||||
" x_values.append(real_time)\n",
|
" x_values.append(real_time)\n",
|
||||||
" infected_values.append(value_infectados)\n",
|
" infected_values.append(value_infected)\n",
|
||||||
" neutral_values.append(value_neutral)\n",
|
" neutral_values.append(value_neutral)\n",
|
||||||
" cured_values.append(value_cured)\n",
|
" cured_values.append(value_cured)\n",
|
||||||
" vaccinated_values.append(value_vaccinated)\n",
|
" vaccinated_values.append(value_vaccinated)\n",
|
||||||
@ -353,7 +353,7 @@
|
|||||||
" yield self.env.timeout(settings.timeout)\n",
|
" yield self.env.timeout(settings.timeout)\n",
|
||||||
"\n",
|
"\n",
|
||||||
" def step(self, now):\n",
|
" def step(self, now):\n",
|
||||||
" networkStatus['agente_%s'% self.id] = self.a_json()\n",
|
" networkStatus['agent_%s'% self.id] = self.a_json()\n",
|
||||||
"\n",
|
"\n",
|
||||||
" def a_json(self):\n",
|
" def a_json(self):\n",
|
||||||
" final = {}\n",
|
" final = {}\n",
|
||||||
|
Loading…
Reference in New Issue
Block a user