execution order

15 views
Skip to first unread message

amira khelifa

unread,
Jun 18, 2025, 7:41:58 PMJun 18
to GAMA
Hello everyone,

I'm a little confused. if you can please enlighten me.
When we have a species A and it has several reflexes to execute, for example,

species A{..
..

reflex b1 {..
..}

reflex b2 {...
...}
...
..

}

The order of execution is done by agent, so agent A1 executes reflex b1, then reflex b2, etc., until the end, then it's agent A2's turn, which will perform reflex b1, then reflex b2, and so on.

Is there a way (that doesn't require a lot of calculations because the number of agents is very large) for all the agents of species A to first perform reflex b1, then all the agents perform reflex b2, and so on? 
Or is it a kind of manipulation like species A control: rules with priorities, but instead of priorities being set for actions, priorities are made on agents?
Thanks

Kevin Chapuis

unread,
Jun 19, 2025, 3:36:20 AMJun 19
to gama-p...@googlegroups.com
Dear Amira,

Default scheduling with reflexes does not (easily) allow you to go through the list of agents several times, first for reflex b1, a second time for b2, etc. 
However, there is a very simple way to do that, as it must be done in Netlogo for instance : 

1 - turn your reflexes into actions
2 - have a reflex in the global, let's call it "main" (we don't care about the name)
3 - within the reflex, build as many ask agent loop as reflexes you want to execute for all agent one after another

Something like this:

global {
reflex main {
ask A {do b1;}
ask A {do b2;}
}
}

For a clearer model scheduling I suggest you to unschedule your agent, like this:
species A schedules:[] {...}
This way, your agent scheduling is solely defined within the "main" reflex in global.

Best,
Kevin

--
You received this message because you are subscribed to the Google Groups "GAMA" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gama-platfor...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/gama-platform/403c95a5-e191-4761-a774-2f51135bc193n%40googlegroups.com.


--
Chapuis Kevin
Fellow researcher at IRD
Computer modeling & simulation
--
Alt-Mail: kevin.chapuis@ird.fr
Reply all
Reply to author
Forward
0 new messages