Open 0UmfHxcvx5J7JoaOhFSs5mncnisTJJ6q opened 4 months ago
sorry, what is your problem here?
In GAMS there is no difference in using a set, or an alias for a set.
Set foo / 1 * 2 /;
alias(foo, bar);
display foo, bar;
execute_unload "foobar.gdx", foo, bar;
It says that it is an alias, but displays the values all the same.
---- 5 SET foo
1, 2
---- 5 SET bar Aliased with foo
1, 2
But reading an alias with readGDX()
does not return the values of the set:
> str(readGDX('foobar.gdx', 'foo'))
chr [1:2] "1" "2"
- attr(*, "gdxdata")=List of 5
..$ name : chr "foo"
..$ type : chr "set"
..$ form : chr "sparse"
..$ domains: chr "*"
..$ domInfo: chr "none"
- attr(*, "description")= chr ""
> str(readGDX('foobar.gdx', 'bar'))
List of 3
$ name : chr "bar"
$ type : chr "alias"
$ aliasFor: chr "foo"
So users cannot simply look up (something that looks like) a set in GAMS (say in the definition of an equation) and use that with readGDX()
. They have to first check if that is an alias.
Since this is an deliberate choice (followAlias = FALSE
is not the default), I wonder why that is.
https://github.com/pik-piam/gdx/blob/6a32a336ade7bfc7459ffda9215db152c6fe5096/R/readGDX.R#L221 What is the rationale for this? Sets and their aliases are used transparently in GAMS, why not here?