Problem using fmincon (initial point and results)

4 ビュー (過去 30 日間)
Heborvi
Heborvi 2015 年 10 月 15 日
編集済み: Zhendong Shang 2018 年 1 月 23 日
hello, I want to use fmincon to solve an optimization problem. The code is
function [r_opt,fval]= Optimization_the_original_problem(dimension,data,sigma)
if strcmp(data,'cir_cercles')
fileID = fopen('cir_cercles','r');
sizeA = [3 400];
formatSpec = '%f %f %f';
end
R= fscanf(fileID,formatSpec,sizeA);
Y=R';
%%%PCA of matrix Y
X=kPCA(Y,dimension,'gaussian',sigma);
n=size(X,1);
D=distanceMatrix(Y);
function f = objfun(r)
S=0;
dimension=2;
for i=1:n
S=S+r(i);
end
for d=1:dimension
S=S+0*r(n+d);
end
f=S;
end
function [c, ceq] = confun(r)
% Nonlinear inequality constraints
temp=0;
k=1;
c=zeros(n*(n-1)/2,1);
for i=1:n
for j=i+1:n
for d=1:dimension
temp=temp+(r(n+d)*(X(i,d)-X(j,d)))^2;
end
c(k)=-r(i)-r(j)+abs(-sqrt(temp)+D(i,j));
temp=0;
k=k+1;
end
end
% Nonlinear equality constraints
ceq = [];
end
for i=1:n
x0(i) =1E-10;
end % Make a starting guess at the solution
for d=1:dimension
x0(n+d)=0;
end
lb=zeros(1,n+dimension);
options = optimoptions(@fmincon,'Display','iter','algorithm', 'interior-point');
[r_opt,fval] = fmincon(@objfun,x0,[],[],[],[],lb,[],@confun,options);
end
When i run the code i obtain this results:
Your initial point x0 is not between bounds lb and ub; FMINCON
shifted x0 to strictly satisfy the bounds.
First-order Norm of
Iter F-count f(x) Feasibility optimality step
0 403 3.960000e+02 1.980e+02 4.049e+01
1 810 4.570948e+02 1.976e+02 2.394e+01 1.130e+01
2 1214 4.727021e+02 1.975e+02 2.393e+01 8.959e-01
3 1617 4.982793e+02 1.973e+02 2.391e+01 1.445e+00
4 2020 4.987509e+02 1.973e+02 2.391e+01 2.646e-02
5 2423 5.086563e+02 1.973e+02 2.390e+01 5.532e-01
6 2826 5.252660e+02 1.971e+02 2.388e+01 9.223e-01
7 3229 5.317084e+02 1.971e+02 2.387e+01 3.561e-01
Solver stopped prematurely.
fmincon stopped because it exceeded the function evaluation limit,
options.MaxFunEvals = 3000 (the default value).
Can someone help me? Thanks in advance.

回答 (1 件)

Zhendong Shang
Zhendong Shang 2018 年 1 月 23 日
編集済み: Zhendong Shang 2018 年 1 月 23 日
try to change the default MaxFunEvals by revising your options, like
options = optimoptions(@fmincon,'Display','iter','algorithm', 'interior-point','MaxFunEvals ',1e6);

カテゴリ

Help Center および File ExchangeSolver Outputs and Iterative Display についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by