Skip to content

Commit d98f926

Browse files
optimize returns a symbol
1 parent a755a0c commit d98f926

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

lib/OptimizationNLopt/src/OptimizationNLopt.jl

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -77,27 +77,25 @@ function __map_optimizer_args!(prob::OptimizationProblem, opt::NLopt.Opt;
7777
return nothing
7878
end
7979

80-
function __nlopt_status_to_ReturnCode(status::NLopt.Result)
81-
if status in [
80+
function __nlopt_status_to_ReturnCode(status::Symbol)
81+
if status in Symbol.([
8282
NLopt.SUCCESS,
8383
NLopt.STOPVAL_REACHED,
8484
NLopt.FTOL_REACHED,
8585
NLopt.XTOL_REACHED,
86-
]
86+
])
8787
return ReturnCode.Success
88-
elseif status in [
89-
NLopt.MAXEVAL_REACHED,
90-
]
88+
elseif status == Symbol(NLopt.MAXEVAL_REACHED)
9189
return ReturnCode.MaxIters
92-
elseif status == NLopt.MAXTIME_REACHED
90+
elseif status == Symbol(NLopt.MAXTIME_REACHED)
9391
return ReturnCode.MaxTime
94-
elseif status in [
92+
elseif status in Symbol.([
9593
NLopt.OUT_OF_MEMORY,
9694
NLopt.INVALID_ARGS,
9795
NLopt.FAILURE,
9896
NLopt.ROUNDOFF_LIMITED,
9997
NLopt.FORCED_STOP,
100-
]
98+
])
10199
return ReturnCode.Failure
102100
else
103101
return ReturnCode.Default

0 commit comments

Comments
 (0)