我有一个线性约束模型和一个非线性目标函数,我试图用MATLAB的"fmincon“工具箱来求解它。实际上,Aineq是24*13矩阵,Aeq也是24*13矩阵。但是当我插入这个命令时:
>> [x , lambda] = fmincon(@MP_ObjF,Aineq,bineq,Aeq,beq);
我遇到了这个错误:
Warning: Trust-region-reflective method does not currently solve this type of
problem, using active-set (line search) instead.
我目前正在使用fmincon来最小化关于18*18矩阵的对数似然函数。虽然在较小的问题上算法非常快,但在当前设置下需要大约2小时才能收敛-当我迭代这个最小化问题时,运行代码可能需要2周时间。 有没有一种基于matlab的免费的fmincon替代方案,可以提高解决此类特定问题的速度?(在非here解决方案here中讨论了昂贵的解决方案。)或者我是否需要从matlab调用python脚本? 我想要最小化的函数: function [L] = logL(A, U, Sigma_e, T, lags)
% A - parameters to optimize w.r.t
logL = 0;
for
我一直在尝试用matlab来解决这个问题,但我在解决这个问题时遇到了一些麻烦。 下面是问题:确定函数的局部最小值、局部最大值和拐点 下面是函数 ? 这是我的matlab脚本 syms [x1,x2]
f = 3*x1.^2+2*x1.*x2+2*x2.^2+7;
G = gradient(f,[x1,x2]);
S = solve(G(1),G(2));
[S.x1 S.x2]
%settting gradient to zero givens x=(0, 0) as the only candidate minimum point
H = hessian(f,[x1,x2]
我使用的是Matlab的fmincon,但是优化停止了,并显示以下消息
fmincon stopped because the size of the current step is less than
the selected value of the step size tolerance.
我将TolX设置为10^-10,并将Tolfun设置为10^-10
我检查了日志,一阶最优性是198。因此,这肯定不是最佳的解决方案。有什么可能出错?
此外,我使用了不同版本的matlab R2013b和R2014a,对于相同的代码和数据,它们有不同的结果。matlab R2013b中的fmincon
我正在尝试使用multistart / fmincon找到一个最佳点。Matlab找到一个局部最小值,对于该局部最小值,输出结构中给出了以下消息:
Local minimum found that satisfies the constraints.
Optimization completed because the objective function is non-decreasing in feasible directions,
to within the value of the optimality tolerance,and constraints are satisfied
我的输出矩阵Y为:
Y=E*A;
哪里
E=Exponential phase vectors (1xM)
A=Fixed complex numbers (MxN)
说,
M=4;N=256;
a = complex(randn(4,256),randn(4,256)); % coefficient matrix of "A"
theta=has four values
目标
What range of theta will minimize the peak of sum expression of a kth column
of "Y"
我想用fmincon来拟合方程上的两个参数。我用lsqnonlin做到了这一点,但我想利用fmincon的不等式约束。
问题是,我不能像在lsqnonlin中那样将测量数据的两个向量(例如y(x) )传递到函数中。
我该怎么做呢?
estim = lsqnonlin(@fit_simp,X0,lb,ub,options,X,Y) %X,Y are the measured data in vectors, y(x)
estim = fmincon(@fit_simp,X0,[],[],[],[],[],[],nonlcon,options);
我将如何传递测量到的向量?
我试图用matlab中的fmincon函数来求解具有非线性约束的非线性优化问题。但是,我得到了以下错误:“初始用户提供的非线性约束函数评估失败. FMINCON不能继续.”我经常上网,但我无法修复它。它的接缝是一个非常普遍的错误信息。我用3个变量把我的问题做得很小,但我还是得到了同样的结果。以下是我的职责:
function main()
global x
global y
y(2)=15;
y(3)=15;
a=[0.01;0.05];
opts = optimoptions(@fmincon,'Algorithm','interior-point')
[x,
我有一个大小为3065x57的数据矩阵X和大小为3065x1的列矩阵y,我希望计算argmin --在下面的代码中定义的函数sum。
我尝试了下面编写的代码,fminsearch等等,但是都没有工作。另一个问题是,我有57个符号变量,所以MATLAB的计算非常慢。
怎样才能加快计算速度?
function [] = argmin(X,y)
w = transpose(sym('w', [1 57]));
sum = 0;
for i=1:3065
sum = sum + log(1+exp(transpose(w)*transpose(X(i,:)))) -...
运行:
function test()
Aeq = ones(1,4); beq = 1;
a0 = [.2,.2,.2,.1];
[a,f] = fmincon(@ttest,a0,[],[],Aeq,beq);
结果:
Warning: Trust-region-reflective algorithm does not solve
this type of problem, using active-set algorithm. You
could also try the interior-point or sqp algorithms: set
the Algorithm opti
我使用的是优化函数"fmincon“,在某些情况下它不收敛。我必须找出这些情况并采取必要的措施,但使用的所有方法都无法捕获错误,因此我继续得到错误:
No feasible solution found.
fmincon stopped because the size of the current search direction is less than
twice the default value of the step size tolerance but constraints are not
satisfied to within the selected value
我正在使用fmincon来解决一个问题。这个问题有一些用矩阵A和B表示的线性不等式约束,我可以用2种方式写出这些约束,并且应该得到类似的结果。但奇怪的是我得到了不同的解决方案。为什么会这样呢?
1)首先,我可以将约束提供给'fmincon‘函数,如下所示:
[Xsqp, FUN ,FLAG ,Options] = fmincon(@(X)SQP(X,Dat),X,A,B,[],[],lb,ub,@(X)SQPnolcon(X,Dat,A,B),options);
% I comment the line 'C=A*X'-B;' in the function &
我试图用MATLAB的fmincon函数来解决一个问题。下面显示了一个等式,为此我使用一些时间点生成了测试数据。我希望使用优化方法,根据生成的测试数据估计参数x(1)、x(2)和x(3)。当前使用fmincon估计的参数与用于生成数据的初始参数不接近。任何帮助都将不胜感激。
测试数据.时间点= 10:10:300,500,700,1000;x= 0.1,0.5,0.3;兴趣数据%参数=使用测试方程生成数据的x(1)*sin(x(2).*Timepoints)+log(x(3).*Timepoints);%
% Parameters used to run the fmincon
x0 = [0