How fmincon really work?
Mostrar comentarios más antiguos
Hello everyone,
So fmicnon in matlab minimize the objective function, technically if we have an objective function that returns a negative values (let's say: objective = cost_negative), then the fmincon will try to minimize it by sending it further to the - infinity right? (for example objective = -1, then fmicnon will try to send it to a number lower than -1 which means -10 or -100 as example)?
if the first statement is correct, then my second question is: let's say we have 2 types of costs (objective = cost_negative + cost_positive), if we give - objective to fmincon this would technically minimize the negative costs to zero and maximize the positive costs?
(I'm using sqp algorithm in order to respect my constraints)
Thank you in advance.
Respuesta aceptada
Más respuestas (1)
Walter Roberson
el 25 de Nov. de 2024
fmincon() always tries to minimize the result of the objective function. If the objective function returns negative values, then fmincon() tries to see if it can be driven even more negative.
objective = cost_negative + cost_positive
It will try to minimize the overall value. It doesn't care how the value is composed. It doesn't know (or care) whether an objective of 10 is composed of 1 negative + 9 positive, or 5 negative and 5 positive, or 9 negative and 1 positive. So no it will not maximize the positive costs.
If you want to minimize the negative costs and maximize the positive costs then use an objective of cost_negative - cost_positive -- assuming that cost_negative is "magnitude by which it would be negative"
1 comentario
imene. B
el 28 de Nov. de 2024
Categorías
Más información sobre Solver Outputs and Iterative Display en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!