Skip to content

Commit 00f0245

Browse files
go back to regex
1 parent 2c6927d commit 00f0245

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

src/utils.jl

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -72,29 +72,29 @@ using SciMLBase: ReturnCode
7272

7373
# Define a dictionary to map regular expressions to ReturnCode values
7474
const STOP_REASON_MAP = Dict(
75-
"Delta fitness .* below tolerance .*" => ReturnCode.Success,
76-
"Fitness .* within tolerance .* of optimum" => ReturnCode.Success,
77-
"CONVERGENCE: NORM_OF_PROJECTED_GRADIENT_<=_PGTOL" => ReturnCode.Success,
78-
"CONVERGENCE: REL_REDUCTION_OF_F_<=_FACTR*EPSMCH" => ReturnCode.Success,
79-
"Terminated" => ReturnCode.Terminated,
80-
"MaxIters|MAXITERS_EXCEED|Max number of steps .* reached" => ReturnCode.MaxIters,
81-
"MaxTime|TIME_LIMIT" => ReturnCode.MaxTime,
82-
"Max time" => ReturnCode.MaxTime,
83-
"DtLessThanMin" => ReturnCode.DtLessThanMin,
84-
"Unstable" => ReturnCode.Unstable,
85-
"InitialFailure" => ReturnCode.InitialFailure,
86-
"ConvergenceFailure|ITERATION_LIMIT" => ReturnCode.ConvergenceFailure,
87-
"Infeasible|INFEASIBLE|DUAL_INFEASIBLE|LOCALLY_INFEASIBLE|INFEASIBLE_OR_UNBOUNDED" => ReturnCode.Infeasible,
88-
"STOP: TOTAL NO. of ITERATIONS REACHED LIMIT" => ReturnCode.MaxIters,
89-
"STOP: TOTAL NO. of f AND g EVALUATIONS EXCEEDS LIMIT" => ReturnCode.MaxIters,
90-
"STOP: ABNORMAL_TERMINATION_IN_LNSRCH" => ReturnCode.Unstable,
91-
"STOP: ERROR INPUT DATA" => ReturnCode.InitialFailure,
92-
"STOP: FTOL.TOO.SMALL" => ReturnCode.ConvergenceFailure,
93-
"STOP: GTOL.TOO.SMALL" => ReturnCode.ConvergenceFailure,
94-
"STOP: XTOL.TOO.SMALL" => ReturnCode.ConvergenceFailure,
95-
"STOP: TERMINATION" => ReturnCode.Terminated,
96-
"Optimization completed" => ReturnCode.Success,
97-
"Convergence achieved" => ReturnCode.Success
75+
r"Delta fitness .* below tolerance .*" => ReturnCode.Success,
76+
r"Fitness .* within tolerance .* of optimum" => ReturnCode.Success,
77+
r"CONVERGENCE: NORM_OF_PROJECTED_GRADIENT_<=_PGTOL" => ReturnCode.Success,
78+
r"^CONVERGENCE: REL_REDUCTION_OF_F_<=_FACTR\*EPSMCH\s*$" => ReturnCode.Success,
79+
r"Terminated" => ReturnCode.Terminated,
80+
r"MaxIters|MAXITERS_EXCEED|Max number of steps .* reached" => ReturnCode.MaxIters,
81+
r"MaxTime|TIME_LIMIT" => ReturnCode.MaxTime,
82+
r"Max time" => ReturnCode.MaxTime,
83+
r"DtLessThanMin" => ReturnCode.DtLessThanMin,
84+
r"Unstable" => ReturnCode.Unstable,
85+
r"InitialFailure" => ReturnCode.InitialFailure,
86+
r"ConvergenceFailure|ITERATION_LIMIT" => ReturnCode.ConvergenceFailure,
87+
r"Infeasible|INFEASIBLE|DUAL_INFEASIBLE|LOCALLY_INFEASIBLE|INFEASIBLE_OR_UNBOUNDED" => ReturnCode.Infeasible,
88+
r"STOP: TOTAL NO. of ITERATIONS REACHED LIMIT" => ReturnCode.MaxIters,
89+
r"STOP: TOTAL NO. of f AND g EVALUATIONS EXCEEDS LIMIT" => ReturnCode.MaxIters,
90+
r"STOP: ABNORMAL_TERMINATION_IN_LNSRCH" => ReturnCode.Unstable,
91+
r"STOP: ERROR INPUT DATA" => ReturnCode.InitialFailure,
92+
r"STOP: FTOL.TOO.SMALL" => ReturnCode.ConvergenceFailure,
93+
r"STOP: GTOL.TOO.SMALL" => ReturnCode.ConvergenceFailure,
94+
r"STOP: XTOL.TOO.SMALL" => ReturnCode.ConvergenceFailure,
95+
r"STOP: TERMINATION" => ReturnCode.Terminated,
96+
r"Optimization completed" => ReturnCode.Success,
97+
r"Convergence achieved" => ReturnCode.Success
9898
)
9999

100100
# Function to deduce ReturnCode from a stop_reason string using the dictionary

0 commit comments

Comments
 (0)