我试图在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);
答案 0 :(得分:2)
你的问题有九个限制。如果你制作theta_i = exp(x_i)并在所有地方用这个新变量替换theta_i,也许你的问题可以大大简化为五个约束。因此,您已经消除了积极性约束,新问题取决于x_i(x_i是您的新变量)。好的....你找到x_i的最佳值并计算theta_i = exp(x_i)。当您处理差异或波动时,这是计量经济学中非常常见的替代。
你也可以尝试另一种替换(我以前似乎没有,但似乎有效)消除所有lb或ub ...使y = exp(x)/(1 + exp(x))[逻辑函数]。现在你的问题更容易了,因为它只有一个约束(由A和b给出)并遵循上面的相同过程。