【问题标题】:Constraints fmincon MATLAB约束 fmincon MATLAB
【发布时间】:2013-03-07 18:22:05
【问题描述】:

我正在尝试在 MATLAB 中使用 fmincon 函数来获取 4 个变量的值。我收到警告:

Local minimum possible. Constraints satisfied.

fmincon stopped because the size of the current search direction is less than
twice the default value of the step size tolerance and constraints are 
satisfied to within the selected value of the constraint tolerance.

<stopping criteria details>

Optimization stopped because the norm of the current search direction, 6.854643e-07,
is less than 2*options.TolX = 1.000000e-06, and the maximum constraint 
violation, -3.940985e-05, is less than options.TolCon = 1.000000e-15.

Optimization Metric                                               Options
norm(search direction) =   6.85e-07                        TolX =   1e-06 (default)
max(constraint violation)  =  -3.94e-05                  TolCon =   1e-15 (selected)

我尝试将 TolFun 和 TolCon 从 1e-6 更改为 1e-10,但仍然收到相同的消息。有没有其他方法可以让它收敛

My code:
A = [1, 1, 0, 0];
b = 1;
lb = [0; 0; 0; 0];
ub = [1; 1; 1; 1];
Aeq = [];
beq = [];
noncoln = [];
init_guess = [.03;.93; long_term_sigma; initial_sigma];
%option = optimset('FunValCheck', 1000);
options = optimset('fmincon');
options = optimset(options, 'MaxFunEvals', 1000, 'MaxIter', 1000, 'Algorithm', 'active-set', 'TolCon', 1e-15, 'TolFun', 1e-15);
func = @(theta)Log_likeli(theta, ret_1000);
%[x, maxim] = fminsearch(@(theta)Log_likeli(theta, ret_1000), init_guess, options);
[x, maxim] = fmincon(func, init_guess, A, b, Aeq, beq, lb, ub, noncoln, options);

【问题讨论】:

  • 警告并不意味着错误。你检查过结果吗?他们是预期的吗?尝试使用建议的值评估您的函数,然后将其中一个输入更改为 eps 以查看新结果是否更大。另外,如果`˙后面有什么,贴出来会很有用。
  • 我已经添加了停止条件的详细信息,不知道我还能改变什么。我从函数中得到的结果不是最优的,我尝试输入实际结果,但是值变成了不同的值
  • 我绝对会建议将 TolX 更改为 1e-15 之类的东西。这将导致更精细的搜索并使您更接近最小值。 Matlab 还说它在约束内是3.940985e-05,所以这不是停止的原因。较小的TolFunTolX 将使您更接近最小值(如果收敛)。 TolCon 只是扩大了您的搜索范围。另外,你能告诉我国旗是什么吗?试试[x, maxim, exitflag] = fmincon(func, init_guess, A, b, Aeq, beq, lb, ub, noncoln, options);

标签: matlab optimization statistics minimize


【解决方案1】:

你的问题有九个限制。如果您使 theta_i =exp(x_i) 并在所有地方用这个新变量替换 theta_i,也许您的问题可以简化为五个约束。因此,您已经消除了积极性约束,新问题取决于 x_i(x_i 是您的新变量)。好的....您找到 x_i 的最佳值并计算 theta_i=exp(x_i)。当您处理方差或波动率时,这是计量经济学中非常常见的替代方法。

您也可以尝试另一种替换(我以前没有出现过,但它似乎有效)以消除所有 lb 或 ub... Make y=exp(x)/(1+exp(x)) [logistic function ]。现在您的问题要容易得多,因为它只有一个约束(由 A 和 b 给出)并遵循上述相同的过程。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-11-08
    • 1970-01-01
    • 2013-12-25
    • 1970-01-01
    • 2021-08-17
    相关资源
    最近更新 更多