Building subsets
Posted: Wed Dec 13, 2017 3:39 pm
Hello !
could anybody help me by modeling constraints Nr.4 on the screenshot in the Attachment. M is a subset of N and there are always 2^n subsets of a set N. As example if i have N with 3 Cities {1,2,3} than there are M = 2^3 = 8 different M: M1 = {1}, M2 = {2}, M3 = {3}, M4 = {1,2}, M5 = {1,3}, M6 ={2,3}, M7 = {1,2,3} and M8 = { "empty subset" }. What i need is a loop which build all this subsets M1......M, such that i could use it in the constraints Nr.4 (for all M with more than 1 member, that would be M4 to M7 in the example wit N = 3). I also attached a screenshot of the .gms script for the constraints Nr.1- Nr.3. x(i,j) is a binary variable and c(i,j) is the costs parameter. I'm really thankful for any help.
Best regards
Mahdi Alazzeh
could anybody help me by modeling constraints Nr.4 on the screenshot in the Attachment. M is a subset of N and there are always 2^n subsets of a set N. As example if i have N with 3 Cities {1,2,3} than there are M = 2^3 = 8 different M: M1 = {1}, M2 = {2}, M3 = {3}, M4 = {1,2}, M5 = {1,3}, M6 ={2,3}, M7 = {1,2,3} and M8 = { "empty subset" }. What i need is a loop which build all this subsets M1......M, such that i could use it in the constraints Nr.4 (for all M with more than 1 member, that would be M4 to M7 in the example wit N = 3). I also attached a screenshot of the .gms script for the constraints Nr.1- Nr.3. x(i,j) is a binary variable and c(i,j) is the costs parameter. I'm really thankful for any help.
Best regards
Mahdi Alazzeh