stop a moving agent

24 views
Skip to first unread message

Arend Ligtenberg

unread,
Apr 15, 2025, 7:41:41 AMApr 15
to GAMA
Dear all,

I would like to halt an individual moving agent heading on a network to its destination for a while, triggered by a random event.  I implemented  the moving skill  along with the standard 'goto' action which works fine. Setting the speed to 0.0 in a reflex doesn't work. 

So, is there a way to stop a moving agent for x amount of steps/tics via a reflex or other workaround? 

Any ideas are highly appreciated.

Thanks a lot!

Cheers 

Arend



Kevin Chapuis

unread,
Apr 15, 2025, 8:35:33 AMApr 15
to gama-p...@googlegroups.com
Dear Arend,

I think that there is a misunderstanding about the functioning of the goto action. Basically, this action has to be triggered each step (using a reflex for instance) so the agent "move" toward its destination considering how long a step represent (1s is default) and how fast it goes (speed which is 1m/s default). In fact, the location of the agent is simply changed to reflect this movement. Hence, you cannot stop an agent within a step. Whereas you are free to decide whether or not the goto action is triggered within your reflex. Meaning that you'll have to implement an if statement to prevent the goto action to be triggered for a given number of steps. In the following exemple, agent won't move for 3 step:

int stopmove <- 3;

reflex movement {

if (stopmove = 0) { do goto on:the_graph target:target speed:1.0; }

stopmove <- max(0, stopmove-1);

}
After that you'll have to implement a way to manage your stopmove condition elsewhere.
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/d5b64f88-8a6a-4cdb-86ad-71a5a6c2ca4en%40googlegroups.com.


--
Chapuis Kevin
Fellow researcher at IRD
Computer modeling & simulation
--
Alt-Mail: kevin.chapuis@ird.fr

Arend Ligtenberg

unread,
Apr 28, 2025, 8:59:02 AMApr 28
to GAMA
Hi Kevin,

Thanks a lot for the suggestion. It works!

Best

Arend

Op dinsdag 15 april 2025 om 14:35:33 UTC+2 schreef kevinc...@gmail.com:
Reply all
Reply to author
Forward
0 new messages