Skip to content

Commit

Permalink
NLopt: Enable LN_PRAXIS
Browse files Browse the repository at this point in the history
  • Loading branch information
jschueller committed Nov 11, 2024
1 parent eb07b75 commit 733f259
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions lib/src/Base/Optim/NLopt.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,8 @@ void NLopt::InitializeAlgorithmNames()
AlgorithmNames_["GN_ORIG_DIRECT"] = nlopt::GN_ORIG_DIRECT;
AlgorithmNames_["GN_ORIG_DIRECT_L"] = nlopt::GN_ORIG_DIRECT_L;
// GD_STOGO/GD_STOGO_RAND: https://github.com/stevengj/nlopt/issues/529
// LD_LBFGS_NOCEDAL is not wired
AlgorithmNames_["LD_LBFGS"] = nlopt::LD_LBFGS;
// LN_PRAXIS: https://github.com/stevengj/nlopt/issues/528
AlgorithmNames_["LN_PRAXIS"] = nlopt::LN_PRAXIS;
AlgorithmNames_["LD_VAR1"] = nlopt::LD_VAR1;
AlgorithmNames_["LD_VAR2"] = nlopt::LD_VAR2;
AlgorithmNames_["LD_TNEWTON"] = nlopt::LD_TNEWTON;
Expand Down Expand Up @@ -165,6 +164,10 @@ void NLopt::checkProblem(const OptimizationProblem & problem) const
if ((getAlgorithmName() == "LN_NEWUOA") && problem.hasBounds())
throw InvalidArgumentException(HERE) << "Error: LN_NEWUOA algorithm does not support bounds";

// PRAXIS bounds support is buggy https://github.com/stevengj/nlopt/issues/528
if ((getAlgorithmName() == "LN_PRAXIS") && problem.hasBounds())
throw InvalidArgumentException(HERE) << "Error: LN_PRAXIS algorithm does not support bounds";

#ifdef OPENTURNS_HAVE_NLOPT
const UnsignedInteger dimension = problem.getDimension();
const nlopt::algorithm algo = static_cast<nlopt::algorithm>(GetAlgorithmCode(getAlgorithmName()));
Expand Down
2 changes: 1 addition & 1 deletion python/src/NLopt_doc.i.in
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ Here are some properties of the different algorithms:
+----------------------------+-------------------+-----------------------------+
| LN_NEWUOA_BOUND (disabled) | no derivative | bounds |
+----------------------------+-------------------+-----------------------------+
| LN_PRAXIS (disabled) | no derivative | bounds |
| LN_PRAXIS | no derivative | none |
+----------------------------+-------------------+-----------------------------+
| LN_SBPLX | no derivative | bounds |
+----------------------------+-------------------+-----------------------------+
Expand Down

0 comments on commit 733f259

Please sign in to comment.