Exiting due to infeasibility: 1 lower bound exceeds the corresponding upper bound. Error using test13 (line 43) Optimization failed to converge
30 views (last 30 days)
Show older comments
Below metioned code is giving error: as failed to converge as [x, fval] are empty. Kindly please help to reolve it? Thank You!!
% Define parameter ranges
f_rad_min = 5e9; % minimum radar frequency
f_comm_min = 2e9; % minimum communication frequency
gamma_min = 0.5; % minimum SINR threshold
P_max = 10; % maximum power
f_rad_max = 1000; % maximum radar frequency
gamma_max = 5; % maximum SINR threshold
f_comm_max= 10e9;
% Define objective functions
f1 = @(x) -x(1); % maximize communication rate
f2 = @(x) x(2); % minimize interference power
f3 = @(x) x(3); % minimize total power
% Define constraints
g1 = @(x) -(x(3) - x(2)); % ensure P_int <= P_out
g2 = @(x) x(1) - log2(1 + x(4)*x(5)/(x(3) - x(2) + eps));
g3 = @(x) x(2) - x(6); % ensure P_int <= gamma
g4 = @(x) x(4) - f_rad_min; % ensure f_rad >= f_rad_min
g5 = @(x) x(5) - f_comm_min; % ensure f_comm >= f_comm_min
g6 = @(x) x(3) - P_max; % ensure P_total <= P_max
g7 = @(x) f_rad_max - x(4); % ensure f_rad <= f_rad_max
g8 = @(x) gamma_max - x(6); % ensure gamma <= gamma_max
% Define number of variables and population size
nvars = 6; % number of variables
popsize = 100; % population size
% Define initial population
init_pop = repmat([f_rad_min, f_comm_min, 0.5*P_max, gamma_min, gamma_min, gamma_min], popsize, 1) ...
+ rand(popsize, nvars) .* repmat([f_rad_max-f_rad_min, f_comm_max-f_comm_min, P_max, gamma_max-gamma_min, gamma_max-gamma_min, gamma_max-gamma_min], popsize, 1);
% Clip the values within the bounds
init_pop = min(max(init_pop, [f_rad_min, f_comm_min, 0, gamma_min, gamma_min, gamma_min]), [f_rad_max, f_comm_max, P_max, gamma_max, gamma_max, gamma_max]);
% Run genetic algorithm
options = optimoptions('ga', 'PopulationSize', popsize, 'MaxGenerations', 100);
[x, fval] = ga(@(x) [f1(x), f2(x), f3(x)], nvars, [], [], [], [], [f_rad_min, f_comm_min, 0, gamma_min, gamma_min, 0.1], [f_rad_max, f_comm_max, P_max, gamma_max, gamma_max, gamma_max], ...
@(x) deal([g1(x), g2(x), g3(x), g4(x), g5(x), g6(x), g7(x), g8(x)], []), options);
% Check if optimization succeeded
if isempty(fval)
error('Optimization failed to converge')
end
% Plot Pareto front
figure
scatter3(-fval(:,1), fval(:,2), fval(:,3), 'filled')
xlabel('Communication rate')
ylabel('Interference power')
zlabel('Power consumption')
title('Pareto front')
0 Comments
Answers (1)
Walter Roberson
on 10 Apr 2023
[f_rad_min, f_comm_min, 0, gamma_min, gamma_min, 0.1]
Those are your lower bounds
[f_rad_max, f_comm_max, P_max, gamma_max, gamma_max, gamma_max]
those are your upper bounds
f_rad_min = 5e9; % minimum radar frequency
f_rad_max = 1000; % maximum radar frequency
The lower bound exceeds the corresponding upper bound there
0 Comments
See Also
Categories
Find more on Genetic Algorithm 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!