fminimax does not iterate
6 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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?
0 Kommentare
Akzeptierte Antwort
Alan Weiss
am 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
Weitere Antworten (0)
Siehe auch
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!