I used the fmincon, but always wrong
xi=1;
CAQL=1.33;CLTPD=1;b1=3*CAQL+abs(xi); b2=3*CLTPD+abs(xi);
alpha=0.01;beta=0.01;
fun=@(n) 0;
x0=[10,1];
nonlcon=@CAQL_CLTPD;
a=fmincon(fun,x0,[],[],[],[],[],[],nonlcon);
function:
function [c,ceq] = CAQL_CLTPD
y=@(x,t) normpdf(t+xi*sqrt(x(1)))+normpdf(t-xi*sqrt(x(1)));
g1=@(x,t) chi2cdf(((x(1)-1)*((b1*sqrt(x(1))-t).^2)./(9*x(1)*x(2)^2)),x(1)-1).*y(x,t);
g2=@(x,t) chi2cdf(((x(1)-1)*((b2*sqrt(x(1))-t).^2)./(9*x(1)*x(2)^2)),x(1)-1).*y(x,t);
c{1} = @(x) -(integral(@(t) g1(x,t),0,3*b1*sqrt(x(1)))-(1-alpha)); % CAQL
c{2} = @(x) (integral(@(t) g2(x,t),0,3*b2*sqrt(x(1)))-beta); % CLTPD
ceq = [];
the error message:
Error using CAQL_CLTPD
Too many input arguments.
Error in fmincon (line 639)
[ctmp,ceqtmp] = feval(confcn{3},X,varargin{:});
Error in Untitled (line 11)
a=fmincon(fun,x0,[],[],[],[],[],[],nonlcon);
Caused by:
Failure in initial nonlinear constraint function evaluation. FMINCON cannot continue.

 채택된 답변

Walter Roberson
Walter Roberson 2019년 10월 31일

0 개 추천

Your nonlinear constraint function must accept the x values that are input, and the returns must be numeric or empty.
You do not have the nonlinear constraint function return a function handle or cell array of function handles.

댓글 수: 2

Annie Chen
Annie Chen 2019년 10월 31일
Sorry, I don't get what you mean.
It means I should return a value from nonlinear constraint function?
But I don't know how to do it, should I need to add or delect something?
function [c,ceq] = CAQL_CLTPD(x)
y=@(x,t) normpdf(t+xi*sqrt(x(1)))+normpdf(t-xi*sqrt(x(1)));
g1=@(x,t) chi2cdf(((x(1)-1)*((b1*sqrt(x(1))-t).^2)./(9*x(1)*x(2)^2)),x(1)-1).*y(x,t);
g2=@(x,t) chi2cdf(((x(1)-1)*((b2*sqrt(x(1))-t).^2)./(9*x(1)*x(2)^2)),x(1)-1).*y(x,t);
cf{1} = @(x) -(integral(@(t) g1(x,t),0,3*b1*sqrt(x(1)))-(1-alpha)); % CAQL
cf{2} = @(x) (integral(@(t) g2(x,t),0,3*b2*sqrt(x(1)))-beta); % CLTPD
c(1) = cf{1}(x);
c(2) = cf{2}(x);
ceq = [];

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Surrogate Optimization에 대해 자세히 알아보기

태그

질문:

2019년 10월 31일

댓글:

2019년 10월 31일

Community Treasure Hunt

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

Start Hunting!

Translated by