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

GAMS- Domain Violation for set

I got two types of error in my GAMS code. 1- error **** 171 Domain violation for set 2- error 148, Dimension different - The symbol is referenced with more/less **** indices as declared I don't know where I am making a mistake. Px1 is my…
Asad
  • 5
  • 2
0
votes
1 answer

Can we handle a binary variable like a normal variable in GAMS

Can we treat any binary variable like a normal variable in GAMS? Is there a way to convert it? like in TSP x(i,j) is 1 if the edge between vertex i and j is selected otherwise 0. can we treat x(i,j) as normal variable and it still give correct…
RAVI
  • 1
0
votes
1 answer

Gams_magic does not work in Jupyter notebook and returns ModuleNotFoundError

I just wanted to use gams inside Jupyter notebook in order to use data frames of pandas in gams codes. I followed the instructions of this page to get started with the gams in Jupyter. However, I can not call gams and when I run this line %load_ext…
Math
  • 157
  • 7
0
votes
1 answer

How to write conditional statements in Gams

I'm new in the Gams and I try to solve a problem for my term project. Although the code does not give errors, I am not sure of its correctness. kisit5(i,h,k)$( (ord(i)>=2) and (ord(h)
Ceyda
  • 1
0
votes
0 answers

GAMS : Infeasible solution for solving non-linear problem (NLP)

I am trying to solve non-linear probrem (NLP) using GMAS. However, I am getting output "Infeasible solution".The material balance equation in chemical engineering, which describe in this paper. $title a membrane separation model Sets gas …
0
votes
0 answers

Special case for constraints in GAMS

I am trying to code the following inequality: Where So, I tried to code it in gams as follows: constraint1(k,n)..rPower(sum(j,w(j)*power(((a(k,j))-y(n,j)),p)),(1/p))-e(k)=l=rPower(sum(j,w(j)*power(((a(k,j))-y(????????,j)),p)),(1/p))-r; However,…
0
votes
1 answer

Optimization result is just the initial guess

I have an optimization problem which I've coded in pyomo as below: import pyomo.environ as pyo import pandas as pd opt = pyo.SolverFactory('ipopt') model = pyo.ConcreteModel() model.x = pyo.Var([1,2,3,4,5,6,7,8,9,10,11,12],…
mpy
  • 622
  • 9
  • 23
0
votes
1 answer

Objectif Function Gams

I'm beginner with gams , so i'm trying to create this new function into gams MAX (Σ(t=0-->2020) (Vusage (t ) * pusage * 1-busage )) where pusage and tusage are two constants and Vusage (t ) is a function depending on t incremental. How can I…
0
votes
1 answer

Alter identifier names with macros in gams

I have multiple parameters named in the same convention, e.g. parameter par_1_1 /1/ par_1_2 /2/ par_2_1 /3/ par_2_2 /4/ ; I want to define a macro, which will be replaced (based on the input) by the identifier, e.g. $macro f(x) (x_1_1) and use it…
wittn
  • 298
  • 5
  • 16
0
votes
0 answers

How can I code dynamic sets in GAMS environment?

I want to code a constraint in GAMS environment but I can't. The constraint that I want to code is seen in the image. In this constraint, x(i,m,t) is a binary variable but x(i,m,t) binary varible is changed as x(i,m,d) and as seen in the image…
0
votes
1 answer

Inline index addition in gams

I want to use an index equation to iterate over a tensors, whereas I always want to extract the value at index i and index i+1. An example: Variable x; x.up = 10; Parameter T /1=1,2=2,3=3,4=4,5=5/; Set a /1,2,4/; equation eq(a); eq(a).. x =g=…
wittn
  • 298
  • 5
  • 16
0
votes
2 answers

How to read a GAMS gms file into ROI (R Optimisation Interface)?

I have a NLP model written in GAMS and I would like to use ROI (R Optimisation Interface) to send it to the NEOS Server. It looks like ROI_read() is the command for reading in external models, but I don't know how to find out or install the correct…
Simon Woodward
  • 1,946
  • 1
  • 16
  • 24
0
votes
1 answer

Iterating multidimensional sets in gams

I want to use a set of tensors in gams. My idea was to represent them as follows (because there are no 1-to-1 tensor sets in gams): Lets say I have a tensor set which looks as follows: { [[1,2],[3,4]], [[5,6],[7,8]] } (i.e. a set containing to…
wittn
  • 298
  • 5
  • 16
0
votes
1 answer

Accessing entries of multidimensional variables using the gams-c++ api

I am generating the following gams program with my c++ program variable x(*) /1.lo = -1,1.up = 1,2.lo = -1,2.up = 1/; variable obj; equation eqobj; eqobj.. obj =e= x['1']+x['2']; parameter ms, ss, lbd, ubd, cpu; model mod /all/; option decimals =…
wittn
  • 298
  • 5
  • 16
0
votes
1 answer

Iterating multidimensional variables in gams with different set

I have the following gams program: Set x_set /1*2/; variable x(x_set) /1.lo = 0 ,1.up = 1,2.lo = 0,2.up = 1/; Set y_set /1*3/; variable y(y_set) /1.lo = 0,1.up = 1,2.lo = 0,2.up = 1, 3.lo = 0, 3.up = 1/; Set S /1*2/; variable obj; equation eqobj;…
wittn
  • 298
  • 5
  • 16