fmincon does not fulfil constraints
4 views (last 30 days)
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:
But within the results these conditions are not fulfilled:
Here the conditions:
function [c,ceq] = bedMarkt(x,AraucoEnergy)
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
Alan Weiss on 28 Apr 2022
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).
MATLAB mathematical toolbox documentation
More Answers (1)
Matt J on 29 Apr 2022
Edited: Matt J on 29 Apr 2022
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?