use the loop index list to fix a variable

Hello every one
I want to use the loop index list to fix an element of a variable. I used this code:

loop(i,
attack.fx(i)=0;
solve T maximizing o using mip;
);

but the output is not exactly what I need. in every loop, it fixes some elements of attack variable up to i value. It means, in the last run of the solve command, all elements of attack are fixed! can anyone help me, please?

Hi Shaparak,

Not sure what you want to achieve, but you might want to free the attack variable again after the solve, that way the variable only is fixed for the index i it is currently looping over.

Regards,
GFA

loop(i,
attack.fx(i)=0;
solve T maximizing o using mip;
attack.lo(i) = -inf;
attack.up(i) = inf;
);

[/quote]

Thank you a lot! it works