Index out of bounds

33 views
Skip to first unread message

Ezequiel Puerta

unread,
Jun 9, 2020, 11:00:57 AM6/9/20
to gama-p...@googlegroups.com
Hi again! I get this error during an experiment with the "Make species schedule their agents in parallel" option set in True.

Two different agents are trying to insert the current_date in the same list, and I guess one of the agents was using a wrong reference about the end of the list, and that's why the error is raised. If I deactivate the agent scheduling option, the error doesnt appear.

Note that I do not insert the date directly, but first save it in a temporary variable to filter out some very sporadic cases in which the current_date is nil.

Any ideas? Is there a possibility to allow parallel scheduling of agents for most of your reflexes but synchronous for some others? or to manage some kind of semaphore or mutex?

Thanks a lot
Captura de pantalla de 2020-06-09 11-45-52.png

Benoit Gaudou

unread,
Jun 13, 2020, 1:02:30 AM6/13/20
to gama-p...@googlegroups.com
Hi,

First there is no semaphore or mutex in GAMA... I am not sure they will be added one day...

For your question about havin some part of the behavior in parallel and some other one not, you could imagine:
- use the parallel facet for a species, so that all its reflexes will be executed in parallel. 
For what you do not want them to be executed in parallel, you can implement them as actions and define a new agents executing this action for all the agents (not in parallel).
- another option could be to implement every part of the behavior of agents as actions. And create an agent that will execute these actions (using ask species parallel: true/false, true/false depending on the action... ) such as : 


model NewModel


global {

init {

create titi number: 100;

create scheduler;

}

}


species scheduler {

reflex toto {

ask titi {

do w;

}

write "----------------------";

ask titi parallel: true {

do z;

}

}

}


species titi schedules: [] { 

action w {

write self;

}

action z {

write self;

}

}


experiment expe type: gui {


}


Cheers

Benoit


--
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 on the web visit https://groups.google.com/d/msgid/gama-platform/CA%2BWSTAbeN62MsBY8sdoRRHBcXEbz2Aemm1A_Qm%3D%3DMjnbRc1Qgw%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages