gama-platform / gama

Main repository for developing the 2024+ versions of GAMA
https://gama-platform.org
GNU General Public License v3.0
31 stars 6 forks source link

Problem with stopping criterion in batch experiment #358

Open ptaillandier opened 1 month ago

ptaillandier commented 1 month ago

Describe the bug In batch mode, the model continues to run when it should stop when the stop condition is met.

To Reproduce Steps to reproduce the behavior:

  1. Create a new model with this code:
model testsample

global {
    int nb_agents <- 100;
    float distance <- 5.0;
    list<simple_agent> neighbors;

    init {
        create simple_agent number: nb_agents;
    }

    reflex after_end when: cycle > 10 {
        write ""+ int(self) +" should have stop : " + sample(cycle);
    }
}

grid cell width: 100 height: 100;

species simple_agent {
    reflex spatial_computation {
        using topology(cell) {
            neighbors <- neighbors + simple_agent at_distance distance;
        }
    }
}

experiment testBatchSimple type: batch until: cycle > 10 repeat: 5{
    parameter nb_agents var: nb_agents min: 100 max: 300 step: 100;
    parameter distance var: distance min: 3.0 max: 5.0 step: 1.0;

    reflex end_sim {
        ask simulations {
            write "End of :" + int(self) + " " +sample(self.nb_agents) + " " + sample(self.distance) + " " + sample(self.cycle);
        }
    }
}
  1. launch the testBatchSimple experiment
  2. Click on play
  3. check the console

Expected behavior The simulation should stop at cycle 10, whereas it continues to run for more cycles and stops between cycle 11 and 25.

Desktop (please complete the following information):

lesquoyb commented 1 month ago

I think this one is the same as #198, especially what is mentioned in this comment