Questions tagged [gams-math]

GAMS (General Algebraic Modeling System) is a high-level modeling system for mathematical optimization.

The General Algebraic Modeling System (GAMS) is a high-level modeling system for mathematical optimization. GAMS is designed for modeling and solving linear, nonlinear, and mixed-integer optimization problems.

References:

368 questions
0
votes
1 answer

data of GAMS in deffrent sheet

I have 2 Set and one parameter, I want to export these data to excel set j/1*200/ E(i,j) v(i) a(i); alias(i,j); I want to have 'v' be Sheet1, 'a' in sheet2 and 'e' in sheet3. I don't know the rng of my set . whice command…
ilen
  • 107
  • 10
0
votes
1 answer

GAMS - Integer variable as index

Let's consider a parameter A that takes a non-negative index and returns an integer. I would like to use the value of A in the optimization process, so I created an integer variable B. My goal is to use B as an argument for A, such that the…
Cynnexis
  • 63
  • 1
  • 5
0
votes
1 answer

GAMS - Unit step function

I need to use the step function in order to count the number of non-zero elements in a parameter. The step function that I am considering is the following: After searching on the internet for solution, I realized we can create stepwise functions…
Cynnexis
  • 63
  • 1
  • 5
0
votes
1 answer

Export from GAMs to a text file

After solving my model in GAMS, I have 2 value, val1 and val2. How can I export the value of these variable(val1 ,val2) to text file , e.g. to .text or CSV format? Thanks
ilen
  • 107
  • 10
0
votes
1 answer

uniformInt produce duplicate number

I asked this question Generate 100 data randomly, or select if it is possible a few days ago. Now when I want to pick 10 number randomly , from a set of i /1*300/. i use this code : Set I /0*300/ picks /p1*p10/; Scalar …
user9990604
0
votes
1 answer

gams specify network of flux with lots of zeros (sparse matrix)

I tried to use gams to find flow of material across network of nodes. I defined set edge(i,n,nn); positive variable flux(i,n,nn); y.up(i,n,nn)$( not edge(i,n,nn)) = 0; My intention is to define 3D matrix of variable for flux of matrial i from…
yosukesabai
  • 6,184
  • 4
  • 30
  • 42
0
votes
1 answer

Generate 100 data randomly, or select if it is possible

I want to test my model , I need to test it in some data , I want to generate data , in fact I want to have 125 different parameter from 0 to 10000. For example , in below we have 4 different parameter ,from 1 to 300. Set I/0*300/; Parameter…
user9990604
0
votes
1 answer

Display only something

can we have the display command with certain conditions , For example, if we want to just print things their value are bigger than 7 . in other word how can we have Display $( x.val> 7) In general, is it possible to have condition on display…
Richard
  • 177
  • 1
  • 9
0
votes
1 answer

Summation under null set

I have a few collection ,and the intersection of these collections gives me a few new collection. I want to have summation under these intersections , but some of these are null. And I get an error for my summation, for example Set I/1*3/; Set…
Richard
  • 177
  • 1
  • 9
0
votes
2 answers

GAMS decimal numbers

I have the following code: loop (d, rnd(d)=uniformInt(1,nd) ); I am going to use the integer numbers rnd(d) as an index of another set s(i). But for example when rnd(d)=34.000 however, it is integer, but s(34.000) has no valid index since,…
Morteza
  • 85
  • 1
  • 6
0
votes
1 answer

How can obtain it?

I have a set j and parameter edge. I have a graph too. Set j/1*5/; Alias(j,jp); Parameter edge(j,jp) That edge(j,jp) =1 if there is arc from j to jp , and it's 0 if there isn't arc from j to jp. I maked edge(j,jp) . I want to…
Richard
  • 177
  • 1
  • 9
0
votes
2 answers

GAMS Error 121 - Issue with indexing gdx data

I have difficulties in reading data that I need from .gdx file. I have succeeded in loading file from Excel, but I get an error when I try to access index that I need: Sets t time intervals / t1*t12 / [b] !! set definition[/b] i…
Sanja
  • 41
  • 7
0
votes
1 answer

How to access a member in the subset in GAMS?

I have set i/1*7/ and parameter u(i) /1 15,2 5,3 15,4 30,5 21,6 30,7 11/ I want to find maximum element of u(i) , i use 'smax' , I write this code: set j/1*7/; parameter u(i) /1 15,2 5,3 15,4 30,5 21,6 30,7 11/; scalar max_val; …
user9990604
0
votes
1 answer

summation with index " i " and "i+1" in GAMS

I don't know how can I code this summation in GAMS because it has index with difference one . I mean I have index i and i+1. this summation must be calculated `for i = 1,..,54; i,j are sets ,a(i),b(i) , c are parameters and x,y are…
Richard
  • 177
  • 1
  • 9
0
votes
1 answer

Check For all index , in GAMS

Let 'I' from 1 till 100 , be a set , and w(I), u(I) be a parameters , how can code this statement in GAMS : if for all I we have w(I)<0 and w(I)*u(I) =0 then display ' converged'.