Optimization: Optimize multiple input variables to minimize the output
Ältere Kommentare anzeigen
Hello
I am looking to optimize multiple input variables to minimize the output using fminsearch.
Clearly, I am doing it wrong :( ( see below ) Below is my initial attempt.
Ultimately wanted to bound the predictions for all the variables ( x,y,z,p,q,r) from 0.1 to 100 in the step 0.1
Any help will be greatly appreciated.Thanks a ton!
%Objective: Attempting to Minimize function output with respect to multiple input variables
% Wanted to minimize function, Pow(X) = ((x*p) + (y*q) + (z*r) ) *l*w), by
% optimizing the variables, x, y,z,p ,q and r.
%l and w are constants
%Creating the objective function with its extra parameters( l,w) as extra arguments.
f =@(X, l,w)(X(1)*X(4) + X(2)*X(5) + X(3)*X(6))*l*w; %
%Declaring extra parameter values
l =2;
w=1;
%Create an anonymous function of x alone that includes the workspace value of the parameter.
fun =@(X)f(X,l,w)
%x0 = [-1,1.9];
X_guess = [1 1.5 1 2 1.25 1];
Xmin = fminsearch(fun,X_guess)
x1 = Xmin(1);
y1 = Xmin(2);
z1 = Xmin(3);
p1 = Xmin(4);
p2 = Xmin(5);
p3 = Xmin(6);
4 Kommentare
Isn't the solution obviously going to be that all variables xyz,p,q,r=0.1 ? Since the variables are constrained to be positive, the objective function is independently monotonic in all the variables. Therefore, setting them all to their smallest possible values will oviously minimize the function.
Matt J
am 3 Okt. 2021
Clearly, I am doing it wrong :( ( see below )
It's not clear because you haven't shown the output and discussed what you don't like about it.
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Choose a Solver finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!