Search for combination of parameters that make minimum function output.

12 visualizaciones (últimos 30 días)
Hi, I know there is a lot of information on the subject but I can't seem to find something that fits or that I just understand, I explain below.
I have a matlab script containing a function that receives 3 input parameters (input_1, input_2, input_3) and returns 3 other output parameters (out_1, out_2, out_3). Logically within the function there are a series of steps to transform the input variables into the output variables.
[out_1 , out_2 , out_3] = test(input_1 , input_2 , input_3)
What I would like to implement is an optimization function that tells me what parameters I have to enter in the 3 inputs to get the 3 outputs to take the lowest possible value (within a maximum number of iterations).
I think the approach is to use a multi-objective optimization but the truth is that I am a bit lost. Thank you very much

Respuestas (1)

John D'Errico
John D'Errico el 31 de Mzo. de 2021
Editada: John D'Errico el 31 de Mzo. de 2021
Before you go too far, some ideas to consider.
  1. I hope you have a FUNCTION, not a script. Learn to use functions.
  2. You will need to provide a VECTOR of three inputs, not three distinct inputs, as any optimizer will work with vectors of numbers. But they do not want to deal with functions that take multiple inputs, as then the interface would be far too complicated. So package your three variables into one vector. If neccesary, the easy solution is to just wrap your function inside another that takes a vector, then unpacks them into three variables, and passes them into your existing function.
  3. Do these three unknowns have constraints? Are there bounds? Are there constraints on some combination of the unknowns? Must they come from some set, such as the integers? Positive integers? All of these factors will influence what kind of optimization tool you can use, because they powerfully impact the algorithm employed.
  4. What kinds of mathematical manipulations are employed INSIDE your function? This part is crucial, since it will strongly impact the tool you can then use. Is everything TRULY linear inside? If so, then you should use tools that understand how to work with linear problems, because they are far more efficiently solved when you can assume linearity. Are your operations at least continuous and differentiable? If not, then you dramatically impact what solver you could use, as most presume continuity and differentiability. Lacking that forces you to use tools that can survive major issues with your function.
  5. Yes, the fact that you have THREE outputs, all of which are simultaneously minimized makes this an impossible problem to solve, unless you are willing to accept some form of compromise. The classical solution is called multi-criteria oprimization, where you will probably minimize a weighted sum of the objectives. You will need to choose the weights. Is one more important than the others? Are they scaled wildly differently, so a direct equally weighted sum would effectively ignore one variable compared to the others? In context of the optimization toolbox, that is the domain of the function fgoalattain. But other tools can be used as long as you are willing to combine the objectives into one on your own.
  6. Oh. I almost forgot to mention the question of local solutions, versus a possible global optimum. Most nonlinear objectives will have multiple solutions, thus mutiple points where the function has a minimum value, but it is likely that only one of them will be the best overall value. Since optimizers take your objective as a black box, they pass in points to the objective function, and then use the output to determine where to look next. This means they can easily stop in a local minimizer, where any direction searched away from there will yield a worse solution. (This is an important reason to understand if your objective satisfies properties of linearity and even continuity. A linear objective is far easier to work with, since then multiple solutions are not a problem, as long as there are no complex constraints to deal with.) But this last point will take you into learning ideas about basins of attraction and the importance of good starting values for any optimization. Intelligently provided constraints can be hugely valuable, both to reduce the search space (making the solver more efficient) as well as to avoid nonsensical results.
So there is much you need to consider, and probably much you will need to learn. But there are many specific questions in the above set of points that you will need to answer, and that would guide you to the proper tool to be used.


Más información sobre Solver Outputs and Iterative Display en Help Center y File Exchange.




Community Treasure Hunt

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

Start Hunting!

Translated by