Any one can tell me how to set this initiate value

Hi, friends,

Me again. I would like to program the initial values as : (s1,s2) t1,
(s3,s4) t2, (s5,s6) t3, (s7,s8) t4…then I wrote as below:

set
s /s1s12/
t /t1
t6/
;
dynamic set t***
set tt(t);

parameter st(s,t);

initial value***
set ti(t);
ti(‘t1’)=yes;
loop (s,
st(s,ti)=s(s);
st(s+1,ti)=s(s+1);
tt(ti)=yes;
ti(t)=ti(t-1);
);
display tt,st;

the result is (s1,s2)t1, (s2,s3) t2, (s3,s4) t3…Any one can
help to modifiy it?

Thank you very much in advance!

Best regards
Jens

–~–~---------~–~----~------------~-------~–~----~
To post to this group, send email to gamsworld@googlegroups.com
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en
-~----------~----~----~----~------~----~------~–~—

\

Dear Arne,

Thank you very much! that is exactly what I want!

On Aug 6, 10:07 am, “Arne Stolbjerg Drud” wrote:

Hi Jens

It is not clear what the purpose of tt is so I have left it out.

You should also note that st is a parameter and therefore has a numerical
value and it cannot hold a set element.

But you can fill st so the combination of elements you mention have a
nonzero value while the rest are zero. This can be done in a single
statement:

st(s,t)$( (ord(s) eq ord(t)*2) or (ord(s) eq ord(t)*2-1) ) = 1;

The result is:

---- 10 PARAMETER st

         t1          t2          t3          t4          t5          t6

s1 1.000
s2 1.000
s3 1.000
s4 1.000
s5 1.000
s6 1.000
s7 1.000
s8 1.000
s9 1.000
s10 1.000
s11 1.000
s12 1.000

If this is not OK, explain in detail.

Arne Stolbjerg Drud


Arne Stolbjerg Drud
ARKI Consulting & Development A/S
Bagsvaerdvej 246A, DK-2880 Bagsvaerd, Denmark
Phone: (+45) 44 49 03 23, Fax: (+45) 44 49 03 33, email: ad…@arki.dk

-----Oprindelig meddelelse-----
Fra: gamsworld@googlegroups.com [mailto:gamsworld@googlegroups.com] PÃ¥ vegne
af Jens
Sendt: 5. august 2009 19:06
Til: gamsworld
Emne: Any one can tell me how to set this initiate value

Hi, friends,

Me again. I would like to program the initial values as : (s1,s2) t1,
(s3,s4) t2, (s5,s6) t3, (s7,s8) t4…then I wrote as below:

set
s /s1s12/
t /t1
t6/
;
dynamic set t***
set tt(t);

parameter st(s,t);

initial value***
set ti(t);
ti(‘t1’)=yes;
loop (s,
st(s,ti)=s(s);
st(s+1,ti)=s(s+1);
tt(ti)=yes;
ti(t)=ti(t-1);
);
display tt,st;

the result is (s1,s2)t1, (s2,s3) t2, (s3,s4) t3…Any one can
help to modifiy it?

Thank you very much in advance!

Best regards
Jens

–~–~---------~–~----~------------~-------~–~----~
To post to this group, send email to gamsworld@googlegroups.com
To unsubscribe from this group, send email to gamsworld+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/gamsworld?hl=en
-~----------~----~----~----~------~----~------~–~—

\