Setting linear constraints for fmincon,
6 views (last 30 days)
Show older comments
I am setting the linear inequality constraints for my problem in fmincon.
My problem is min_(gamma,t) t s.t -t<=0; PS(gamma) - t <= 0; - PS(gamma) - t <= 0; i want to minimize t and my optimization variables are both t and gamma. gamma is comlex in nature so i am separating real and imaginary parts for fmincon in x_opt. A and B are not correct anyone can help ?
function [A, B] = linear_constraints(x_opt---)
real_gamma = x_opt(1:Nris+2); % Real part of gamma
imag_gamma = x_opt(Nris+3:length(x_opt)-1); % Imaginary part of gamma
gamma = real_gamma + 1i * imag_gamma; % Recombine gamma as complex vector
A = zeros(0, length(x_opt));
B = zeros(0, 1);
%% Constraint (a): -t <= 0
A_a = zeros(1, length(x_opt)); % Coefficients for all variables
A_a(end) = -1; % -t in the last column
B_a = 0; % Right-hand side of constraint
% Append to A and B
A = [A; A_a];
B = [B; B_a];
%% Constraint (b): PS(gamma) - t <= 0
% PS_term is a scalar real value based on gamma
PS_term = PS(gamma);
A_b = zeros(1, length(x_opt)); % Coefficients for all variables
%A_b(1:Nris+2) = (PS_term); % Include coefficients for gamma
A_b(end) = -1; % Coefficient for -t
B_b = -PS_term; % Right-hand side of constraint
% Append to A and B
A = [A; A_b];
B = [B; B_b];
%% Constraint (d): - PS(gamma) - t <= 0
PS_term_1 = -Ps(gamma)
A_d = zeros(1, length(x_opt));
%A_d(1:Nris+2) = ; % Coefficients for gamma
A_d(end) = -1; % Coefficient for -t
B_d = (TA_PS_term); % Right-hand side of constraint
% Append to A and B
A = [A; A_d];
B = [B; B_d];
end
0 Comments
See Also
Categories
Find more on Gamma Functions in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!