solving this maximization problem

조회 수: 1 (최근 30일)
Fatemeh
Fatemeh 2024년 7월 31일
댓글: Umar 2024년 7월 31일
Hi everyone,
Could anyone assist me with solving this maximization problem in MATLAB? I need to maximize the following function and determine the optimal values of r and t.
Thank you!
-(1/((1 + 2 a)^2))
t (-3 - 2 r + t - 5 a + 2 t a +
2 Sqrt[2 (2 + r - t) + (-2 + 2 r^2 + t)/(1 + a)] +
2 a Sqrt[
2 (2 + r - t) + (-2 + 2 r^2 + t)/(1 + a)]) (-4 r +
2 a (-2 + Sqrt[
2 (2 + r - t) + (-2 + 2 r^2 + t)/(1 + a)]) +
3 (-1 + Sqrt[2 (2 + r - t) + (-2 + 2 r^2 + t)/(1 + a)]))
Invalid expression. Check for missing multiplication operator, missing or unbalanced delimiters, or other syntax error. To construct matrices, use brackets instead of parentheses.
  댓글 수: 7
Torsten
Torsten 2024년 7월 31일
Maybe of help to get some critical points depending on a:
syms a
syms r t; % Define symbolic variables 'r' and 't'
f = -(1/((1 + 2*a)^2)) * t * (-3 - 2*r + t - 5*a + 2*t*a + 2*sqrt(2*(2 + r - t) + (-2 + 2*r^2 + t)/(1 + a)) + 2*a*sqrt(2*(2 + r - t) + (-2 + 2*r^2 + t)/(1 + a))) * (-4*r + 2*a*(-2 + sqrt(2*(2 + r - t) + (-2 + 2*r^2 + t)/(1 + a))) + 3*(-1 + sqrt(2*(2 + r - t) + (-2 + 2*r^2 + t)/(1 + a))))
f = 
dfdr = diff(f,r);
dfdt = diff(f,t);
sol = solve([dfdr,dfdt],[r,t])
Warning: Possibly spurious solutions.
sol = struct with fields:
r: [16x1 sym] t: [16x1 sym]
sol.r
ans = 
sol.t
ans = 
Umar
Umar 2024년 7월 31일
@Torsten & @Walter,
Thanks for your support, really appreciated.

댓글을 달려면 로그인하십시오.

답변 (1개)

Raghava S N
Raghava S N 2024년 7월 31일
Hi Fatemeh,
Optimization of an equation with a two variable function can be solved using MATLAB’s optimization toolbox. Please refer to the documentation page of the Optimization Toolbox here - https://www.mathworks.com/help/optim/getting-started-with-optimization-toolbox.html.
The workflow to optimize a nonlinear multivariable function is as follows:
Firstly, the equation that has to be optimized must be parameterized to use the Optimization Toolbox routines. The variables undergoing optimization should be the parameters. Please refer to this documentation page that describes how to parameterize functions and equations - https://www.mathworks.com/help/matlab/math/parameterizing-functions.html.
In the next step, the negated value of the parameterized equation should be passed to the function “fmincon”. This function finds the minimum of a constrained nonlinear multivariable function. So, by passing the negated value of the parameterized equation, the maximum is obtained. Please refer to the documentation of “fmincon” here - https://www.mathworks.com/help/optim/ug/fmincon.html
Please refer to two other MATLAB Answers posts that discuss the optimization of a function with two variables in detail. The links for the same are attached below:
Hope this helps!
Raghava

카테고리

Help CenterFile Exchange에서 Surrogate Optimization에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by