Commit e5d60a98 authored by Ahmad Reza's avatar Ahmad Reza
Browse files

Some name changes in the config. mm_limit is renamed to

memory_limitation
parent bb888ff7
......@@ -17,9 +17,10 @@ random_order = 1
window_size_x = 600
window_size_y = 800
## 0 = Unlimited world size
## 1 = limited world size
border = 0.0
[World]
## False = Unlimited world size
## True = limited world size
border = False
## Swarm-World world size in points
## Works only with border flag set on 1
......@@ -31,10 +32,10 @@ max_particles = 10000
[Matter]
## with memory (mm) limitation 1=Yes 0=No
mm_limitation = 0
memory_limitation = False
## mm size in quantity
## Works only with mm_limitation flag set on 1
## Works only with memory_limitation flag set on 1
marker_mm_size = 2
particle_mm_size = 2
tile_mm_size = 2
......
......@@ -11,6 +11,19 @@ class ConfigData:
self.max_round = config.getint("Simulator", "max_round")
self.random_order = config.getboolean("Simulator", "random_order")
self.visualization = config.getint("Simulator", "visualization")
self.window_size_x = config.getint("Simulator", "window_size_x")
self.window_size_y = config.getint("Simulator", "window_size_y")
self.size_x = config.getfloat("World", "size_x")
self.size_y = config.getfloat("World", "size_y")
self.border = config.getboolean("World", "border")
self.max_particles = config.getint("World", "max_particles")
self.memory_limitation = config.getboolean("Matter", "memory_limitation")
self.particle_mm_size = config.getint("Matter", "particle_mm_size")
self.tile_mm_size = config.getint("Matter", "tile_mm_size")
self.marker_mm_size = config.getint("Matter", "marker_mm_size")
try:
self.scenario = config.get("File", "scenario")
except configparser.NoOptionError as noe:
......@@ -20,16 +33,6 @@ class ConfigData:
self.solution = config.get("File", "solution")
except configparser.NoOptionError as noe:
self.solution = "solution.py"
self.size_x = config.getfloat("Simulator", "size_x")
self.size_y = config.getfloat("Simulator", "size_y")
self.window_size_x = config.getint("Simulator", "window_size_x")
self.window_size_y = config.getint("Simulator", "window_size_y")
self.border = config.getfloat("Simulator", "border")
self.max_particles = config.getint("Simulator", "max_particles")
self.mm_limitation = config.getboolean("Matter", "mm_limitation")
self.particle_mm_size = config.getint("Matter", "particle_mm_size")
self.tile_mm_size = config.getint("Matter", "tile_mm_size")
self.marker_mm_size = config.getint("Matter", "marker_mm_size")
self.local_time = datetime.now().strftime('%Y-%m-%d_%H-%M-%S')[:-1]
self.multiple_sim = 0
......@@ -21,7 +21,7 @@ class Matter:
self.__modified=False
self.__alpha=alpha
self.type = type
self.mm_limit = world.config_data.mm_limitation
self.memory_limitation = world.config_data.memory_limitation
self.mm_size = mm_size
self.modified = False
self.created = False
......@@ -90,7 +90,7 @@ class Matter:
:return: True: Successful written into the memory; False: Unsuccessful
"""
if (self.mm_limit == True and len( self._memory) < self.mm_size) or not self.mm_limit:
if (self.memory_limitation == True and len( self._memory) < self.mm_size) or not self.memory_limitation:
self._memory[key] = data
self.world.csv_round.update_metrics(memory_write=1)
return True
......@@ -107,7 +107,7 @@ class Matter:
:return: True: Successful written into the memory; False: Unsuccessful
"""
if (self.mm_limit == True and len( self._memory) < self.mm_size) or not self.mm_limit:
if (self.memory_limitation == True and len( self._memory) < self.mm_size) or not self.memory_limitation:
self._memory[datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S.%f')[:-1]] = data
self.world.csv_round.update_metrics(memory_write=1)
return True
......
......@@ -81,14 +81,6 @@ class World:
self.csv_round.success()
self.set_end()
def get_max_round(self):
"""
Return the initialized endding round number
:return: The maximum round number
"""
return self.config_data.max_round
def get_actual_round(self):
"""
The actual round number
......@@ -458,7 +450,6 @@ class World:
else:
return False
def add_marker(self, x, y, color=black, alpha=1):
"""
Add a tile to the world database
......@@ -489,7 +480,6 @@ class World:
logging.info("for x %f and y %f not possible to draw ", x, y)
return False
def remove_marker(self, id):
"""
Removes a tile with a given tile_id from to the world database
......@@ -520,7 +510,6 @@ class World:
else:
return False
def remove_marker_on(self, coords):
"""
Removes a marker on a give coordinat from to the world database
......
......@@ -24,7 +24,7 @@ def swarm_sim(argv):
swarm_sim_world = world.World(config_data)
while swarm_sim_world.get_actual_round() <= swarm_sim_world.get_max_round() and swarm_sim_world.get_end() is False:
while swarm_sim_world.get_actual_round() <= config_data.max_round and swarm_sim_world.get_end() is False:
round_start_timestamp = time.perf_counter()
run_solution(swarm_sim_world)
if config_data.visualization:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment