Quadratic Optimization for 4D in for Loop

1 回表示 (過去 30 日間)
MarshallSc
MarshallSc 2021 年 12 月 31 日
コメント済み: yanqi liu 2022 年 1 月 1 日
I need to find the roots (complex in nature) of an objective function in 4D by using quadratic optimization for the function below:
a = [0.0068 0.0036 0.000299 0.0151]; b = [0.0086 0.00453 0.0016 0.00872]
f = @(xj,xk) a(i) - (x(j)*x(k)) * b(l); %i,j,k,l = 1:4 - simple eqn: f = @(x1,x2) a(1) - (x(2)*x(3)) * b(4)
The problem that I have is that I don't know how to write it in a for loop or permutation manner that each loop takes a specific value of the (a,b) and (xj,xk) from 1:4. Basically it's a nonlinear coordinate transformation. Since my X(i) * X(j) makes the problem quadratic, I need to perform an approximation using the only equality constraint such (imposing the symmetry of the potential function - (i,j) and (k,l) pair become exchangeable):
(x(j)*x(k)) * b(l) + (x(i)*x(l)) * b(k) + (x(k)*x(j)) * b(j) + (x(l)*x(i)) * b(i) =< a(i) + a(j) + a(k) + a(l)
That's my only constraint for optimization that minimizes the objective function. I tried using fmincon but I don't know how to use it in a loop for the equation and the constraint.
I'd appreciate it if someone can help me! Thank you!
  1 件のコメント
yanqi liu
yanqi liu 2021 年 12 月 31 日
yes,sir,may be write the equations,and we can use loop to generate cmd string,then use eval to get function handle

サインインしてコメントする。

採用された回答

yanqi liu
yanqi liu 2021 年 12 月 31 日
clc; clear all; close all;
a = [0.0068 0.0036 0.000299 0.0151];
b = [0.0086 0.00453 0.0016 0.00872];
% f = @(xj,xk) a(i) - (x(j)*x(k)) * b(l); %i,j,k,l = 1:4 - simple eqn: f = @(x1,x2) a(1) - (x(2)*x(3)) * b(4)
for i = 1 : length(a)
eqi = sprintf('f=@(x1,x2) %f- (x(1)*x(2))*%f;', a(i), b(i));
disp(eqi)
end
f=@(x1,x2) 0.006800- (x(1)*x(2))*0.008600; f=@(x1,x2) 0.003600- (x(1)*x(2))*0.004530; f=@(x1,x2) 0.000299- (x(1)*x(2))*0.001600; f=@(x1,x2) 0.015100- (x(1)*x(2))*0.008720;
  2 件のコメント
MarshallSc
MarshallSc 2021 年 12 月 31 日
編集済み: MarshallSc 2021 年 12 月 31 日
Thanks Yanqi for your answer. Do you know how I can incoporate this pemutated equation to solve for the quadratic optimization to find the minimum values of Xs? a & b are just the coefficient of the second order polynomial.
I'm a little bit lost as to what should be done. I'd appreciate it.
yanqi liu
yanqi liu 2022 年 1 月 1 日
yes,sir,may be it is non-linear optimization,use fmincon to get compute,may be write your equations in handwriting,we can make some debug

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSolver Outputs and Iterative Display についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by