Skip to content
Snippets Groups Projects
Commit 78623fbc authored by Sebastien GOYON's avatar Sebastien GOYON
Browse files

Last push

parent ed0a00be
No related branches found
No related tags found
No related merge requests found
No preview for this file type
import sys
from math import sqrt
from random import random, randint
from iotAmak.amas.amas import Amas
......@@ -12,7 +13,7 @@ class AntAmas(Amas):
def on_initial_agents_creation(self):
for _ in range(self.agent_to_create):
self.add_agent("ant")
self.add_agent()
def is_neighbour(self, id_a, id_b):
if id_a == id_b:
......@@ -38,6 +39,18 @@ class AntAmas(Amas):
self.agent_neighbour(j, i)
def to_graph(self) -> dict:
return {
"cycle": self.nbr_cycle,
"point": [
{
"value": randint(0, 10),
"name": elem
}
for elem in ["a", "b", "c"]
]
}
if __name__ == '__main__':
s = AntAmas(str(sys.argv[1]), 15)
s.run()
{
"iotamak_version": "0.0.7",
"iotamak_version": "0.0.8",
"scheduling_type": "sync",
"canvas": {
"height" : 500,
"width" : 500
},
"graph" : {
"height" : 500,
"width" : 500,
"refresh": 10
}
}
\ No newline at end of file
No preview for this file type
......@@ -12,7 +12,7 @@ class AntAmas(Amas):
def on_initial_agents_creation(self):
for _ in range(self.agent_to_create):
self.add_agent("ant_communicating")
self.add_agent()
def is_neighbour(self, id_a, id_b):
if id_a == id_b:
......
{
"iotamak_version": "0.0.7",
"iotamak_version": "0.0.8",
"scheduling_type": "sync",
"canvas": {
......
No preview for this file type
......@@ -10,7 +10,7 @@ class BoxAmas(AsyncAmas):
def on_initial_agents_creation(self):
for i in range(len(self.clients)):
self.add_agent("box", client_ip=self.clients[i].hostname)
self.add_agent(client_ip=self.clients[i].hostname)
if __name__ == '__main__':
......
{
"iotamak_version": "0.0.7",
"iotamak_version": "0.0.8",
"scheduling_type": "async"
}
\ No newline at end of file
No preview for this file type
......@@ -10,7 +10,7 @@ class IotAmas(Amas):
def on_initial_agents_creation(self):
for i in range(len(self.clients)):
self.add_agent("demonstrator", client_ip=self.clients[i].hostname, args=[len(self.clients)])
self.add_agent(client_ip=self.clients[i].hostname, args=[len(self.clients)])
if __name__ == '__main__':
......
{
"iotamak_version": "0.0.7",
"iotamak_version": "0.0.8",
"scheduling_type": "sync",
"com_graph": {
......
File deleted
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment