Maximize D2D rate - FMINCON problem

8 views (last 30 days)
Chris B
Chris B on 6 Jul 2014
Commented: Chris B on 21 Jul 2014
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!

Accepted Answer

Matt J
Matt J on 6 Jul 2014
Edited: Matt J on 6 Jul 2014
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.
You are not allowed to write your functions in terms of multiple separate unknowns like z and x. You must express everything in terms of a single concatenated vector of unknown parameters, p=[x(:);z(:)]. If it helps to break p into separate parts inside your objective and nonlinear constraint functions, you can do so, but the input argument syntax of the functions must be in terms of p, like below. I assume throughout that the matrix dimensions of z and x are both MxN.
function f = objfunc(p)
xcol=p(1:M*N);
zcol=p(M*N+1:end);
f=-dot(zcol,xcol);
You must also shape your A,b,Aeq,beq linear constraint matrices with the assumption that they will be multiplied with p as in
A*p <= b,
Aeq*p = beq
You can use Kronecker products to express the row sum operator of a matrix x that has been converted to a vector x(:),
rowsums_for_x = kron(ones(1,N),speye(M));
zeros_for_z = sparse(M,M*N);
Aeq=[rowsums_for_x, zeros_for_z];
beq=ones(M,1);
Finally, the bound vectors ub,lb must be the same length as the total unknown vector p (or else left empty []) as must your initial guess p0=[x0(:);z0(:)].
  10 Comments
Matt J
Matt J on 21 Jul 2014
No idea. I don't even know what an RB is...
Chris B
Chris B on 21 Jul 2014
j element let's say... It's OK.. I will try to fix it! Thanks

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!