fminimax does not iterate

6 views (last 30 days)
Sannsch
Sannsch on 30 Aug 2013
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?

Accepted Answer

Alan Weiss
Alan Weiss on 30 Aug 2013
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
  1 Comment
Sannsch
Sannsch on 1 Sep 2013
You are absolutely right and I had been already afraid that what you explained would be the case.
Due to a lack of time and Matlab knowledge I ended up calculating my optimal x in Excel by hand.

Sign in to comment.

More Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!