Search found 89 matches

by Renger
1 day ago
Forum: Modeling
Topic: Vector multiplication into a matrix
Replies: 2
Views: 57

Re: Vector multiplication into a matrix

Hi For this you can use a double loop: set i /i1*i4/, j /j1*j5/; parameter vector1(i), vector2(j), matrix(i,j); * Give some random values: vector1(i) = ord(i); vector2(j) = ord(j) loop(i, loop(j, matrix(i,j) = vector1(i) * vector2(j); ); ); display matrix; Cheers Renger
by Renger
2 days ago
Forum: Syntax
Topic: Beginner Question: Using csv as an input
Replies: 4
Views: 92

Re: Beginner Question: Using csv as an input

Hi Leo

Why would you use a header? I would do it like this:

Code: Select all

sets
   y   /2015,2020/
;
parameter param(y) /
$ondelim
$include param.csv
$offdelim
/;

display param;
with param.csv

Code: Select all

2015,0.5
2020,0.6
Cheers
Renger
by Renger
3 days ago
Forum: Syntax
Topic: coordinates
Replies: 1
Views: 21

Re: coordinates

Hi Noob

Take a look at https://www.gams.com/latest/gamslib_ml/ ... _emfl.html
and https://www.gams.com/latest/testlib_ml/ ... mpsol.html
Perhaps that these models will give you some ideas.
Cheers
Renger
by Renger
5 days ago
Forum: Syntax
Topic: Beginner Question: Using csv as an input
Replies: 4
Views: 92

Re: Beginner Question: Using csv as an input

Hi You made some mistakes in the syntax and the definition of the tables themselves (the second table was defined as a parameter at the beginning of your code and you don't have to use the forward slashes). Here is the correct code: table Hourly(y,sc,nd,*,*) $ondelim $include hourlyInputData.csv $of...
by Renger
5 days ago
Forum: Syntax
Topic: Set limit as a predefined scalar
Replies: 1
Views: 37

Re: Set limit as a predefined scalar

Hi For this you can use the $setlocal or $setglobal command which allows you to run your code with different values: $setlocal n 5 SET i vertex index /1*%n%/; display i; Now you can easily change this value by setting this parameter as an option: gams mymodel --n=19 This will override n and use 19 i...
by Renger
6 days ago
Forum: Syntax
Topic: Using GAMS on Mac OS X Environment with Wine bottler
Replies: 9
Views: 142

Re: Using GAMS on Mac OS X Environment with Wine bottler

With projects, Gams looks in the same directory for the excel file. So if it is lying somewhere else you have to add the path to the gdxxrw command.
Cheers
Renger
by Renger
6 days ago
Forum: Syntax
Topic: Using GAMS on Mac OS X Environment with Wine bottler
Replies: 9
Views: 142

Re: Using GAMS on Mac OS X Environment with Wine bottler

Hi

As I don't have your excel file, I can only guess. Perhaps the file has the extension xlsx (and not xls). You can also add at the end of the gdx command "trace = 3", then you will see where gdx has problems importing or exporting the data.

Cheers
Renger
by Renger
6 days ago
Forum: Syntax
Topic: conditional statement
Replies: 1
Views: 46

Re: conditional statement

Hi
You should write X2.L instead of L.X2
Cheers
Renger
by Renger
6 days ago
Forum: Modeling
Topic: Node-edge constraint
Replies: 1
Views: 56

Re: Node-edge constraint

Hi Just a thought: If you have a binary variable gamma(i) for the nodes and a binary variable delta(i,j) for the edges (if i is not activated, this doesn't mean that node j will be deactivated as there might be edges from other nodes), then you might do something like gamma(i) - delta(i,j) = 0; Hope...
by Renger
6 days ago
Forum: Modeling
Topic: Programming
Replies: 1
Views: 44

Re: Programming

Hi

The probability of getting an answer increases with the amount of information you send... (code, tables,...)
Have a look at the guidelines on how to post a question.

Cheers
Renger