swarm-modeling
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Scheduling Question (off-by-one error)


From: Christopher J. Mackie
Subject: Scheduling Question (off-by-one error)
Date: Sat, 13 Apr 2002 22:48:23 -0400

My (Java) EZGraphs are displaying off-by-one (time 0 in the model doesn't
appear at all on the graphs, time 1 shows up as time 0 on the EZGraph,
etc.).  Everything else seems to be working fine.  I've tried changing the
order of various selectors in the schedules, but so far no luck.  Can anyone
tell me why this might be happening, or what else to check for?

I'm using Swarm-2.2-pretest-6 under Windows.  The framework code is borrowed
almost directly from the Java "SimpleObserverBug3" tutorial app--here are
some of the key content pieces:

Three EZGraphs:  satisfactionGraph, enrollGraph, and qualityGraph, all built
in modelSwarm.buildObjects(), with the following sequence-selectors (only
one shown here):

for (int schnum = 0; schnum < schoolList.getCount(); schnum++)
{
        School sch = (School)schoolList.atOffset(schnum);
        String label = "School " + sch.getID();
        sel = SwarmUtils.getSelector(sch, "reportEnrollmentTotal");
        enrollGraph.createSequence$withFeedFrom$andSelector(label, sch, sel);
}

modelSwarm.buildActions()
{
        modelActions = new ActionGroupImpl(getZone());

        sel = SwarmUtils.getSelector("SchoolDistrict", "update");
        modelActions.createActionForEach$message(districtList, sel);
        sel = SwarmUtils.getSelector("School", "update");
        modelActions.createActionForEach$message(schoolList, sel);
        sel = SwarmUtils.getSelector("Household", "update");
        modelActions.createActionForEach$message(householdList, sel);
        modelSchedule = new ScheduleImpl(getZone(), 1);
        modelSchedule.at$createAction(0, modelActions);
        return this;
}

observerSwarm.buildActions()
{
        super.buildActions();
        modelSwarm.buildActions();

        displayActions = new ActionGroupImpl(getZone());
        sel = SwarmUtils.getSelector(this, "updateSimulatedTime");
        displayActions.createActionTo$message(this, sel);
        sel = SwarmUtils.getSelector(householdDisplay, "display");
        displayActions.createActionTo$message(householdDisplay, sel);
        sel = SwarmUtils.getSelector(worldRaster, "drawSelf");
        displayActions.createActionTo$message(worldRaster, sel);
        sel = SwarmUtils.getSelector(Globals.env.probeDisplayManager, "update");
        displayActions.createActionTo$message(Globals.env.probeDisplayManager,
sel);
        sel = SwarmUtils.getSelector(this, "showStep");
        displayActions.createActionTo$message(this, sel);
        sel = SwarmUtils.getSelector(getActionCache(), "doTkEvents");
        displayActions.createActionTo$message(getActionCache(), sel);
        sel = SwarmUtils.getSelector(this, "checkForDone");
        displayActions.createActionTo$message(this, sel);

        displaySchedule = new ScheduleImpl(getZone(), displayFrequency);
        displaySchedule.at$createAction(0, displayActions);
        return this;
}
observerSwarm.showStep()
{
        modelSwarm.satisfactionGraph.step();
        modelSwarm.enrollGraph.step();
        modelSwarm.qualityGraph.step();
}



                  ==================================
   Swarm-Modelling is for discussion of Simulation and Modelling techniques
   esp. using Swarm.  For list administration needs (esp. [un]subscribing),
   please send a message to <address@hidden> with "help" in the
   body of the message.
                  ==================================


reply via email to

[Prev in Thread] Current Thread [Next in Thread]