Hi
Your example is not clear to me. Either post your GAMS code or make your example more explicit, so people can try to find an answer for you.
Cheers
Renger
Search found 639 matches
- 6 years ago
- Forum: Syntax
- Topic: Assign Set in constrant
- Replies: 1
- Views: 2481
- 6 years ago
- Forum: Modeling
- Topic: Capital evolution with five-year step
- Replies: 1
- Views: 3038
Re: Capital evolution with five-year step
Hi
Take a look at "Calibration of Models with Multi-Year Periods" on http://www.mpsge.org/mainpage/mpsge.htm by Tom Rutherford.
Cheers
Renger
Take a look at "Calibration of Models with Multi-Year Periods" on http://www.mpsge.org/mainpage/mpsge.htm by Tom Rutherford.
Cheers
Renger
- 6 years ago
- Forum: Modeling
- Topic: New to GAMS to create simple LP program
- Replies: 2
- Views: 3730
Re: New to GAMS to create simple LP program
Hi Fady You write "... to create a simple LP program", but your constraints are not linear (they have a multiplication of variables). So, it is obviously not a simple LP. MIP is Mixed Integer Linear Program, so this will not work. This is a RMINLP (see https://www.gams.com/latest/docs/user...
- 6 years ago
- Forum: Syntax
- Topic: if statement with constarints
- Replies: 2
- Views: 6095
Re: if statement with constarints
Hi You can't use if-constructs in constraints, but you can use the $-operator (see the manual for more information) in your constraints if the condition relates to a parameter (not to a variable): This works parameter p(t); variable E(t), A(t), B(t); myeq.. E(t) =E= A(t)$(p(t)>0) + B(t)$(p(t) < 0); ...
- 6 years ago
- Forum: Syntax
- Topic: problem in if statement
- Replies: 1
- Views: 4669
Re: problem in if statement
Hi You have to loop over t as Gams doesn't allow this kind of direct assignment in an if-statement: loop(t, if (a(t) <=b(t), p(i,t)=a(t); else p(i,t)=b(t); ); ); You could do this, however using the dollar sign p(i,t)$(a(t) < b(t)) = a(t); p(i,t)$(a(t) > b(t)) = b(t); p(i,t)$... is pronounced as p(i...
- 6 years ago
- Forum: Modeling
- Topic: How to build a recursive dynamic model
- Replies: 2
- Views: 5173
Re: How to build a recursive dynamic model
Hi I probably would write a loop and then update PEXP as a parameter instead of a variable(you then do not define your variables over the set year anymore, so your model is just for one year and solve every time in the year loop). Some pseudo code: * initialize pexp for the first year pexp_prev(i) =...
- 6 years ago
- Forum: Syntax
- Topic: sum over a set /p1*p5/
- Replies: 0
- Views: 5696
Re: sum over a set /p1*p5/
Hi Yanzhiping
You should look at the error message you get when you submit your model to gams.
It clearly states that it is expecting a '=E=', '=L=', or '=G=' in your equation. You have a '=', which is not allowed in equations (see the manual).
Cheers
Renger
You should look at the error message you get when you submit your model to gams.
It clearly states that it is expecting a '=E=', '=L=', or '=G=' in your equation. You have a '=', which is not allowed in equations (see the manual).
Cheers
Renger
- 6 years ago
- Forum: Tools
- Topic: GDX to sql server
- Replies: 5
- Views: 7484
Re: GDX to sql server
Hi
I probably would export the data in an excel sheet connected to Microsoft SQL using gdxxrw.
Cheers
Renger
I probably would export the data in an excel sheet connected to Microsoft SQL using gdxxrw.
Cheers
Renger
- 6 years ago
- Forum: Syntax
- Topic: how to uses ord on a dynamic set
- Replies: 2
- Views: 9868
Re: how to uses ord on a dynamic set
set year 'All years' /2016*2050/;
set yearsub(year) Subset of years;
define subset
loop(year$yearsub(year),
....
);
Cheers
Renger
set yearsub(year) Subset of years;
define subset
loop(year$yearsub(year),
....
);
Cheers
Renger
Re: summation
Hi
From your question it is not completely clear to me what you want. Is this what you are looking for (otherwise write down the mathematical expression for your question):
OBJ =E= sum((i,k), X(i,k)*C(i))
Renger
From your question it is not completely clear to me what you want. Is this what you are looking for (otherwise write down the mathematical expression for your question):
OBJ =E= sum((i,k), X(i,k)*C(i))
Renger