MATLAB Answers


optimizing each element of a matrix based on the elements of another matrix

Asked by Susan
on 29 Apr 2019
Latest activity Commented on by Susan
on 29 Apr 2019
Hi MATLAB experts,
I have an objective function which is a matrix. Each element of this matrix is a function of another matrix, as it is shown in the code below. "objfun(i,j,m,k)" is a function of "ptilda (i,j,k,m)" for all k,m,i,j but I would like to maximize this specific objfun (I mean for a specific i,j,m,k) w.r.t "ptilda (i,j,k,m)".
Any idea, how I can do that?
I am using fmincon() and getting the following error:
Supplied objective function must return a scalar value.
So, I guess I should go for gamultiobj (), rigth? But I don't know how to implement that. rigth now my constraints are in the format of
lb <= ptilda <= ub and A*ptilda <= b and c(ptilda)<= 0
where ptilda is a matrix of size (max(I(:)), numel(I), numel(M), max(M(:))).
If I use gamultiobj(), how will the constraints change?
Thanks in advance. Your help would be greatly appreciated.
objfun = zeros(max(I(:)), numel(I), numel(M), max(M(:)));
for k = 1 : K
for m = 1 : M(k)
for j = 1 : J
for i = 1 : I(j)
objfun(i,j,m,k) = G(ptilda (i,j,k,m));% is a function of ptilda (i,j,k,m)

  1 Comment

Could anyone please help me to solve this issue?

Sign in to comment.

0 Answers