Is there any way to instantiate multiple agents using same source file in Jason?

135 views Asked by At

I have 3 agents (p1, p2 and p3) that are sharing the same code (participant.asl). I'd like to know if it is possible to use some command to instantiate like 50 of this agents, like an array, something like "p[1..50] participant"?

MAS testMAS {

    infrastructure: Centralised

    agents:
        p1 participant;
        p2 participant; 
        p3 participant;

    aslSourcePath:
        "src/asl";
}
1

There are 1 answers

0
Cleber Jorge Amaral On

Yes, you can use "#" directive to instantiate multiple agents of same type. In your code the exact correspondence is:

MAS testMAS {

    infrastructure: Centralised

    agents:
        p participant #3;

    aslSourcePath:
        "src/asl";
}

By this way the agents p1, p2 and p3 will be created using participant.asl code.