fminimax does not iterate

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?

 채택된 답변

Alan Weiss
Alan Weiss 2013년 8월 30일

1 개 추천

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

Sannsch
Sannsch 2013년 9월 1일
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.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

제품

질문:

2013년 8월 30일

Community Treasure Hunt

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

Start Hunting!

Translated by