fmincon exitflag 2 and different results with different initial points

4 Ansichten (letzte 30 Tage)
Conrado Neto am 31 Aug. 2020
Bearbeitet: Matt J am 31 Aug. 2020
I am solving a nonlinear optimization problem using fmincon, in which I have only 2 decision variables, with the following lower and upper bounds:
lb = [1228.527,837.942]
ub = [1728.527,1337.942]
and the equality constraint: x1 + x2 = 2566.469
my objective function has no closed form solution and calls a program that returns values depending on the values of x1 and x2.
Here is a plot of the values of the objective function for different values of x1 and x2:
However, this picture may be a bit misleading, since the objective function has several small ups and downs when zoomed in:
If I use fmincon default options, the analysis ends at the initial point as a local minimum.
so I have tried using:
options = optimoptions('fmincon','FiniteDifferenceStepSize',1e-3);
The problem I have is that using different initial points, such as:
x0(1) = lb(1) + 0.15*500
x0(2) = lb(2) + 0.85*500
and
x0(1) = lb(1) + 0.85*500
x0(2) = lb(2) + 0.15*500
these result in very different results, such as (1317,1249) and (1653,913)
also, the exitflag I get is 2. I hoped I could get an exitflag of 1 and, at least, similar results with different initial points
Does anyone have any suggestions on how to calibrate fmincon options in this case or which algorithm should I use?
I am running patternsearch now, but I am pretty sure that different initial points will give different results...
0 Kommentare-2 ältere Kommentare anzeigen-2 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Matt J am 31 Aug. 2020
Bearbeitet: Matt J am 31 Aug. 2020
You should use your equality constraint to eliminate one of the variables, e.g.,
x2 = 2566.469-x1
lb=max( [1228.527, 2566.469-1337.942] ); %lower bound on x1
ub=min( [1728.527, 2566.469-837.942] ); %upper bound on x1
Once you have things in the form of a 1-dimensional problem, you can just evaluate your function on a linspace of x1 values to get the minimum, or at least to get an initial guess very close to the global solution. Once you have a good initial guess, you can refine it using fminbnd. Note that unlike fmincon, fminbnd will handle non-differentiable objective functions, which your objective appears to be.
3 Kommentare1 älteren Kommentar anzeigen1 älteren Kommentar ausblenden
Matt J am 31 Aug. 2020
Bearbeitet: Matt J am 31 Aug. 2020
If you have a general non-convex, non-differentiable objective in 8 unknowns, my recommendation would be to try ga(). It is clear, in any case, why a local optimizer like fmincon may give you different solutions for different initial guesses - that's what local optimizers do when you initialize too close to local minima. It is also clear that if your function is not differentiable, you may not be able to drive the first order optimality measures to zero, which is what exitflag=1 requires.
Conrado Neto am 31 Aug. 2020
thanks I will try ga then..
I thought fmincon options could be adjusted for this case

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Solver Outputs and Iterative Display finden Sie in Help Center und File Exchange

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by