Loop part is correct, declarations are not. I took the code to correct syntax (other ways are also possible):
sets
A /a,b,c/
A1 /a1,b1/;
parameter
B(A, A1) /
a.a1 1
a.b1 1
b.a1 2
b.b1 3
c.a1 2
c.b1 3/;
parameter
C(A,A1)
;
loop((A,A1),
C(A,A1) =ceil(B(A, A1)/2);
);
Display C;
loop over two sets
-
- User
- Posts: 108
- Joined: 7 years ago
Re: loop over two sets
Besides: the loop is actually unnecesary.
C(A,A1) =ceil(B(A, A1)/2);
will just do the trick
C(A,A1) =ceil(B(A, A1)/2);
will just do the trick
-
- User
- Posts: 108
- Joined: 7 years ago
Re: loop over two sets
this is the correct way:
A(Year)$(ord(Year)<card(Year)) = (card(Year)-1)*card(dset) - (ord(Year)-1)*card(dset);
A(Year)$(ord(Year)<card(Year)) = (card(Year)-1)*card(dset) - (ord(Year)-1)*card(dset);