任意约束的R优化 [英] Optimization in R with arbitrary constraints

查看:325
本文介绍了任意约束的R优化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Excel中做过,但需要在R中运行一个适当的模拟。

I have done it in Excel but need to run a proper simulation in R.

我需要最小化函数 F / code>( x 是向量),同时具有 sum(x)= 1 x 中的值是 [0,1] ,另一个函数 G(x) G_0

I need to minimize function F(x) (x is a vector) while having constraints that sum(x)=1, all values in x are [0,1] and another function G(x) > G_0.

我尝试过 optim constrOptim 。他们没有给你这个选择。

I have tried it with optim and constrOptim. None of them give you this option.

推荐答案

您所指的问题是(假设)使用非线性约束的非线性优化。这是最一般的优化问题之一。

The problem you are referring to is (presumably) a non-linear optimization with non-linear constraints. This is one of the most general optimization problems.

我用于这些目的的包名为 nloptr 请参阅这里。从我的经验,它是多才多艺,快速。您可以通过相应地设置 eval_g_eq eval_g_ineq 来指定等于和不等于constaints。如果明确地知道雅可比(可以从分析得出),则指定它们用于更快的收敛;

The package I have used for these purposes is called nloptr: see here. From my experience, it is both versatile and fast. You can specify both equality and inequality constaints by setting eval_g_eq and eval_g_ineq, correspondingly. If the jacobians are known explicitly (can be derived analytically), specify them for faster convergence; otherwise, a numerical approximation is used.

使用此列表作为优化问题的一般参考。

Use this list as a general reference to optimization problems.

这篇关于任意约束的R优化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆