Skip to main content
Solved

# set and subset in the index domain

• 2 replies
• 66 views

Hi community!

I have a problem about a formulation and I am looking for help!

I have defined a set “Input” index i, and two subsets “input1d” index id and “input1s” index is.

Here is my formulation of a constraint:

Identifier : MassConservation12

Index domain : (i,id,is,r)

Definition : sum(t, S1(i,t,r))+Stock1(i,r-1)=sum(d, Y1(id,d,r))+sum(s, uu1(is,s,r))+Stock1(i,r)+ZZ1(id,r)

Should I modify the index domain in order to make clear that id and is are subsets of i?

Thank you!

### 2 replies

Userlevel 5
+6

Hey @Valque

I must say that I did not fully understood the goal/problem. When setting subsets, you need to reference which set is the ‘bigger’ set of that subset. So from that, anywhere which has i index defined, you can use id or is and it will work correctly.

But looking to your contraint, I am missing a relation between i, id and is either on the sums, or in the domain of the contraint. You can also run the contraint only to (i, r) and use the subsets in sums.

If this was not helpfull, and can you clarify a little bit more what is the problem you are facing?

Thank you it helped me a lot! I’ve been able to define it correctly!

### Reply

Didn't find what you were looking for? Try searching on our documentation pages: