Result of fmincon()

조회 수: 3 (최근 30일)
Maroco Sc
Maroco Sc 2019년 10월 2일
댓글: Maroco Sc 2019년 10월 11일
In this code:
x0 = [1 1]; % Starting point
UB = [1 1]; % Upper bound
LB = [0 0]; % Lower bound
options = optimset('LargeScale', 'off', 'MaxFunEvals', 1000, 'TolFun', 1e-6, 'TolCon', 1e-6, 'disp', 'off');
% Create constraint bound vector:
n = 50; % Number of Pareto points
eps_min = -1; eps_max = 0;
epsval = eps_min:(eps_max - eps_min)/(n-1):eps_max;
% Solve scalarized problem for each epsilon value:
xopt = zeros(n,length(x0));
for i=1:n
xopt(i,:)=fmincon('obj_eps', x0, [], [], [], [], LB, UB,...
'nonlcon_eps', options, epsval(i));
end
function [C,Ceq] = nonlcon_eps(x, epsval)
Ceq = [];
C(1) =x(2)+(x(1)-1)^3;
C(2) = -x(1) - epsval;
this solution
xopt(1,:) = [0.999999999395037, 2.08338048669441e-10]
has been obtaind by fmincon() . However, when I use it to get the constraints value, the results were:
C(1) = 2.0834e-10
C(2) = 6.0496e-10
C(1) and C(2) are > 0, the solution xopt(1,:) violated the constraints. Therefore, it should not be returned by fmincon().
I could not understand why the fmincon() returned it as a best solution?

답변 (1개)

Alan Weiss
Alan Weiss 2019년 10월 6일
The returned values are within the constraint tolerance. See Tolerances and Stopping Criteria.
Alan Weiss
MATLAB mathematical toolbox documentation
  댓글 수: 2
Matt J
Matt J 2019년 10월 6일
Note however that you can do a bit better with constraint enforcment by replacing C(2) with a bound constraint
UB = [1 1]; % Upper bound
LB = [-epsval 0]; % Lower bound
simple bound constraints can be enforced exactly by fmincon.
Maroco Sc
Maroco Sc 2019년 10월 11일
Thank you. Could you please check this question

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Solver Outputs and Iterative Display에 대해 자세히 알아보기

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by