MATLAB: Fminimax does not iterate

fminimaxfunctionMATLABoptimization

Hi,
I am trying to minimise the biggest value of these functions:
function f = constraintfunction(x, A, B, C, C, numberCasesNominal, numberCasesBraking)
f(1) = (calculateElementsSmallerThan(x, numberCasesNominal, A, B) + calculateElementsBiggerThanOrEqual(x, numberCasesBraking, C, D)) / (numberCasesBraking + numberCasesNominal);
f(2) = calculateElementsSmallerThan(x, numberCasesNominal, A, B)/numberCasesNominal;
f(3) = calculateElementsBiggerThanOrEqual(x, numberCasesBraking, C, D)/numberCasesBraking;
I am calling the minimax function with
x0 = 50;
f = @(x)constraintfunction(x,A, B, C, D, numberCasesNominal, numberCasesBraking);
x = fminimax(f, x0);
No matter what I use as a starting guess for x0, say 50, I get exactly that value as a result. I saw that Matlab is going through the functions f(1) to f(3) once with that value without changing x at all.
Am I doing anything obviously wrong?

Best Answer

fminimax is a gradient-based solver, meaning the first thing it does is take f(x+delta) and compare it to f(x), where delta is a small number such as 1e-8. If your constraintfunction is flat, meaning it doesn't change at all for small changes in x, then fminimax thinks it found a solution at the initial point.
But for a one-dimensional problem such as yours, why not just evaluate f(x) for a whole range of x, and then pick out the best x by hand, so to speak?
Alan Weiss
MATLAB mathematical toolbox documentation