How to create Set of Sets and a Set of Constraints in AIMMS

849 views
Skip to first unread message

fy1905

unread,
Jul 28, 2010, 8:37:07 AM7/28/10
to AIMMS - The Modeling System
I am new in Modelling with AIMMS and have trouble with following MIP-
problem:

I have a root-set of "Locations" indexed with 'i' for example
{Loc1,...,Loc10} and Subsets {A1..A6}.
Each Subset consists of one or more Locations. For example A1:
{Loc1,Loc7} A2:{Loc2,Loc8,Loc10} A3:{Loc3} etc.
Each Subset has its own index (A1:aa A2:ab A3:ac etc.)

Furthermore i have a set of vehicles indexed with 'k' and a binary
variable LocVeh(i,k) denoting if Location i is served by Vehicle k.

Now I have to guarantee that exact one Location of every Subset is
being served by vehicle k, i.e. concerning subset A1, Loc1 xor Loc7
has to be served.

So i have constructed a Constraint for each Subset.

Concerning A1:
index domain: {empty}
definition: sum[(aa,k),LocVeh(aa,k)]=1

The Model works, but in reality my MIP-Problem is much bigger.
I have constructed six Sets and six Constraints for this "little"
problem.

Is there any way to model this MIP with less effort?
Is it possible to construct a Set of Sets like
RootSet{A1{Loc1,Loc7},A2{Loc2,Loc8,Loc10},...,An{Locy,...,Locz} ?

André Gâmbaro

unread,
Jul 28, 2010, 12:33:30 PM7/28/10
to ai...@googlegroups.com
Hi ,
Yes, its possible to create a set of sets, so it will be easier to
model your problem.
Use a set like Numbers = {1,2,3,4,5,6} with index n_ for example. And
then create the (indexed) set Subs(n_)
name: LocationsSubsets
index domain: n_
Subset of: Locations
You can not define an index here, but its easy to deal with this
"little problem" latter;
To define it you will need to set data manually or through a binary
parameter indexed in n_ (Numbers) and i (Locations):
PLocationsInSubsets(n_,i) := data{ (1,Loc1):1, (1,Loc7):1,
(2,Loc2):1, (2,Loc8):1, (2,Loc10):1, ... } (may read it from
database...)
For each number n_ you set the locations.
So the indexed set LocationsSubset may be now defined by something
like this: { i in locations | PLocationsInSubsets(n_,i) }

Since we have no index inside the LocationSubset, we need to define
i_aux as an secondary or auxiliary index in your original set
Locations, so we can work with both indexes i and i_aux.

Now the constraint. As you wanted this should be indexed in n_ as follows:
name: ContraintServeAtLeastOneLocation
index domain: n_
definition: sum[ (i_aux, k) | i_aux in LocationsSubset(n_) ,
LocVeh(i_aux,k) ] = 1


obs: you can even use that parameter instead:
sum[ (i_aux, k) | PLocationsInSubsets(n_,i_aux) , LocVeh(i_aux,k) ] = 1

This construction is very usefull.
Hope it helps,

André Gâmbaro


2010/7/28 fy1905 <fatih...@googlemail.com>:

> --
> You received this message because you are subscribed to the Google Groups "AIMMS - The Modeling System" group.
> To post to this group, send email to ai...@googlegroups.com.
> To unsubscribe from this group, send email to aimms+un...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/aimms?hl=en.
>
>

Reply all
Reply to author
Forward
0 new messages