我是新来的人,试图解决交通问题。现在,我想编写一个索引集:
r = customer index
Z[r] = number of sub deliveries (a request exceed truck’s capacity)
i={1,2,3,4,5,6,7,8,9,10..N}
i is element of {1..z1 z1+1..z1+z2 z1+z2+1..z3 ... sum(r in R) z[r]+1..N }
我元素可以引用客户的。非常感谢。
答案 0 :(得分:3)
我不太确定您打算做什么,但是就语法而言
int N=3;
range r=1..N;
int Z[r] = [2,6,18];
{int} s=union(i in r) asSet(1+sum(j in 1..i-1)Z[j]..sum(j in 1..i)Z[j]);
execute
{
writeln(s);
}
很好
致谢