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
1
vote
1 answer

How can I get an element of a particular index from a set in GAMS?

Suppose I have the set ``codes" in GAMS: SET codes /aaa, aab, aac, aad, aae/; How can I then say get the 3rd element (or any element) in the set in GAMS?
Stoner
  • 846
  • 1
  • 10
  • 30
1
vote
1 answer

Dynamic set operations in compilation phase

I am trying to define some sets dynamically with set operations (in my case the "-" operation). However, the "-" operation seems to apply only during the execution phase, and when using this set when defining other sets, gams fails with the…
Jon
  • 351
  • 2
  • 10
1
vote
2 answers

Accessing the last element of a variable in GAMS

I have a set: Set t /t1*t6/; Let us consider there is a variable called var. I have a constraint that the last element of var is less than 20. Variable var(t); Equation const; const.. var('t6') < 20; I would like to replace 't6' in the last line…
Rajat
  • 249
  • 1
  • 11
1
vote
0 answers

Multi Objective Optization using GAMS optimization software

I want to know whether we can do multi objective optimizaion using GAMS optimization software . We have to write the program by changing the weights of the objectives or is there any other method of doing that. please let me know.
Mr. Prasad
  • 19
  • 4
1
vote
1 answer

GAMS: Filename cannot be used as valid UEL

I trying to merge a large data set in gams. The file should consist of multiple gdx files with several names. The programme merges the files as I would like them to however: it replaces the names of the file to be merged with File_1, File_2, File_3…
ima
  • 155
  • 12
1
vote
0 answers

GAMS & Python / challenge connecting these two on a Mac

although I went through the GAMS Python API tutorial, I am getting the following error messages when trying to run transport.py. Can anybody help me here? I am using Python 3.6 and GAMS 24.8. I guess that Python and GAMS are not properly linked on…
Kai Schaal
  • 21
  • 2
1
vote
1 answer

Set conditions in GAMS

I have a set of nodes i and have created an alias (i,j). Now I have a parameter c(i,j) where I want i elements to be mapped to j distinctively. For example, set i /a,b,c/ ; alias (i,j) ; c(i,j) /#i.#j/ ; Dot operator maps all elements such as a.a,…
Manal Jain
  • 25
  • 3
1
vote
2 answers

Constraint using IF statement

I am using GAMS to solve a network distribution problem and this is my first time using GAMS. I have the following constraint (see Image) which I want to write in gams but keep getting errors. Trying to figure it out using IF statement or any other…
Manal Jain
  • 25
  • 3
1
vote
3 answers

Convert nonlinear objective function to linear objective function

Right now, I am using GAMS solver to maximize the objective function (maximization of the Total Average Capacity Utilization) written below: objFunction.. G =E= sum((i,j), X(i,j)/caprepaircenter(j)) / sum(j, Z(j)); In the objFunction; X(i,j)…
TOLGA
  • 11
  • 1
1
vote
1 answer

conditional range in sum

I have a condition where I need to sum over the next 5 elements of a set. My condition is: sum(neighbor(x)) = 1 w.r.t x, from x+1 to x+5 Equation has_1_neighbor(x); has_1_neighbor(x).. Sum(x,x + 1,x+5,neighbor(x)) =e= 1; Unfortunately…
Bomaz
  • 1,871
  • 1
  • 17
  • 22
1
vote
1 answer

GAMS indexing query

Hi I am trying to optimize a function involving the components of a variable s(L) indexing by the set L /1*10/; I created a subset Leven of the set L involving the even numbers (Leven /2,4,6,8,10/) I want to write down an equation which sets the…
user401988
  • 19
  • 2
1
vote
1 answer

How to constrain the integer variable staying out of an integer interval

As mentioned in the title, how to use a linear constrain to ensure an integer n is staying out of (n1, n2), in which n,n1,n2 are all integers, and the interval is not [n1, n2]. I formulate the problem in GAMS as n2 - n1 =l= abs(2*n - n2 - n1) but…
Patrick
  • 181
  • 1
  • 1
  • 11
1
vote
1 answer

GAMS to AMPL OPTIMIZATION

I wondered if someone could help me make this GAMS model to a AMPL model. I am trying to understand the language. Before hand thanks! You can see the model below. GAMS Model set activity / A*G/; alias (activity,i,j); set prec(i,j) / A.(B,C),…
Jin Danny
  • 11
  • 1
1
vote
1 answer

If Function in GAMS

I've been busy with a model, but I'm uncomfortable about the result because I think GAMS violates a constraint. What I want to tell to GAMS is: "check demand first -> then check current stocks -> IF there is enough stocks sell from current stocks…
1
vote
1 answer

Use variable in GAMS dollar

I have a GAMS code where I want an if statement. I've read about dollar condition and I thought it could help me. Reading GAMS user guide, it says: The Dollar Condition This section introduces the dollar operator , which is one of the most…
Manuelpalcaraz
  • 69
  • 3
  • 10