## Search found 88 matches

- 1 day ago
- Forum: Syntax
- Topic: Set Operations
- Replies:
**8** - Views:
**124**

### Re: Set Operations

There are a couple of typos in my previous comment. Following code works. set s /s1*s5/ m /m1*m4/ i /i1*i8/ dummy_ts(i) /i2, i6, i7/ h(dummy_ts) /i2, i6, i7/ ; display dummy_ts h; alias(i, j); set f(s, m, i, i); f(s, m, 'i2', 'i6') = yes; sets fprojected1(i) fprojected2(i) fprojected(i); *fprojected...

- 1 day ago
- Forum: Syntax
- Topic: Set Operations
- Replies:
**8** - Views:
**124**

### Re: Set Operations

Let me reframe your question: You need t(s, i) only when i is in dummy_ts and i is in 'any' two of the last two columns of f. It is much clearer now that you need to create another set to tell you whether a given i exists in the last two columns of set f. Let's say that set is fprojected(i) that con...

### Re: EMP error

This is what I explained in my previous response and also the error message mentions the exact same thing that you have included a symbol that is 2 dimensional without any index. You should explicitly add C1_LL('h1','t1'), C1_LL('h2','t2') and so on. Simply writing C1_LL is not enough. You can do th...

- 1 day ago
- Forum: Syntax
- Topic: Set Operations
- Replies:
**8** - Views:
**124**

### 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...

- 2 days ago
- Forum: Syntax
- Topic: Set Operations
- Replies:
**8** - Views:
**124**

### 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 values of m, i, j? is f ...

### 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...

- 4 days ago
- Forum: Modeling
- Topic: Modeling Equations
- Replies:
**1** - Views:
**105**

### 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...

- 4 days ago
- Forum: Modeling
- Topic: Decision variable subset usage
- Replies:
**3** - Views:
**106**

### 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 ...

- 4 days ago
- Forum: Modeling
- Topic: Decision variable subset usage
- Replies:
**3** - Views:
**106**

### 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...

- 4 days ago
- Forum: Syntax
- Topic: Equations with index
- Replies:
**7** - Views:
**166**

### 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...