Azzera filtri
Azzera filtri

Optimisation of three function in two variables

2 visualizzazioni (ultimi 30 giorni)
Hi, i have three sperimantal eqation that describe: Temperature (T), Pressure (P) and refraction (R). Each function dependes from two variables x and y. So T=f(x,y), Pf(x,y) and R=f(x,y). I kwon the range of valure for x and y, so x1<x<x2 and y1<y<y2.
I want to maximise each of the functions, so i want to find the best couple of value for x and y that optimise the functions.
What is the best strategy?

Risposta accettata

Star Strider
Star Strider il 1 Ott 2024
To begin with, you need to parameterise the functions so that ‘x’ and ‘y’ are two elements in the same vector.
Your functions then become:
% b(1) = x, b(2) = y
T = f(b(1),b(2)) ...;
P = f(b(1),b(2)) ...;
R = f(b(1),b(2)) ...;
and the bounds become:
lb = [x1, y1];
ub = [x2, y2];
You can then use these with the fmincon functiion, for example. Optimise in ‘b’ and if you want to get the maxima, negate them in tthe fmincon call.
.

Più risposte (1)

John D'Errico
John D'Errico il 1 Ott 2024
There may be an issue here, if you think you can maximize them all simultaneously. The (x,y) coordinates that maximizes one function need not be (and almost certainly will not be) the same as that which maximizes the other responses.
Of course, if you are willing to find a different extremal point for each objective, then you just call a tool like fmincon three times, once for each objective.
Is there any recourse? I assume what you want to do is called multi-criteria optimization, or multi-objective optimization.
Here the common idea is to optimize a weighted sum of all three objectives. If, for example, the three objectives have completely different units or scaling, surely you want to weight them to counter that, possibly making them each roughly of the same importance in the result.
The tool in MATLAB to solve this general problem is fgoalattain.
help fgoalattain
fgoalattain - Solve multiobjective goal attainment problems fgoalattain solves the goal attainment problem, a formulation for minimizing a multiobjective optimization problem. Syntax x = fgoalattain(fun,x0,goal,weight) x = fgoalattain(fun,x0,goal,weight,A,b) x = fgoalattain(fun,x0,goal,weight,A,b,Aeq,beq) x = fgoalattain(fun,x0,goal,weight,A,b,Aeq,beq,lb,ub) x = fgoalattain(fun,x0,goal,weight,A,b,Aeq,beq,lb,ub,nonlcon) x = fgoalattain(fun,x0,goal,weight,A,b,Aeq,beq,lb,ub,nonlcon,options) x = fgoalattain(problem) [x,fval] = fgoalattain(___) [x,fval,attainfactor,exitflag,output] = fgoalattain(___) [x,fval,attainfactor,exitflag,output,lambda] = fgoalattain(___) Input Arguments fun - Objective functions function handle | function name x0 - Initial point real vector | real array goal - Goal to attain real vector weight - Relative attainment factor real vector A - Linear inequality constraints real matrix b - Linear inequality constraints real vector Aeq - Linear equality constraints real matrix beq - Linear equality constraints real vector lb - Lower bounds real vector | real array ub - Upper bounds real vector | real array nonlcon - Nonlinear constraints function handle | function name options - Optimization options output of optimoptions | structure such as optimset returns problem - Problem structure structure Output Arguments x - Solution real vector | real array fval - Objective function values at solution real array attainfactor - Attainment factor real number exitflag - Reason fgoalattain stopped integer output - Information about optimization process structure lambda - Lagrange multipliers at solution structure Examples openExample('optim/BasicGoalAttainmentProblemExample') openExample('optim/GoalAttainmentWithLinearConstraintExample') openExample('optim/GoalAttainmentWithBoundsExample') openExample('optim/GoalAttainmentWithNonlinearConstraintExample') openExample('optim/GoalAttainmentUsingNondefaultOptionsExample') openExample('optim/ObtainObjectiveFunctionValuesInGoalAttainmentExample') openExample('optim/ObtainMoreOutputsInGoalAttainmentExample') openExample('optim/EffectsOfWeightsGoalsAndConstraintsInGoalAttainmentExample') See also fmincon, fminimax, optimoptions, Optimize Introduced in Optimization Toolbox before R2006a Documentation for fgoalattain doc fgoalattain

Categorie

Scopri di più su Get Started with Optimization Toolbox in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by