dynamic indexes

Hi,

I want to define a set like

{1,2,3,…,p}

where p is an integer (data entry). How do I do this?

Another doubt : GAMS doesn’t accept

scalar M / sqrt(2) /; ?

Which is the right way to write M = square root (2) ?

Thank you,

Brígida


\

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.

Brigida,

The usual way to do what you describe is with this code:

$if not set NN $set NN 4

scalars
N / %NN% /
s2 / [ sqrt(2) ] /
;
set I / 1 * %NN% /;


The compiler variable NN will default to 4 if you don’t set it another
way (e.g., on the command line like gams mymodel.gms --NN=2000). Not
the scalar s2 also - to evaluate a constant function where a literal
constant is expected enclose it in square brackets - the compiler will
evaluate the function then.

-Steve

On Thu, Mar 31, 2011 at 11:48 PM, Brígida Sartini wrote:

Hi,

I want to define a set like

{1,2,3,…,p}

where p is an integer (data entry). How do I do this?

Another doubt : GAMS doesn’t accept

scalar M / sqrt(2) /; ?

Which is the right way to write M = square root (2) ?

Thank you,

Brígida


“gamsworld” group.
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.




– Steven Dirkse, Ph.D. GAMS Development Corp., Washington DC Voice: (202)342-0180 Fax: (202)342-0181 sdirkse@gams.com http://www.gams.com