Search found 72 matches

by GabrielYin
5 years ago
Forum: Syntax
Topic: How to update parameters iteratively within a Loop?
Replies: 5
Views: 6284

Re: How to update parameters iteratively within a Loop?

Dear, I have a similar problem, but instead of updating parameter I would like to write it in in a matrix/array at each iteration. My code is the following: *parameters xNpjf(P,Jn); set ITR /ITR0 * ITR5/; parameter mat_xNpjf(P,Jn,ITR); loop(ITR, solve $include "C:\Users\is\Documents\gamsdir\pr...
by GabrielYin
5 years ago
Forum: Syntax
Topic: Data Transfer with Same Index Length
Replies: 0
Views: 1851

Data Transfer with Same Index Length

Hi all, I got stuck in how to transfer the table/parameter data with different index but the same length. Take the following as an example: Set l All Trans. Lines/l1*l81/ cl(l) Candidate Trans. Lines /l7*l81/ cl1(cl) Candidate Trans. Lines /l7*l21/ cl2(cl) /l22*l36/ ; Table CLDATA1(cl1, *) Trans. Li...
by GabrielYin
5 years ago
Forum: Syntax
Topic: Add dynamically constraints to a model
Replies: 2
Views: 3398

Re: Add dynamically constraints to a model

Hi, I do not know whether you want to add one more constraint per iteration or not. But here is my example. This is a Benders Decomposition example, and it works for adding one more Benders cut constraint to the master problem in each iteration. I use semi-pseudocode to enhance readability. Set k it...
by GabrielYin
5 years ago
Forum: Syntax
Topic: Can GAMS define my own function?
Replies: 2
Views: 4152

Re: Can GAMS define my own function?

Gabriel, GAMS does not support functions of the sort you describe. Instead, you can use the include facility to include a file containing the GAMS source at both spots. A little reminder though: you cannot declare things inside an if statement. It is fine to make assignments and solve models inside...
by GabrielYin
5 years ago
Forum: Syntax
Topic: Can GAMS define my own function?
Replies: 2
Views: 4152

Can GAMS define my own function?

Hi All, I am considering if GAMS can store codes to one callable function like Matlab and C then use the function in another gms. file. Like the sample use of: Loop(iter, if(ord(iter)<=1, s(i) = m.l(i); call:function.gms; ... ); if(ord(iter)>1, call:function.gms; ... ); ); the "function.gms&quo...
by GabrielYin
5 years ago
Forum: Syntax
Topic: Inner Assignment of Parameter
Replies: 1
Views: 2268

Inner Assignment of Parameter

Hi All, I wonder if there is an efficient way to assign values for part of the parameter. For instance, I have a parameter with 64 values controlled by m. Then I have another parameter with 12 values controlled by n. Now I want to put the latter parameter within the former one. Specifically, I want ...
by GabrielYin
5 years ago
Forum: Modeling
Topic: Aggregate Parameter Indices
Replies: 3
Views: 3818

Re: Aggregate Parameter Indices

By the way, I think GUSS needs exactly a single scenario index 's' to run right? But likely if I have a scenario set which is controlled by multiple indices like I posted previously, is it possible to use GUSS? The relevant site and my another post about GUSS are listed below. https://www.gams.com/l...
by GabrielYin
5 years ago
Forum: Modeling
Topic: Aggregate Parameter Indices
Replies: 3
Views: 3818

Re: Aggregate Parameter Indices

Hi, GAMS has an obscure syntax to do exactly this. For details see https://www.gams.com/latest/docs/UG_SystemAttributes.html#UG_SystemAttributes_PowerSet . $set digits 3 set s / s1*s%digits% /, b / 1,2,3 /; $eval nMax power(card(b),card(s)) set n / n1*n%nMax% / x(n,s,b) / system.powerSetRight /; pa...
by GabrielYin
5 years ago
Forum: Syntax
Topic: GUSS issue for parallel computing
Replies: 2
Views: 2849

Re: GUSS issue for parallel computing

Hi, GUSS solves the base case first, i.e. the model with the given values for parameter rhsy2. This parameter has not been filled with data hence GUSS or better GAMS complains. Just remove the "scenario dict" from the solve statement and you get a very similar compilation error. Even thou...
by GabrielYin
5 years ago
Forum: Syntax
Topic: GUSS issue for parallel computing
Replies: 2
Views: 2849

GUSS issue for parallel computing

Hi All, Gather-Update-Solve-Scatter (GUSS) (link: https://www.gams.com/latest/docs/S_GUSS.html )gives me a very good insight to solve multiple models with different parameters efficiently. However when I was going to implement my own model, it has some problems which I cannot figure out. I tried to ...