Which optimization function and which algorithm do I use?
Show older comments
Dear all,
I've been working on an optimization of a conceptual aircraft. I've tried many things already, but so far no luck. Up until now the optimization ended prematurely, or stopped at an infeasible point, often with half of the input variables left untouched. I want to start all over again, by first selecting a suitable function.
I've tried to use the fmincon function before. However it gets stuck at infeasible local minimums every time. I tried dozens of starting points, but no luck. I have been able to find a feasible solution myself, so I know it is possible. Fmincon seemed to only improve the objective value and sort of just hopes it becomes feasible as well.
Walter Roberson pitched the idea of using fgoalattain. This is a multi-objective optimization function. I'm still not sure if this is the right one, since I have only one real objective. In case I want to use the fgoalattain function, all constraints become objectives. Would this be the right function to use for my problem? Or should a use a completely different function?
Here's what I want to do:
I have 31 variables, describing the planform and the tail size of the aircraft. There are 24 constraints, a few examples are: runway length required to take-off, stall speeds, cabin size, stability margins etc.
Those variables depend on the input vector through a whole series of subfunctions, which are quite complicated in some cases.
The start vector is a first guess and is likely to be infeasible. Usually about 1-5 of the constraints are violated. It is not likely that the first guess is completely off, since the input vector is constructed based on quick estimations.
The objective is to make the aircraft feasible in the first place and secondly maximize the range. A single run to make and analyze an aircraft takes approximately 30 seconds and I want to keep the total optimization time under 24 hours. My program does not calculate analytical derivatives for the input variables.
Whenever a constraint is violated, I have an amount by which it is violated. For the runway length this may for example be something like 120m violation of the required runway length. For stability margins this may be something like 0.02 violation. I really need to achieve feasibility, that is the most important requirement. Maximizing the range comes in second.
Beside these physical constraints, there are also some linear constraints on the input variable, which make sure that the aircraft can be handles by the evaluation function. The wing is seperated in a number of stations. The linear constraints make sure that the second station is further outboard than the first one, the third one is further outboard than the second one and that the chords keeps decreasing or at least equal when moving further outboard. These constraints were handles well by fmincon.
I hope that by posting this, I'm able to select the correct optimization function and algorithm, before I continue with the random trial and error thing, like it now feels. I also like some help by setting up the function. So if I do need to use fgoalattain for example, how do I use the constraints etc.
[Question edited]
Answers (3)
Andrew Newell
on 17 Jun 2011
0 votes
There are many possible reasons for the failure. I can only make some general comments:
- The active-set algorithm doesn't satisfy the constraints at each step, so it isn't surprising that they aren't satisfied when no feasible solution is found.
- The page on Choosing the algorithm suggests trying the interior-point algorithm first.
- You should read When the Solver Fails.
5 Comments
Jorrit
on 17 Jun 2011
Jorrit
on 20 Jun 2011
Andrew Newell
on 20 Jun 2011
I don't know how you distinguish between a reasonable solution and a feasible solution, but ... Assuming the problem is well-defined and there isn't an error in your code, maybe you need the Global Optimization Toolbox.
Jorrit
on 21 Jun 2011
Andrew Newell
on 23 Jun 2011
Sorry we're not able to help more, but without seeing your code we can only offer generic suggestions. Have you tried all the suggestions in "When the solver fails"?
Jorrit
on 21 Jun 2011
0 votes
6 Comments
Walter Roberson
on 21 Jun 2011
Sounds to me as if you should try fgoalattain(), as that allows you to set weights to favor optimization of particular variables.
Jorrit
on 21 Jun 2011
Jorrit
on 22 Jun 2011
Jorrit
on 22 Jun 2011
Walter Roberson
on 22 Jun 2011
Sorry, I haven't used fgoalattain(), and I am still rather shaky on the terminology and how the parts relate together.
Jorrit
on 23 Jun 2011
Alan Weiss
on 18 Aug 2011
0 votes
It is possible that fmincon is not moving because your objective function is locally flat, or the constraints are. You might want to set DiffMinChange to a value larger than the default, such as 1e-3.
You didn't answer the question of whether you tried the suggestions in When the Solver Fails, and what were the results of your trying those suggestions. In particular, you might need to start at way more than a few dozen starting points. The Global Optimization Toolbox functions GlobalSearch and MultiStart do exactly that. Even though you don't seem to have Global Optimization Toolbox, you might look in the documentation to see if anything there might help you, such as Improving Results.
2 Comments
Jorrit
on 19 Aug 2011
Steve Grikschat
on 6 Sep 2011
I can't be sure, but I know that the interior-point algorithm, while fairly robust, may sometimes struggle with certain problems where there appears to be non-smoothness in the objective/constraints whether or not it is real or numerical. For this reason, the active-set algorithm is preferred in engineering design problems where the objective is a simulation.
I would like to bring the "sqp" algorithm of fmincon to your attention in case you weren't aware. This is essentially the active-set algorithm but with some enhancements which may be of interest to you. Namely, it will respect bounds on the variables at each iteration.
Also, (this may be obvious) but have you considered parallel evaluations to save time?
Categories
Find more on Linear Least Squares in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!