Skip to content

Commit 37f8492

Browse files
Use direct type comparison for AUGLAG check instead of string matching
Per review feedback, updated the AUGLAG algorithm check to directly compare against the specific algorithm types (NLopt.LN_AUGLAG, NLopt.LD_AUGLAG, NLopt.AUGLAG) rather than using string pattern matching. This is cleaner and more maintainable. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 6c61fd0 commit 37f8492

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

lib/OptimizationNLopt/src/OptimizationNLopt.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,7 @@ function __map_optimizer_args!(cache::OptimizationCache, opt::NLopt.Opt;
7070
kwargs...)
7171

7272
# Check if AUGLAG algorithm requires local_method
73-
alg_str = string(opt.algorithm)
74-
if occursin("AUGLAG", alg_str) && local_method === nothing
73+
if opt.algorithm (NLopt.LN_AUGLAG, NLopt.LD_AUGLAG, NLopt.AUGLAG) && local_method === nothing
7574
error("NLopt.$(opt.algorithm) requires a local optimization method. " *
7675
"Please specify a local_method, e.g., solve(prob, NLopt.$(opt.algorithm)(); " *
7776
"local_method = NLopt.LN_NELDERMEAD())")

0 commit comments

Comments
 (0)