@@ -35,8 +35,9 @@ def __init__(self,
3535
3636
3737 def print_performance (self , cur_result : dict ):
38- print (f"{ cur_result ['Iteration' ]} : Makespan: [min : { cur_result ['Makespan' ]['Min' ]:.2f} , avg : { cur_result ['Makespan' ]['Avg' ]:.2f} ], " + \
39- f"Mean flow time: [min : { cur_result ['Mean flow time' ]['Min' ]:.2f} , avg : { cur_result ['Mean flow time' ]['Avg' ]:.2f} ], " + \
38+ objective_1 , objective_2 , * _ = list (cur_result )
39+ print (f"{ cur_result ['Iteration' ]} : { objective_1 } : [min : { cur_result [objective_1 ]['Min' ]:.2f} , avg : { cur_result [objective_1 ]['Avg' ]:.2f} ], " + \
40+ f"{ objective_2 } : [min : { cur_result [objective_2 ]['Min' ]:.2f} , avg : { cur_result [objective_2 ]['Avg' ]:.2f} ], " + \
4041 f"Spread : { cur_result ['Spread' ]} , n_fronts: { cur_result ['n_fronts' ]} , n_non_dominated_solutions: { cur_result ['n_non_dominated_solutions' ]} " )
4142
4243 def dump_population (self , dump_folder , file_name ):
@@ -150,8 +151,8 @@ def save_objective_space_plot(self, log_path: str, figure_name: str, folder_name
150151 ax .set_title (figure_name )
151152 #ax.set_xticks(np.linspace(np.min(point_list[:, 0])-10, np.max(point_list[:, 0])+10, 10))
152153 #ax.set_yticks(np.linspace(np.min(point_list[:, 1])-10, np.max(point_list[:, 1])+10, 10))
153- ax .set_xlabel ("Makespan" )
154- ax .set_ylabel ("Mean Flow Time" )
154+ ax .set_xlabel (self . pop_object . objectives [ 0 ] )
155+ ax .set_ylabel (self . pop_object . objectives [ 1 ] )
155156
156157 fig .savefig (os .path .join (img_folder , figure_name ))
157158 plt .close ()
@@ -198,6 +199,12 @@ def execute(self):
198199 self .pop_object .non_dominated_sorting ()
199200 self .pop_object .crowding_distance_sort_all_fronts ()
200201 max_iteration = self .n_iterations
202+
203+ previous_makespan_min = np .inf
204+ previous_flow_min = np .inf
205+ cur_makespan_ind = None
206+ cur_flow_ind = None
207+
201208 while self .n_iterations > 0 :
202209 # Higher tournament size -> more elitism, smaller torunament size -> less elitism
203210 self .pop_object .select_parents ()
@@ -213,6 +220,31 @@ def execute(self):
213220 cur_result ["Iteration" ] = max_iteration - self .n_iterations
214221 self .print_performance (cur_result )
215222
223+ # Debug help
224+ #cur_min_makespan = cur_result["Makespan"]["Min"]
225+ #cur_min_mean_flow_time = cur_result["Mean Completion Time"]["Min"]
226+ #if cur_min_makespan > previous_makespan_min or cur_min_mean_flow_time > previous_flow_min:
227+ # print("----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------")
228+ # self.pop_object.non_dominated_sorting()
229+ # self.pop_object.crowding_distance_sort_all_fronts()
230+
231+ #min_makespan_found = False
232+ #min_mean_flow_time_found = False
233+ #for indiv in self.pop_object.R:
234+ # if not min_makespan_found and indiv.cur_fitness[0] == cur_min_makespan:
235+ # min_makespan_found = True
236+ # indiv.watch_individual = True
237+ # cur_makespan_ind = indiv
238+ # elif not min_mean_flow_time_found and indiv.cur_fitness[1] == cur_min_mean_flow_time:
239+ # min_mean_flow_time_found = True
240+ # indiv.watch_individual = True
241+ # cur_flow_ind = indiv
242+ # else:
243+ # indiv.watch_individual = False
244+
245+ #previous_makespan_min = cur_min_makespan
246+ #previous_flow_min = cur_min_mean_flow_time
247+
216248 if self .activate_logging :
217249 # The method will act as generator if logging is active
218250 yield cur_result
0 commit comments