When I run my code, the following error appears. Hope to get your help.
错误使用 .* (line 173)
Disciplined convex programming error:
Cannot perform the operation: {positive constant} .* {real affine}出错 CVXSolver (line 18)
sum(sum(sum(cost.*adjacency))) <= u_cost;
My main relevant code is as follows:
%------CVX optimization------:
cvx_begin
variable adjacency(node_number, node_number, time_number) binary;
maximize(sum(sum(sum(adjacency.*gain))));
subject to
sum(sum(sum(cost.*adjacency))) <= u_cost;
cvx_end
Where cost
is a matrix with the same dimensions as adjacency
. The elements in the matrix are non-negative float numbers except for some elements whose values are Inf
.
I have read two related posts. Someone pointed out that the element values of the constant matrix cannot be Inf
and NaN
, and avoid dividing by the integer 0
during calculation. But in Matlab, matrix multiplication with Inf
elements is supported. How should I modify it to make it run normally, I am eager to get your suggestions.