MATLAB Answers

Optimization of multiple functions for desired output

33 views (last 30 days)
Katerina Tasidou
Katerina Tasidou on 8 Dec 2020
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

Sign in to comment.

Answers (1)

Alan Weiss
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

Katerina Tasidou
Katerina Tasidou on 8 Dec 2020
Well, first of all thank you very much for your quick response. We are doing an optimization of a chemical process so there is no connection between the A,B and C. I understand what you are saying, but is there any way to have a weighted optimization of the 3 variables? I mean that the A variable is more important than the B and more important than C.
Again thank you very much
Katerina
Alan Weiss
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
Alan Weiss
MATLAB mathematical toolbox documentation
Katerina Tasidou
Katerina Tasidou on 8 Dec 2020
Thank you very much for your guidance! I will look into this
Katerina

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!