我想计算两个集合V(i,ip)和v(ipp,ippp)之间的对称差
我设置了i = {1,3,4,6}和j = {1,2,..,10} 我设置了T(i,j)和,3也设置了V,W,b,即
v(i,ip)=t(i,j)+t(ip,j)
w(i,ip,ipp)= (t(i,j)+v(ip,ipp,j))-(t(i,j)*v(ip,ipp,j));
b(i,ip,ipp,ippp)=((v(i,ip,j)+v(ipp,ippp,j))-(v(ip,ipp,j)*v(ipp,ippp,j))) ;
*---- index and sets----*
sets
i /1,3,4,6/
j/1*10/
t(i,j) /
1.(2,5,10)
3.(7,10)
4.(2,5,6)
6.(2,5)
/ ;
alias(i,ip,ipp,ippp);
*---- parameter----*
parameter
MyOrd(i,ip);
*-------------------------------
MyOrd(i,ip)=i.val+(ip.val -1)*4;
set
v(i,ip,j)'for union only'
b(i,ip,ipp,ippp,j) 'symmetric diffrence between v and v'
w(i,ip,ipp,j) 'symmetric diffrence between t and v'
;
v(i,ip,j)$(i.val<ip.val)=t(i,j)+t(ip,j);
w(i,ip,ipp,j)$(ip.val<ipp.val) =(t(i,j)+v(ip,ipp,j))-(t(i,j)*v(ip,ipp,j));
b(i,ip,ipp,ippp,j)$(i.val<ip.val and ipp.val<ippp.val and MyOrd(i,ip)
并且V是T(i)的并集,W是T和V之间的对称差,并且b是V(i,ip)之间的差
我的b的结果不正确!为什么?
如何获得V(i,ip)之间的差异?
display t,v,w,b;
FrameLayout
答案 0 :(得分:1)
在您编写的代码中
MyOrd(i,ip)=i.val+(ip.val -1)*4;
尝试
parameter
MyOrd(i,i1);
scalar
counter /1/
;
loop((i,i1)$(vulnerable(i) and vulnerable(i1) and i.val <i1.val ),
MyOrd(i,i1)=counter;
counter=counter+1;
);