help-glpk
[Top][All Lists]

## [Help-glpk] [feature] defining sets of dynamic dimensions?

 From: Yingjie Lan Subject: [Help-glpk] [feature] defining sets of dynamic dimensions? Date: Fri, 16 Jul 2004 12:57:36 -0700 (PDT)

```Hi,

#############BEGIN CODE#################
param problem_dimension >0 integer;
param capacity >0 integer;
set state_space;

if( problem_dimension == 1 ) then {
let state_space := { 1..capacity };
}else if( problem_dimension == 2 ) then {
let state_space := { 1..capacity,
1..capacity };
}else if( problem_dimension == 3 ) then {
let state_space := { 1..capacity,
1..capacity,
1..capacity };
}else ...
#############END CODE#################

So, basically, what's going on here is defining
an index set whose dimension is dynamic.

Suppose we can support the following syntax:

####################
set state_space :=
{
sc{i in 1..problem_dimension}:
sc[i] in 1..capacity
};
####################

Here

##############################
sc{i in 1..problem_dimension}
##############################

declares a dummy tuple 'sc' indexed on

##############################
i in 1..problem_dimension,
##############################

where 'i' is the dummy variable
to index the dummy tuple 'sc'.

Once we have defined it, we would also like to
have similar syntax to reference the elements
in the dynamic-dimension set:

##############################
param cost{
sc{1..problem_dimension} in state_space
}:= sum{ i in 1..problem_dimension} sc[i];
##############################

It seems to me very challenging to have this
feature integerated into the language, isn't it?
And it would certainly increase the power of
the modeling language. I would appreciate any
feed back from you. Thanks!

__________________________________
Do you Yahoo!?
Yahoo! Mail is new and improved - Check it out!
http://promotions.yahoo.com/new_mail

```