Collections
In DEPS, a collection is a list of Elements.
Define a Collection
List <ModelOfCollectionName>() of <ModelSignature> End
Instanciate a Collection
<CollectionInstanceName> : <ModelOfCollectionName>() = [<listofElemenents>] ;
Operators and properties on Collections
Sum(<aCollectionOfElements>, <anAttributeName>)
Prod(<aCollectionOfElements>, <anAttributeName>)
Max (<aCollectionOfElements>, <anAttributeName>)
Min (<aCollectionOfElements>, <anAttributeName>)
AllDifferent(<aCollectionOfElements>, <anAttributeName>)
AllEqual(<aCollectionOfElements>, <anAttributeName>)
Example
Model Task ()
Constants
Variables
icpu : CpuIndex ;
Elements
Properties
End
List Tasks() Of Task End (* A model of collection of Tasks *)
Problem Allocation
Constants
Variables
Elements
TheTasks : Tasks() Of Task = [Task(),Task(),Task()] ;
Properties
AllDifferent(TheTasks, icpu);
End
Problem Allocation
Constants
Variables
Elements
T1 : Task();
T2 : Task();
T3: Task();
TheTasks : Tasks() Of Task = [T1,T2,T3] ;
Properties
AllDifferent(TheTasks, icpu);
End