Problems with looping and indices

Problems with modeling
User avatar
Renger
Posts: 379
Joined: 3 years ago

Re: Problems with looping and indices

Post by Renger » 1 month ago

Code: Select all

set counter   Maximum size of all nodes /1*9/;
parameter acti, actj;

loop(trips,
    NEXTI.L = 1;
    loop(counter,
        loop(i$(NEXTI.L = ord(i)),
            loop(j$(x(i,j) = 1),
                actj = ord(j); acti = ord(i);
                xt(i,j,trips) = 1;
                x(i,j) = 0;
                NEXTI.L       = ord(j);
                display xt, actj, acti, NEXTI.l;
                if(actj NE 1, break);
            );
        );
        if(actj EQ 1, break);
    );
);
gives (including a headache :-) );

Code: Select all

                1           2

i1.i2       1.000
i1.i8                   1.000
i2.i6       1.000
i3.i5       1.000
i4.i1       1.000
i5.i9       1.000
i6.i3       1.000
i7.i1                   1.000
i8.i7                   1.000
i9.i4       1.000
____________________________________
Enjoy modeling even more: The lazy economist

Post Reply