Print

Print


Dear Sean,

thanks for the help!

So in short you have two kinds agents which must each call a certain procedure, and this must all be done within a certain timestep, and the A agents must all be before the B agents for each procedure.  This would be done using (1) anonyomous steppables [or if you must, sim.engine.MethodStep] and (2) the "ordering" facility in the schedule.  You'd do this in your start() method:

ok, thanks for the snippets... My start() now is:

@Override
    public void start() {
        super.start(); //use the previously defined code, then we add our own.
        marketSpace = new SparseGrid2D(gridWidth, gridHeight);
        for (int i = 0; i < N1; i++) {
            int x = random.nextInt(gridWidth);
            int y = random.nextInt(gridHeight);
            CapitalGoodFirm p = new CapitalGoodFirm();
            schedule.scheduleRepeating(p); 
            marketSpace.setObjectLocation(p, x, y);
        }
        for (int i = 0; i < N2; i++) {
            int x = random.nextInt(gridWidth);
            int y = random.nextInt(gridHeight);
            ConsumptionGoodFirm p = new ConsumptionGoodFirm();
            schedule.scheduleRepeating(p);
            marketSpace.setObjectLocation(p, x, y);
        }
        for (int i = 0; i < bankSize; i++) {
            int x = random.nextInt(gridWidth);
            int y = random.nextInt(gridHeight);
            Bank p = new Bank();
            schedule.scheduleRepeating(p);
            marketSpace.setObjectLocation(p, x, y);
        }
    }

so I think I have to add your code after creating the agents... but at this point should I keep the schedule.scheduleRepeating(p) line?

Why are you doing a main?  Why not just use doLoop?

good point, I don't know how to pass doLoop the MC and T values

> BTW: my agents are on a SparseGrid2D, when I retrieve them should I randomize their order or is it done automagically somewhere?

SparseGrid2D is a representation of space.  It has nothing to do with the schedule, which is a representation of time.  So it won't make any difference.

Yes of course, my bad... what I mean is: before asking each agent in the SparseGrid2D to do something, should I randomize their order? 

thanks for your help,
Simone
 

Sean



--
-----------------------------------------------------------------

Simone Gabbriellini, PhD

Post-doctoral Researcher
ANR founded research project "DIFFCERAM"
GEMASS, CNRS & Paris-Sorbonne.

mobile: +39 340 39 75 626
email: [log in to unmask]