Dear GAMS users,
Hi,
As you know objective function in GAMS should be a free variable without domain.
However, I have a model in which the objective function is defined over the all elements of a set.
For instance, assume that
set s /s1*s100/;
The objective function is OF(s).
Indeed, for each s, the model should be run and the value of objective function should be recorded.
How can I do this? Would you please help me?
Any useful helps is welcome.
Sincerely yours.
Hi
Just use a loop
loop(s,
solve mymodel using nlp maximizing OBJ;
results(“OBJ”,s) = OBJ.L;
);
display results;
Cheers
Renger
Dear Renger,
Thanks for your answer.
My problem was already solved by the helpful reply of Michael in the previous post using the dynamic set.
However, please note that I cannot use your way because OBJ is defined over the set s.
Sincerely yours.