Moving agents between simulations #67
Replies: 0 comments 5 replies
-
Hi,
A simple solution is to create the same agent in the new simulation. Here
is an example.
```
model movebetweensimulation
global {
int grid_size <- 10;
init {
if int(self) = 0 {
create inhabitant with: (location:location);
}
}
}
species inhabitant skills: [moving]{
rgb color <- rnd_color(255);
int simulation_id <- 0;
reflex move {
do move heading: 0.0;
if (location.x = world.shape.width) {
simulation_id <- (simulation_id +1) mod length(experiment.simulations);
ask experiment.simulations[simulation_id]{
create inhabitant with:(location:{0.0, location.y}, color:color, simulation_id:myself.simulation_id);
}
do die;
}
}
aspect default {
draw circle(2) color: #red;
}
}
grid cell width: grid_size height: grid_size;
experiment movebetweensimulation type: gui autorun: true {
float minimum_cycle_duration <- 0.02;
action _init_ {
create simulation with: (grid_size: 10);
create simulation with: (grid_size: 5);
}
output {
display map {
grid cell border: #black;
species inhabitant;
}
}
}
```
Cheers,
Patrick
|
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
leenr01
-
Hi
There is also a model in the model library related to network (MQTT), in
which an agent is sent from one simulation to another simulation
Cheers
Benoit
Le lun. 13 mars 2023 à 02:12, ptaillandier ***@***.***> a
écrit :
… Hi,
A simple solution is to create the same agent in the new simulation. Here
is an example.
Cheers,
Patrick
Le sam. 11 mars 2023 à 21:49, leenr01 ***@***.***> a écrit :
> I want to simulate multiple cities each being one separate simulation. I
> created the simulations using a GUI experiment.
> Is there a way I can move agents between these simulations while
> preserving the agent properties?
> I believe this -if possible- should be done in the experiment part and
not
> the species part of the code.
>
> —
> Reply to this email directly, view it on GitHub
> <https://github.com/gama-platform/gama/discussions/3662>, or unsubscribe
> <
https://github.com/notifications/unsubscribe-auth/AALPWHPT6LML7ZJ4KLXYYZDW3SGGVANCNFSM6AAAAAAVXQZETQ
>
> .
> You are receiving this because you are subscribed to this thread.Message
> ID: ***@***.***>
>
—
Reply to this email directly, view it on GitHub
<https://github.com/gama-platform/gama/discussions/3662#discussioncomment-5286002>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAL3WSUSHNP6WNYDMKMS44DW3ZX75ANCNFSM6AAAAAAVXQZETQ>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I want to simulate multiple cities each being one separate simulation. I created the simulations using a GUI experiment.
Is there a way I can move agents between these simulations while preserving the agent properties?
I believe this -if possible- should be done in the experiment part and not the species part of the code.
Beta Was this translation helpful? Give feedback.
All reactions