$Onempty

sets i index /i1*i100/

p(i) / /

d(i) / /;

scalars

k /0/;

parameters

val(i);

positive variables x;

variables obj;

equations

objective;

objective… obj=e=x+k;

model case /objective/;

repeat (

k=k+1;

d(i)=yes$(ord(i)=k);

p(i)=P(i)+d(i);

solve case using lp minimizing obj;

- val(p)=obj.l;

Until k=20

);

display val

Now I need to let val(‘p1’)=the first solution of obj, let val(‘p2’)=the second solution of obj, let val(‘p3’)=the third solution of obj, …, let val(‘p20’)=the 20th solution of obj

How should I do? the subset p(i) is dynamic

–

To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.

To post to this group, send email to gamsworld@googlegroups.com.

Visit this group at http://groups.google.com/group/gamsworld.

For more options, visit https://groups.google.com/d/optout.

$Onempty

sets v /1*1000/

p(v) / /

d(v) / /;

scalars

k /0/;

parameters

val(v);

positive variables x;

variables obj;

equations

objective;

objective… obj=e=x+k;

model case /all/;

repeat (

k=k+1;

d(v)=yes$(ord(v)=k);

p(v)=p(v)+d(v);

solve case using lp minimizing obj;

*the below incorrect equation is not what i want

val(p)=obj.l;

Until k=20

);

display val

Now I need to collect all of the solutions into one solution pool, create a new parameter and use the solution pool as the new parameter in the following calculation,

for example, I need to let the val(‘p1’)=the first solution of obj, let the val(‘p2’)=the second solution of obj, let the val(‘p3’)=the third solution of obj, …, let the val(‘p20’)=the 20th solution of obj,

Please note that p which depends on k, is a dynamic subset of v.

how should I program in Gams?

Sincerely

–

To unsubscribe from this group and stop receiving emails from it, send an email to gamsworld+unsubscribe@googlegroups.com.

To post to this group, send email to gamsworld@googlegroups.com.

Visit this group at http://groups.google.com/group/gamsworld.

For more options, visit https://groups.google.com/d/optout.