简体   繁体   中英

max min optimization using inbuilt MATLAB function fminimax

How to use fminimax in the max-min optimization? I am confused with the outside negative sign that has to be incorporated in min-max formulation such that max-min optimization problem can be solved using "fminimax". How to include the outside negative sign in my code? The inside negative sign can be taken care of by making the cost function negative. But what about the outside negative sign, how to include that in the code?

By default fminmax try to solve the "global" minimum of all the maximum of your set of objective function. But if you're looking for the maximum of all the minimum, as explained in the doc, you need to add a negative sign for the output AND the set of objective function.

Here is a minimal example:

% Solve minmax:
fun = @(x)[sin(x);cos(x)];
x0 = 1;
x = fminimax(fun,x0)

And

% Solve maxmin:
fun = @(x)-[sin(x);cos(x)]; %fun -> -fun
x0 = 1;
x = -fminimax(fun,x0)       %x   -> -x

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM