Does solving a problem with less constraints leads to greater optimal value necessarily?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Dear Community,
Please find below the optimization problem I am solving using fmincon
clear all;
%%%%%%% simulation parameters
n=20
m=5;
power_BS = 20
N0=10e-10;
fb = 0.18*1e+6
n_RB = 100
bandwidth= 100*1e+6;
b_v=fb*n_RB/n;
radius_BS = 500;
b=b_v*rand(n,1);
d_sq=radius_BS*rand(n+m,1).^2;
h=exprnd(1,n+m,1)./(d_sq);
SNR=h*power_BS/N0;
C_Ter=500*1e+6;
p=[];
x0=[52.8827; 45.0967; 45.3726; 46.4245; 53.6886; 1.2579*ones(15,1)] % initial point
epsilon=(2e-4);
%objective=@(f)0
objective=@(f) obj(f,n,b,SNR);
lb=zeros(n,1);
ub=b;
%opts = optimset('Display','iter','Algorithm','interior-point', 'MaxIter', 100000, 'MaxFunEvals', 100000);
options = optimoptions('fmincon','Display','iter','Algorithm','sqp');
[f,fval,exitflag,output] = fmincon(objective,x0,[],[],[],[],lb,ub,@(f)mycon(f,SNR,n,m,bandwidth,epsilon,C_Ter,x0,b))
p=[p,-fval];
where
function fun = obj(f,n,b1,SNR)
%UNTITLED3 Summary of this function goes here
% Detailed explanation goes here
fun=-sum((b1-f).*log(1+(SNR(1:n)./((b1-f)))))
end
and
function [c,ceq] = mycon(f,SNR,n,m,bandwidth,epsilon,C_Ter,a,b)
% Compute nonlinear inequalities at x.
c=[sum(f)- bandwidth;(1/epsilon)-sum(f(1:m)'*log(1+(SNR(n+1:n+m)./f(1:m))));
(sum(f(1:m)'*log(1+(SNR(n+1:n+m)./f(1:m))))+sum((b-a).*log(1+(SNR(1:n)./(b-a)))-(f-a).*log(1+(SNR(1:n)./(b-a)))+(SNR(1:n).*(f-a))./(b-a+SNR(1:n)))-C_Ter)];
ceq=[];
end
Now I want to solve the problem with less constraints such that mycon function is given below :
function [c,ceq] = mycon(f,SNR,n,m,bandwidth,epsilon,b)
% Compute nonlinear inequalities at x.
c=[sum(f)- bandwidth;(1/epsilon)-sum(f(1:m)'*log(1+(SNR(n+1:n+m)./f(1:m))))];
ceq=[];
end
I am expecting to get greater values for -fval using the second function (i.e. when I removed the last constraint). But, it is not always the case.
Can you help to explain this issue and what to modify in order to get the desired result?
Many thanks !
2 commentaires
Walter Roberson
le 6 Oct 2019
Not necessarily. fmincon() only looks for local minima, and a constraint potentially might act to steer it away from a local minima.
Réponses (1)
Walter Roberson
le 6 Oct 2019
Suppose you have a function that looks like
\ /-------\ /--------
\ / \-v-/
\
fmincon is deterministic, so it is likely to check out the section in the middle first. It does some local descent and finds a minima at the v . Provided the constraints are met, it is happy with that answer. fmincon is not a global minimizer: in areas where the constraints are not interfering, it follows the gradient jacobian or at most the hessian.
Now apply an additional constraint that makes the center part unfavourable. fmincon searches further and has a chance to find the region to the left that has the better minima.
When I try your code, I get
43841811.2268468 for the first mycon
43841811.2142779 for the second mycon with fewer constraints
That difference in values is small enough, 2E-10 of the value, that you could be running across tolerance issues. Or just a local minima.
1 commentaire
Voir également
Catégories
En savoir plus sur Solver Outputs and Iterative Display dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!