Optimization of multiple functions for desired output
9 views (last 30 days)
Show older comments
So I have combined many functions in a final function in order to pass the output of the first function to the input of the second etc.
function [c,n]=final(l,P,T1,T2,T3,N,I,p)
After the final function I have the output which I want to optimize.
Lets say in the end I have a variable A, B and C that the final function has calculated.
I have restriction for every input, and I want to optimize the inputs so I have a minimum value of A, B and C simultaneously.
Is this even possible in Matlab? Can anyone help me?
0 Comments
Answers (1)
Alan Weiss
on 8 Dec 2020
I am not sure that I understand what you are trying to do. If you have three variables to minimize, well, either you are fortunate and all three are minimized at the same point, or you are not and then there is a tradeoff between minimizing one or the other. It is not a question of what MATLAB can do, it is a question of whether your problem is well-formulated.
If you want to see a tradeoff surface between the three outputs, use paretosearch from Global Optimization Toolbox. Set the PlotFcn option to 'psplotparetof'.
If I have misunderstood your problem, feel free to clarify.
Alan Weiss
MATLAB mathematical toolbox documentation
3 Comments
Alan Weiss
on 8 Dec 2020
Sure, if you want to optimize a weighted sum of the variables, just make your function something like
function f = objfun(x)
% Do a lot of calculations here, get A, B, C
f = A + B/4 + C/10; % I just made up these weights
end
For introductory help in Optimization Toolbox, see Solve a Constrained Nonlinear Problem, Solver-Based and Writing Scalar Objective Functions and Passing Extra Parameters.
Alan Weiss
MATLAB mathematical toolbox documentation
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!