ivo welch
2025-Sep-17  21:36 UTC
[Rd] Suggestion: Add box constraints to optim() default Nelder-Mead
Title says it all. I know this can be done by transformations by the user, but given that interval is so prominent in the ?doc and given that Nelder-Mead is the default method for optim(), it would be nice if the default method would honor this one, too. [could be done (even by me) within the R code because the C code through the arctan transforms] [[alternative HTML version deleted]]
Ben Bolker
2025-Sep-17  23:00 UTC
[Rd] Suggestion: Add box constraints to optim() default Nelder-Mead
For what it's worth:
John Nash (original author of the Pascal implementations of (most of) 
the available algorithms in optim() (including the Nelder-Mead)) has 
long maintained that these implementations could be updated. (Any update 
that changed solutions, rather than adding new functionality, would need 
to be handled carefully for back-compatibility reasons ...)
    Solving the problem of box constraints by transformation to an 
unconstrained space is problematic when the constraints are binding 
(i.e. the minimum is on the boundary of the allowed space) -- the 
transformation essentially moves the solution to a point at infinity, 
leading to infinite flatness ...
    FWIW the Nelder-Mead implementation (?lme4::Nelder_Mead), and the 
one in NLopt (accessible via the nloptr package: 
https://nlopt.readthedocs.io/en/latest/NLopt_Algorithms/#local-derivative-free-optimization
) both allow box constraints.  (The author of NLopt suggests that the 
'subplex' algorithm is generally preferable ...)  According to the CRAN 
optimization task view 
<https://cran.r-project.org/web/views/Optimization.html#general-purpose-continuous-solvers>,
the dfoptim package also has a box-constrained variant of Nelder-Mead ...
   cheers
    Ben Bolker
On 9/17/25 17:36, ivo welch wrote:> Title says it all.
> 
> I know this can be done by transformations by the user, but given that
> interval is so prominent in the ?doc and given that Nelder-Mead is the
> default method for optim(), it would be nice if the default method would
> honor this one, too.
> 
> [could be done (even by me) within the R code because the C code through
> the arctan transforms]
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel