@@ -114,13 +114,14 @@ def main():
114114 sys .stderr .flush ()
115115 sys .stdout .flush ()
116116
117+ def method_note (method ):
118+ is_nonconstrained = method in SCIPY_OPTIMIZE_NONCONSTRAINED_METHODS or IS_NONCONSTRAINED (method )
119+ return ' \N{DAGGER} ' if is_nonconstrained else ''
120+
117121 header = f'{ "Test function" :24s} \t { "Method" :24s} \t N Evals\t Error %\t Duration' .expandtabs (4 )
118122 print (header , '—' * len (header ), sep = '\n ' )
119123 for r in sorted (results , key = lambda r : (r ['func' ], r ['error' ], r ['nfev' ], r ['method' ])):
120- is_nonconstrained = (r ['method' ] in SCIPY_OPTIMIZE_NONCONSTRAINED_METHODS or
121- IS_NONCONSTRAINED (r ['method' ]))
122- note = '\N{DAGGER} ' if is_nonconstrained else ''
123- print (f"{ r ['func' ]:24s} \t { r ['method' ] + note :24s} \t { str (r ['nfev' ]):>6s} { ('' if r ['success' ] else '*' )} \t { r ['error' ]:7d} \t { r ['duration' ]:5.2f} " .expandtabs (4 )) # noqa: E501
124+ print (f"{ r ['func' ]:24s} \t { r ['method' ] + method_note (r ['method' ]):24s} \t { str (r ['nfev' ]):>6s} { ('' if r ['success' ] else '*' )} \t { r ['error' ]:7d} \t { r ['duration' ]:5.2f} " .expandtabs (4 )) # noqa: E501
124125
125126 print ('\n ' )
126127
@@ -139,7 +140,7 @@ def key_func(r):
139140 )
140141 for k , g in [(k , list (g )) for k , g in groupby (sorted (results , key = key_func ), key = key_func )]],
141142 key = lambda g : (- g [2 ], g [1 ], g [3 ])):
142- print (f"{ method :24s} \t { success_pct :6d} %\t { nfev :7d} \t { error :7d} \t { duration :8.2f} " .expandtabs (4 ))
143+ print (f"{ method + method_note ( method ) :24s} \t { success_pct :6d} %\t { nfev :7d} \t { error :7d} \t { duration :8.2f} " .expandtabs (4 )) # noqa:E501
143144
144145 print ('\n ' )
145146 print ('* Did not finish / unexpected result.\n '
0 commit comments