@@ -583,6 +583,11 @@ def extract_trailing_integer(s):
583583 )
584584
585585 best_x , best_f , finopt = result
586+ # FINOPT
587+ # -> 1= MATCHED & OPTIMAL
588+ # -> 2= MATCHED & NOT OPTIMAL
589+ # -> 3=NOT MATCHED & NOT OPTIMAL
590+ # -> 4=NOT FEASIBL & NOT OPTIMAL
586591
587592 # if a Khan function is used we first need to convert to pagmo parameters
588593 if khanf :
@@ -597,13 +602,14 @@ def extract_trailing_integer(s):
597602 # pagmo_fitness = [best_f[-1]] + best_f[0 : problem.get_nc()]
598603 population .set_x (idx , best_x ) # , list(pagmo_fitness))
599604
600- # store last result for output
605+ # store last result for get_extra_info() method
601606 self .__last_result = {
602607 "f" : population .champion_f ,
603608 "x" : best_x ,
604609 "con_tol" : problem .c_tol ,
605610 "nec" : problem .get_nec (),
606611 "has_gradient" : problem .has_gradient (),
612+ "finopt" : finopt ,
607613 }
608614
609615 return population
@@ -865,8 +871,15 @@ def get_extra_info(self) -> str:
865871 + "Final objective value ............. {obj}\n "
866872 + "Final constraint violation ........ {con_vio}\n "
867873 + "Final num. of violated constraints {num_vio}\n "
868- + "Successful termination: Optimal Solution Found.\n "
869874 ).format (obj = self .__last_result ["f" ][0 ], con_vio = con_vio , num_vio = num_vio )
875+ if self .__last_result ["finopt" ] == 1 :
876+ result_str += "Successful termination: Optimal Solution Found.\n "
877+ elif self .__last_result ["finopt" ] == 2 :
878+ result_str += "Successful termination: Constraints matched.\n "
879+ elif self .__last_result ["finopt" ] == 3 :
880+ result_str += "Not converged.\n "
881+ elif self .__last_result ["finopt" ] == 4 :
882+ result_str += "Problem appears infeasible.\n "
870883 else :
871884 grad_str = ""
872885 result_str = (
0 commit comments