lingo中有两个矩阵,如何使b中为0处a中对应处也为0(即若b(i,j)=0,则a(i,j)=0)

问题描述:

lingo中有两个矩阵,如何使b中为0处a中对应处也为0(即若b(i,j)=0,则a(i,j)=0)

若b(i,j)=0则a(i,j)=0,否则a(i,j)=a(i,j)(根据lingo的@if函数特点添加的)
sets:
r/1..5/:;
c/1..5/:;
link(r,c):a,b;
endsets
@for(link(i,j):a(i,j)=@if(b(i,j)#eq#0,0,a(i,j)));