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 to set upper and lower bounds for each element in a set?

I am creating a GAMS model to solve a simple maximization problem. I have a set J with 3 elements (1,2,3) and a variable x(J) that encompasses all the elements. I am wondering if there is a way in GAMS to set a lower bound of 0 and upper bound of 3…
1
vote
1 answer

GAMS optimazation using MIP: Stuck in a local minima. What can I do

I have a minimization problem where I don't get optimal solution through MIP. I am wondering how to fix my problem. It might have been stuck in local minimum.What can I do? I have also considered to change the tolerenance. How do I change the…
k.dkhk
  • 481
  • 1
  • 11
  • 24
1
vote
0 answers

GAMS: Setting one variable to be equal to the second smallest of another vector variable

SET i /i1 * i10/ ; VARIABLES x(i) y ; I have an optimization (mip) problem where i need my control variable y to be equal to the second smallest number of x. How can I create an equation to do that? EQUATIONS myconstraint ; myconstraint .. y…
k.dkhk
  • 481
  • 1
  • 11
  • 24
1
vote
1 answer

String variables in GAMS

How can I define a string variable in GAMS. I want to use it as a reference to including files as shown below set file = "myfile.inc"; (i have no idea how to do this part) $include file; istead of $include "myfile.inc"
k.dkhk
  • 481
  • 1
  • 11
  • 24
1
vote
1 answer

Is it possible to use scalar in set definition (GAMS)?

I solve a model and get an answer that I called it "sol" i want to have set 'i' such that i={1,...,sol}. Instead of changing the . I wrote set as below, but it didn't work. In other words I need my set changes depending on the value of sol. My…
Richard
  • 177
  • 1
  • 9
1
vote
1 answer

GAMS: changing names of files to include in a loop

I want to include multiple csv files and I want to refer to the them in a loop. All my files have systematic names: file1.csv, file2.csv etc. How do I create a loop including all the files? I am looking for something like this: set j /1*10/ loop(j, …
k.dkhk
  • 481
  • 1
  • 11
  • 24
1
vote
1 answer

Problem using Simpson's integration rule in GAMS

I have made a simple code using GAMS which determines the maximum reach of a glider using trapeziod integration. I want to recreate the same program with SImpson's integration, however, I cannot understand the results. This is the functional code…
slow_learner
  • 337
  • 1
  • 2
  • 15
1
vote
1 answer

Pyomo gams writer

I have the following problem. I want to solve a number of MINLP's in the following manner: Create .gms file using pyomo Solve model on a server with the gams license and solver's like BARON and SCIP Use the solution of the current MINLP for the…
hans gams
  • 11
  • 1
1
vote
1 answer

Find the difference between upper and lower bounds

I have a MIP model with name "MyModel", i used these commands too( before the solve statement). file opts cplex option file/ cplex.opt /; MyModel.Optfile =1; putclose opts /'epgap=0' /'epagap=0'; after solving it with CPLEX, the status model…
Richard
  • 177
  • 1
  • 9
1
vote
1 answer

Gams uncontrolled index issue

I have this situation in GAMS: Sets i mina / m1, m2 / ; Parameters k(i) non important description / m1 10 m2 20 /; Variables x(i) non important…
Daniel
  • 7,357
  • 7
  • 32
  • 84
1
vote
1 answer

In GAMS, what is the difference between variables and parameters?

In GAMS, what is the difference between variables and parameters? In which cases is one of them better to use than the other one?
Kim
  • 159
  • 3
  • 11
1
vote
1 answer

Dealing with GAMS error: A suffix is missing

I am solving a model in GAMS. When running the optimzation model I want to save the optimal solution in a new varable. The heart of the code looks like this: variables xSave(t) 'saving the value of x at optimum' x(t) 'variable'; …
Kim
  • 159
  • 3
  • 11
1
vote
1 answer

Using the sum function in GAMS to sum over a subset of variables

I am working with maximazation problems in GAMS where I will choose X=(x_1,x2,...,x_n) such that f(X)=c_1*x_1+...c_n*x_n is maximized. The c's are known scalars and I know n (10 in my case). I want my constraints to be such that the first (n-1)=9…
Kim
  • 159
  • 3
  • 11
1
vote
1 answer

GAMS - Parameter containing set values

I'm new in GAMS, and I would like to create a parameter that returns items of a set instead of real numbers: sets A / A1, A2, A3, A4, A5 / B / B1, B2, B3, B4, B5 /; parameters C(A) / A1 B5, A2 B4, A3 …
Cynnexis
  • 63
  • 1
  • 5
1
vote
1 answer

GAMS Error: Endogenous function arguments not allowed in linear models

I am trying to solve in GAMS for the binary variables using MIP but am constantly getting an error. I am unable to understand the reason. Anyone got a solution? Set i cities /1*7/; Binary variables z1,z2,z3,z4,z5,z6,z7 1 if selected and 0…
Shraddha Avasthy
  • 161
  • 3
  • 13