Page 1 of 1

Entering some of the values of a variable table

Posted: Thu May 21, 2020 8:50 pm
by aeo
Hi there!
I am pretty new in using GAMS, so I could not find a solution to my problem, despite all my research.
I am trying to define a variable with 3 dimensionsi X(i,j,k), however, i have some data points of this variable, so I would like to enter those values in this variable also. I wonder if anyone can help me figure that out.

Thank you.

Re: Entering some of the values of a variable table

Posted: Sat May 23, 2020 8:55 am
by Renger
Hi
It is not completely clear to me what you are looking for: If you know the solution for some of the variable X, you just have to fix them to that value, e.g.

Code: Select all

X.FX(i,j,k) = 200;


Cheers
Renger

Re: Entering some of the values of a variable table

Posted: Sat May 23, 2020 1:37 pm
by Damaskinos
Hi,

if you want to define let's say three dimensional parameter you can do it as in the following example:

Code: Select all

Set
i /s, n1, n2, t/            
j /s, n1, n2, t/
k /1*2/;

*or you can use Alias(i,j); if in your case they're the same sets like in my example

Table c(i,j,k)
     s.1   n1.1  n2.1  t.1  s.2 n1.2 n2.2  t.2
s     0      5      1     0    0     3     1      3
n1  2       1      1     2    0     1     1      1
n2  0       5      1     0    3     1     4      1
t    10      1     1     0     0     2     1      1;
Index i is used for rows; (j,k) in this order is used for columns. As you may see (j,1), where k =1 is the first half of the table and the second half of the table is for (j,2), where k=2. Hope this helps and sorry with badly shifted table.