Maximize D2D rate - FMINCON problem
显示 更早的评论
Hello!
I would like to ask for your help if easy... I have to solve a maximization problem where there are some D2D users deployed in the network and I am trying to allocate resources in order to maximize the total throughput (all users' rates summed).
Below I write down my objective function form and the example to solve:
% Objective function for maximizing minimum D2D rates
function f = objfunc(z,x)
a = z.*x;
f = sum(sum(sum(a)));
f = -f;
and also I have another function with nonlinear constraints in it that receives two decision variables as an input (z,x), as already noted in objfunc.
- z: matrix of z_{k,j} elements where k is the number of D2D users and j the Resource indicator. If z_{k,j} > 0, k user utilizes j resource, else it is zero
- x: matrix of x_{k,j} -- value set to one if k user utilizes j resource, otherwise it is zero
I also have some linear constraints that for each user k, the sum(x_{k,j}) for all j resources equals to 1, this means that each user will use only one resource. I then try to call the Matlab solver of fmincon like this:
fun = @objfunc;
cfun = @confunc;
% Linear inequality constraints
A = [];
b = [];
% Linear equality constraints
Aeq = ones(d2d_pairs, Nband);
beq = ones(1,d2d_pairs)';
% Lower and upper bounds
lb = [];
ub = [];
opts = optimoptions(@fmincon,'Algorithm','interior-point');
x0 = zeros(d2d_pairs, Nband);
[x , fval] = fmincon(fun,x0,A,b,Aeq,beq,lb,ub,confunc,opts);
- where Aeq and beq are the matrices to satisfy the equality constraints mentioned above.
Then, after running the code, the result is:
Error using fmincon (line 284)
Aeq must have 150 column(s).
Error in multipoint_D2D_scenario_v20 (line 197)
[x , fval] = fmincon(fun,x0,A,b,Aeq,beq,lb,ub,confunc,opts);
- (if I also by hand change this to be 150 columns, the errors change:
Error using objfunc (line 5)
Not enough input arguments.
Error in fmincon (line 564)
initVals.f = feval(funfcn{3},X,varargin{:});
Error in multipoint_D2D_scenario_v20 (line 197)
[x , fval] = fmincon(fun,x0,A,b,Aeq,beq,lb,ub,confunc,opts);
Caused by:
Failure in initial user-supplied objective function evaluation. FMINCON cannot continue.
)
Do you know what kind of problem is this? It is too complicated to refer to this in its whole extent.
Thank you in advance!
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Solver-Based Nonlinear Optimization 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
