fmincon does not fulfil constraints

조회 수: 28 (최근 30일)
Erik Beste
Erik Beste 2022년 4월 28일
편집: Matt J 2022년 5월 2일
Hi Matlab Community,
I am stuck at one point with fmincon and I am not getting anywhere. Your help would be very much appreciated.
I am trying to solve an optimization problem. With two main conditions:
x=fmincon(@(x)fAraucoMarkt(x,AraucoEnergy),x0,[],[],[],[],LB,RB,@(x)bedMarkt(x,AraucoEnergy));
But within the results these conditions are not fulfilled:
Here the conditions:
function [c,ceq] = bedMarkt(x,AraucoEnergy)
minSpeicher=fminSpeich(x,AraucoEnergy);
Restschuld=fRestschuld(x,AraucoEnergy);
c=0.1-minSpeicher;
ceq =Restschuld-0;
end
If I understood everything right than c means that the minSpeicher is always larger than 0.1 right? and that is most of the time not the case.
Maybe you can see already what I am doing wrong otherwise let me know if I could provide more information.
Thanks a lot
Erik

채택된 답변

Alan Weiss
Alan Weiss 2022년 4월 28일
As documented, Iterations Can Violate Constraints. So I am not sure whether you are complaining about intermediate iterations (where the constraints can be violated) or the final result (which should have the constraints violated by no more than options.ConstraintTolerance).
Alan Weiss
MATLAB mathematical toolbox documentation
  댓글 수: 18
Erik Beste
Erik Beste 2022년 5월 2일
Maybe it would be a good idea to include this into the description of the function. I could not find it there anywhere and I guess it is an important information.
Matt J
Matt J 2022년 5월 2일
편집: Matt J 2022년 5월 2일
It's there, but I agree that it really should be at the top of the document, rather than a footnote.
"fmincon is a gradient-based method that is designed to work on problems where the objective and constraint functions are both continuous and have continuous first derivatives."

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

추가 답변 (1개)

Matt J
Matt J 2022년 4월 29일
편집: Matt J 2022년 4월 29일
so I used the debugging now for a while an I noticed one thing. fmincon changes the values of x just very little from step to step. But apart from x (1,1) all the values are integers (but I just do this in the formula fminspeicher)
fmincon does not handle integer-valued variables, and it also doesn't handle functionsthat involve rounding to integers, like with int8. How many combinations of of possible integer values are there for the 3 variables? Could you just loop over them all, solving for x(1) given fixed values for the other three?
  댓글 수: 1
Erik Beste
Erik Beste 2022년 5월 2일
no I think that is not an option thanks anyway

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

카테고리

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

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by