Interesting that alabama and nloptr both use auglag but alabama gets a lower
objective fn.
I think there could be lots of exploration of controls and settings to play
with to find out
what is going on.
alabama::auglag
f, ci, ce,ob,val: 0 -4.71486e-08 1029.77 1029.77 at [1] -0.610594
4.307408 6.254267 -11.919881
> solfox<-c( 1.576708, 6.456606, 6.195305, -19.008 )
> conobj(solfox)
f, ci, ce,ob,val: 0 -1.031085e-05 1287.707 1287.707 at [1] 1.576708
6.456606 6.195305 -19.008000
[,1]
[1,] 1287.707
ci is the inequality constraint fn, ce the equality one, ob is the raw objective, val the penalized one, then the 4
parameters.
JN
On 2024-12-13 14:44, John Fox wrote:
Dear Daniel et al.,
Following on Duncan's remark and examining the message produced by nloptr(), I simply tried increasing the maximum
number of function evaluations:
------ snip -------
> nloptr(rep(0, 4), f, eval_g_ineq = hin, eval_g_eq = Hx, opts =
+ list("algorithm" = "NLOPT_LN_COBYLA", "xtol_rel" = 1.0e-8,
+ maxeval = 1e5)
+ )
Call:
nloptr(x0 = rep(0, 4), eval_f = f, eval_g_ineq = hin, eval_g_eq = Hx,
opts = list(algorithm = "NLOPT_LN_COBYLA", xtol_rel = 1e-08,
maxeval = 1e+05))
Minimization using NLopt version 2.7.1
NLopt solver status: 4 ( NLOPT_XTOL_REACHED: Optimization stopped
because xtol_rel or xtol_abs (above) was reached. )
Number of Iterations....: 46317
Termination conditions: xtol_rel: 1e-08 maxeval: 1e+05
Number of inequality constraints: 1
Number of equality constraints: 1
Optimal value of objective function: 1287.71725107671
Optimal value of controls: 1.576708 6.456606 6.195305 -19.008
---------- snip ----------
That produces a solution closer to, and better than, the one that you suggested
(which you obtained how?):
> f(c(0.222, 6.999, 6.17, -19.371))
[1] 1325.076
I hope this helps,
John
______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide https://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.