solving constrait optimization using external varibales
정보
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
이전 댓글 표시
Hi i am trying to solve constarint optimization usinf for loop, Actually i trying to maximize x with this constrains but olsa i have external variable that has some interval. Therefore i tyr to determined them using for loop but it is not working . What am i doing wrong?
for g=0:.1:0.5 % start at 0, step by 0.1 up to 1
for t = 0.5:.1:1
if g +t <= 0.5
fun = @(x)-((1-x)+ log(x)+log(g)+0*t);
lb = 0;
ub = 1;
A = [];
b = [];
Aeq = [];
beq = [];
x0 = (lb+ub)/2;
nonlcon = [];
options = optimoptions('fmincon','Algorithm','interior-point',...
'OptimalityTolerance',1e-20, ...
'StepTolerance', 1e-20, ...
'ConstraintTolerance', 1e-20, ...
'Display', 'iter' );
[x, fval] = fmincon(fun, x0, A, b, Aeq, beq, lb, ub, nonlcon, options);
disp(x)
disp(fval)
else
fprintf('\nThe number of people who agree is\n',x);
end
end
댓글 수: 1
Sinem Senel
2020년 8월 11일
답변 (0개)
이 질문은 마감되었습니다.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
