Hi,

I think it would be helpful to provide a little bit of background regarding my problem first. I’m currently working on a project where a given set of volunteers should be assigned to a given set of people in need. So basically a simple transport problem, where the demand of all people in need is 1 and the supply of all volunteers is 1. The model in AIMMS always expects a balanced problem. So in case of a surplus on either side, dummy persons will balance the problem.

The data for a set containing all persons gets read from a file like this. The first half are the people in need and the second half are volunteers. The last X amount of people in need would be dummies in case of a surplus on the volunteer side. The last X amount of volunteers would be dummies in case of a surplus on the other side. The example below shows a data set that was already balanced, so without any dummies.

Based on the parameters NumberInNeed and NumberVolunteers the AllNodes Set containing all persons is defined like this:

The reason why I would even want all persons together in one set instead of two seperate ones is because this made visualization in a network object easier for me. From here I create two subsets. The first subset *InNeed *contains all people in need and the second subset *Volunteers *contains all vonlunteers (both including potential dummies).

**My problem is:**

Now I would like to have two more subsets, one that only contains “Dummies in need” and one that only contains “Volunteer dummies”. Both of these could be empty if the data set was balanced in the first place or one of them would be empty in case of an unbalanced problem that was balanced by introducing dummies on one of the two sides.

I tried to create the first one like this:

This works fine if there are dummies. Let’s say the the data set from the file above contained 2 InNeed dummies (so that would be the last two persons in need with the indices 11 and 12). That would make {12-2+1 .. 12} so the subset would include person 11 and 12, which would be correct. In case of no dummies this does not work though since the resulting defintion would be {12-0+1..12} = {13..12}.

Is there any way I can define this set as empty in case of the parameter NumberInNeedDummies = 0 and define it in the way I did above in case NumberInNeedDummies > 0?

I appreciate any help you can provide.

Best regards,

Nick

**Best answer by mateusarakawa**