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

Sorted the output attrubutes and added scenario to it.

parent 74e8dfb5
......@@ -109,11 +109,12 @@ class CsvParticleData:
class CsvRoundData:
def __init__(self, sim, task=0, solution=0, seed=20, particle_num=0, tiles_num=0, locations_num=0,
def __init__(self, sim, task=0, scenario=0, solution=0, seed=20, particle_num=0, tiles_num=0, locations_num=0,
steps=0, directory="outputs/"):
self.sim = sim
self.task = task
self.scenario=scenario
self.solution = solution
self.actual_round=sim.get_actual_round()
self.seed = seed
......@@ -165,14 +166,8 @@ class CsvRoundData:
self.csv_file = open(self.file_name, 'w', newline='')
self.writer_round = csv.writer(self.csv_file)
self.writer_round.writerow(['',
'Round Number', 'Seed','solution',
'Location Counter',
'Location Created', 'Location Created Sum',
'Location Deleted', 'Location Deleted Sum',
'Location Read', 'Location Read Sum',
'Location Write', 'Location Write Sum',
'Memory Read', 'Memory Read Sum',
'Memory Write', 'Memory Write Sum',
'scenario', 'solution', 'Seed', 'Round Number',
'Success Counter', 'Success Round',
'Particle Counter',
'Particles Created', 'Particles Created Sum',
'Particles Deleted', 'Particles Deleted Sum',
......@@ -181,7 +176,13 @@ class CsvRoundData:
'Particle Steps', 'Particle Steps Sum',
'Particles Taken', 'Particles Taken Sum',
'Particle Write', 'Particle Write Sum',
'Success Counter', 'Success Round',
'Memory Read', 'Memory Read Sum',
'Memory Write', 'Memory Write Sum',
'Location Counter',
'Location Created', 'Location Created Sum',
'Location Deleted', 'Location Deleted Sum',
'Location Read', 'Location Read Sum',
'Location Write', 'Location Write Sum',
'Tile Counter',
'Tiles Created', 'Tiles Created Sum',
'Tiles Deleted', 'Tiles Deleted Sum',
......@@ -274,12 +275,8 @@ class CsvRoundData:
logging.debug("CSV: Ending writing_rounds")
def next_line(self, round):
csv_iterator = ['',round, self.seed, self.solution,
self.locations_num, self.location_created, self.location_created_sum,
self.location_deleted, self.location_deleted_sum,
self.location_read, self.location_read_sum,
self.location_write, self.location_write_sum,
self.memory_read, self.memory_read_sum, self.memory_write, self.memory_write_sum,
csv_iterator = ['', self.scenario, self.solution, self.seed, round,
self.success_counter, self.success_round,
self.particle_num, self.particle_created, self.particle_created_sum,
self.particle_deleted, self.particle_deleted_sum,
self.particles_dropped, self.particles_dropped_sum,
......@@ -287,7 +284,11 @@ class CsvRoundData:
self.steps, self.steps_sum,
self.particles_taken, self.particles_taken_sum,
self.particle_write, self.particle_write_sum,
self.success_counter, self.success_round,
self.memory_read, self.memory_read_sum, self.memory_write, self.memory_write_sum,
self.locations_num, self.location_created, self.location_created_sum,
self.location_deleted, self.location_deleted_sum,
self.location_read, self.location_read_sum,
self.location_write, self.location_write_sum,
self.tile_num, self.tile_created, self.tile_created_sum,
self.tile_deleted, self.tile_deleted_sum, self.tiles_dropped, self.tiles_dropped_sum,
self.tile_read, self.tile_read_sum, self.tiles_taken, self.tiles_taken_sum,
......@@ -323,16 +324,11 @@ class CsvRoundData:
csv_file = open(file_name, 'w', newline='')
writer_round = csv.writer(csv_file)
"""Average Min Max for all other metrics"""
writer_round.writerow(['Seed', 'Rounds Total',
'Solution', 'Particle Counter', 'Foods Sources Counter', 'Pheromones Counter',
writer_round.writerow(['Scenario','Solution', 'Seed', 'Rounds Total',
'Particle Counter',
'Success Rate Sum', 'Success Ratio',
'Location Counter',
'Location Created Sum', 'Location Created Avg',
'Location Created Min', 'Location Created Max',
'Location Deleted Sum', 'Location Deleted Avg',
'Location Deleted Min', 'Location Deleted Max',
'Location Read Sum', 'Location Read Avg', 'Location Read Min', 'Location Read Max',
'Location Write Sum', 'Location Write Avg', 'Location Write Min', 'Location Write Max',
'Success Rate Avg', 'Success Rate Min', 'Success Rate Max',
'Success Round Min', 'Success Round Max',
'Particle Counter',
'Particles Created Sum', 'Particles Created Avg',
'Particles Created Min', 'Particles Created Max',
......@@ -346,10 +342,15 @@ class CsvRoundData:
'Particles Taken Sum', 'Particles Taken Avg',
'Particles Taken Min', 'Particles Taken Max',
'Particle Write Sum', 'Particle Write Avg', 'Particle Write Min', 'Particle Write Max',
'Location Counter',
'Location Created Sum', 'Location Created Avg',
'Location Created Min', 'Location Created Max',
'Location Deleted Sum', 'Location Deleted Avg',
'Location Deleted Min', 'Location Deleted Max',
'Location Read Sum', 'Location Read Avg', 'Location Read Min', 'Location Read Max',
'Location Write Sum', 'Location Write Avg', 'Location Write Min', 'Location Write Max',
'Memory Read Sum', 'Memory Read Avg', 'Memory Read Min', 'Memory Read Max',
'Memory Write Sum', 'Memory Write Avg', 'Memory Write Min', 'Memory Write Max',
'Success Rate Sum', 'Success Rate Avg', 'Success Rate Min', 'Success Rate Max',
'Success Round Min', 'Success Round Max',
'Tile Counter',
'Tiles Created Sum', 'Tiles Created Avg', 'Tiles Created Min', 'Tiles Created Max',
'Tiles Deleted Sum', 'Tiles Deleted Avg', 'Tiles Deleted Min', 'Tiles Deleted Max',
......@@ -358,24 +359,17 @@ class CsvRoundData:
'Tiles Taken Sum', 'Tiles Taken Avg', 'Tiles Taken Min', 'Tiles Taken Max',
'Tile Write Sum', 'Tile Write Avg', 'Tile Write Min', 'Tile Write Max'])
csv_interator = [self.seed, data['Round Number'].count(),
csv_interator = [self.scenario, self.solution, self.seed, data['Round Number'].count(),
self.solution, self.particle_num, self.tile_num, self.locations_num,
self.particle_num,
data['Success Counter'].sum(),
data['Success Counter'].sum()/ data['Round Number'].sum(),
self.locations_num,
data['Location Created'].sum(), data['Location Created'].mean(),
data['Location Created'].min(), data['Location Created'].max(),
data['Location Deleted'].sum(), data['Location Deleted'].mean(),
data['Location Deleted'].min(), data['Location Deleted'].max(),
data['Location Read'].sum(), data['Location Read'].mean(), data['Location Read'].min(),
data['Location Read'].max(),
data['Success Counter'].mean(), data['Success Counter'].min(),
data['Success Counter'].max(),
data['Location Write'].sum(), data['Location Write'].mean(), data['Location Write'].min(),
data['Location Write'].max(),
data['Success Round'].min(),
data['Success Round'].max(),
self.particle_num,
data['Particles Created'].sum(), data['Particles Created'].mean(),
......@@ -387,7 +381,7 @@ class CsvRoundData:
data['Particles Dropped'].sum(), data['Particles Dropped'].mean(),
data['Particles Dropped'].min(), data['Particles Dropped'].max(),
data['Particle Read'].sum(), data['Particle Read'].mean(),data['Particle Read'].min(),
data['Particle Read'].sum(), data['Particle Read'].mean(), data['Particle Read'].min(),
data['Particle Read'].max(),
data['Particle Steps'].sum(), data['Particle Steps'].mean(),
......@@ -399,17 +393,26 @@ class CsvRoundData:
data['Particle Write'].sum(), data['Particle Write'].mean(), data['Particle Write'].min(),
data['Particle Write'].max(),
self.locations_num,
data['Location Created'].sum(), data['Location Created'].mean(),
data['Location Created'].min(), data['Location Created'].max(),
data['Location Deleted'].sum(), data['Location Deleted'].mean(),
data['Location Deleted'].min(), data['Location Deleted'].max(),
data['Location Read'].sum(), data['Location Read'].mean(), data['Location Read'].min(),
data['Location Read'].max(),
data['Location Write'].sum(), data['Location Write'].mean(), data['Location Write'].min(),
data['Location Write'].max(),
data['Memory Read'].sum(), data['Memory Read'].mean(), data['Memory Read'].min(),
data['Memory Read'].max(),
data['Memory Write'].sum(), data['Memory Write'].mean(), data['Memory Write'].min(),
data['Memory Write'].max(),
data['Success Counter'].sum(), data['Success Counter'].mean(), data['Success Counter'].min(),
data['Success Counter'].max(),
data['Success Round'].min() ,
data['Success Round'].max(),
self.tile_num,
data['Tiles Created'].sum(), data['Tiles Created'].mean(), data['Tiles Created'].min(),
......
Supports Markdown
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