2017-09-04 4 views
2

J'ai 3 agents (p1, p2 et p3) qui partagent le même code (participant.asl). Je voudrais savoir s'il est possible d'utiliser une commande pour instancier comme 50 de ces agents, comme un tableau, quelque chose comme "p [1..50] participant"?Est-il possible d'instancier un "tableau" d'agents dans Jason?

MAS testMAS { 

    infrastructure: Centralised 

    agents: 
     p1 participant; 
     p2 participant; 
     p3 participant; 

    aslSourcePath: 
     "src/asl"; 
} 

Répondre

2

Oui, vous pouvez utiliser la directive "#" pour instancier plusieurs agents de même type. Dans votre code la correspondance exacte est:

MAS testMAS { 

    infrastructure: Centralised 

    agents: 
     p participant #3; 

    aslSourcePath: 
     "src/asl"; 
} 

De cette manière les agents p1, et p2 p3 seront créés en utilisant le code participant.asl.