1
$\begingroup$

Gams problem instances can be saved in a .inc file what is basically just a .txt file and u can make gams read from that, but how can i automatize the generation process for those problem instances? I also want to generate random values in the process. I want to have the flexibility to create every possible instance size. What the best non-tedious way?

example of the beginning of an .inc file

Sets
         j               / P1*P3 /
         t               / T1*T10 /;
  
Scalar
         C               / 11 /;

Table D(j,t) Demand
            T1        T2        T3        T4        T5        T6        T7        T8        T9        T10       T11       T12
P1          6         7         8         7         8         5         9         3         6         1         7         1         
P2          6         7         8         7         8         5         9         3         6         1         7         1         
P3          3         3         1         1         2         2         1         1         1         3         3         2  
```
$\endgroup$
3
  • 2
    $\begingroup$ Data for GAMS can from a number of sources. Spreadsheets, databases, CSV files, programming languages such as R, Python, C, etc. Random numbers can come from these data sources or you can use a GAMS random number generator. $\endgroup$ Nov 7 '20 at 16:28
  • $\begingroup$ @Erwin Kalvelagen can u provide an example with python? $\endgroup$ Nov 7 '20 at 17:23
  • 2
    $\begingroup$ GAMS has a tutorial on their website for the Python API. So this is a bit of a RTFM question: gams.com/latest/docs/… $\endgroup$ Nov 7 '20 at 17:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.