[英]How to use a older version of NLopt in R
I am trying to replicate a code that uses the nloptr
function. The only difference is that I am using another version:我正在尝试复制使用nloptr
function 的代码。唯一的区别是我使用的是另一个版本:
As you can see here in my output I am using version 2.7.1正如您在我的 output 中看到的,我使用的是 2.7.1 版
> # optimization result
> opt_result
Call:
nloptr(x0 = theta_init, eval_f = obj, eval_grad_f = grad, lb = lb, ub = ub, opts = opts)
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....: 15
Termination conditions: xtol_rel: 0.001 maxeval: 10000
Number of inequality constraints: 0
Number of equality constraints: 0
Optimal value of objective function: 121997.975378908
Optimal value of controls: 10.04425 52.50066 1 0.218371
However, in the original code they are using the 2.4.2 version of NLopt但是,在原始代码中,他们使用的是 NLopt 的 2.4.2 版本
Is there a way I can use the 2.4.2 version now?有没有办法让我现在可以使用 2.4.2 版本? Because I want to have the exact same values (the code is the same, I just copied and pasted it).因为我想要完全相同的值(代码是相同的,我只是复制并粘贴它)。
Thanks in advance!提前致谢!
Old versions of the NLopt sources are available at the NLopt GitHub page, under releases , starting with version 2.4.2. NLopt 源代码的旧版本可在 NLopt GitHub 页面的releases下找到,从版本 2.4.2 开始。 You can install on the command line in the usual way:您可以按照通常的方式在命令行上安装:
$ curl -LO https://github.com/stevengj/nlopt/archive/refs/tags/nlopt-2.4.2.tar.gz
$ tar -xvf nlopt-2.4.2.tar.gz
$ cd nlopt-2.4.2
$ ./configure
$ make
$ sudo make install
Run sudo make uninstall
in the same directory to uninstall, eg, if you later decide to revert to the newest version.在同一目录中运行sudo make uninstall
以卸载,例如,如果您稍后决定恢复到最新版本。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.