Search found 295 matches

by abhosekar
3 years ago
Forum: Syntax
Topic: Set Operations
Replies: 8
Views: 4320

Re: Set Operations

If an element in i or j columns of set f exist in set h (which is a subset of dummy_ts, not sure if this is needed or makes sense) then you want to include that element in set t. This can be done as follows. set f(s, m ,i, i); f(s, m, i, i)$(dummy_ts(i))=yes; It is not clear why you would want h(dum...
by abhosekar
3 years ago
Forum: Syntax
Topic: Set Operations
Replies: 8
Views: 4320

Re: Set Operations

Many things need to be clarified in the question before looking for the right answer. 1. "s shall always be assigned to dummy_TS" but dummy_TS is a subset of i. you cannot assign s to it. 2. "if at f(s,m,i,j) s is assigned to the subset dummy_TS": at any value of m, i, j/all valu...
by abhosekar
3 years ago
Forum: Solvers
Topic: EMP error
Replies: 5
Views: 5478

Re: EMP error

Hi, the error suggests that you have included some element in your empinfo file that without its indices (for example, x instead of x('i1', 'j1')). To figure this out, you can use GAMS command line option keep=1 so that the process directory 225.. is not deleted. After running your model, you can ch...
by abhosekar
3 years ago
Forum: Modeling
Topic: Modeling Equations
Replies: 1
Views: 1508

Re: Modeling Equations

As a general guideline, when posting a code fragment, please use code block. Your first two equation seem logically correct (did not try the syntax) Relation and ReworkEarly When you write KapaRest(t)$(Mt(t,m)), it is not clear what you mean? Do you mean if 'any' Mt(t, m) exists for a given t? In th...
by abhosekar
3 years ago
Forum: Modeling
Topic: Decision variable subset usage
Replies: 3
Views: 2680

Re: Decision variable subset usage

The following code works. I think the comma in your parameter was the problem. However, the parameter is defined on full domain and other values will be assumed to be 0. parameter cap(t, p) /t1.1 2000000 t2.2 3000000/ ; You can simply use $(tp_t(t) and sp_s(s)) to make sure that correct t and s are ...
by abhosekar
3 years ago
Forum: Modeling
Topic: Decision variable subset usage
Replies: 3
Views: 2680

Re: Decision variable subset usage

Do not repost/re-edit the same question too many times. Variable domains cannot be defined over subsets but equations can be. Using projections to create couple more subsets and then using those to define your equations might be a good way for you. In the following code, you will see how to use proj...
by abhosekar
3 years ago
Forum: Syntax
Topic: Equations with index
Replies: 7
Views: 3851

Re: Equations with index

This is trickier than one would think. For your case, you can just add another equation stating some variable v =e= z('k1'); Followed by minimizing v. However, there could be a case when one wants to solve this in a loop for all k. For general purpose, one can define v=e= z(ksub); where ksub is a si...
by abhosekar
3 years ago
Forum: GAMS-FAQ
Topic: Different solutions across solvers/versions/ small changes in data FAQ
Replies: 0
Views: 9354

Different solutions across solvers/versions/ small changes in data FAQ

There are several reasons for observing different solutions across different solvers, or different versions of solvers, or with respect to small changes in data. Critical optimality tolerance The default value of the relative optimality tolerance (optcr)is 0.0001. This means that, unless otherwise s...
by abhosekar
3 years ago
Forum: Syntax
Topic: Equations with index
Replies: 7
Views: 3851

Re: Equations with index

"" or '' both work while accessing a set element. What you are trying to do is equivalent and should work (except for several typos which you will figure out when you run). You also need 120*term(k, 'f_inv') somewhere in the equation. This approach will get complicated if there are more te...
by abhosekar
3 years ago
Forum: Syntax
Topic: Equations with index
Replies: 7
Views: 3851

Re: Equations with index

Technically, it should work. I see that you have an extra comma "," after k3 in set definition. What is the error that you are getting? One workaround is using sameAs(). In your case, you can do ObjFunction(k) $(sameAs(k, 'k1')).. However, I suspect that the error is not related to equatio...