Content-Type: |
multipart/alternative; boundary=001a11c3847839c30604da0682f1 |
Sender: |
|
Subject: |
|
From: |
|
Date: |
Wed, 10 Apr 2013 15:16:36 -0400 |
In-Reply-To: |
|
MIME-Version: |
1.0 |
Reply-To: |
|
Parts/Attachments: |
|
|
Try adding a finish() method that clears out everything at the end of a run.
On Wed, Apr 10, 2013 at 3:02 PM, Luís de Sousa <[log in to unmask]>wrote:
> Mark and Sean, thanks for the replies.
>
> This solves things at run time, but agents left over from previous runs
> are still portrayed in subsequent runs (in the little example I sent you
> can try hitting the stop button before it gets to setp 20 and then
> restart).
>
> I imagine the updateSpatialIndex() method or something else that
> permanently destroys the Stoppable objects must be invoked when the run
> ends. I tried to do it in the GUIState class but without success. There
> doesn't seem to exist any way in the Scheduler class to set something to
> run at simulation end either. How else can I do it?
>
> Thank you,
>
> Luís
>
>
>
>
> On 9 April 2013 04:19, Sean Luke <[log in to unmask]> wrote:
>
>> On Apr 8, 2013, at 10:05 PM, Mark Coletti wrote:
>>
>> > In other words, I think I resolved your problem by adding the following
>> to your Sim.start():
>> >
>> > schedule.scheduleRepeating(new Steppable()
>> > {
>> > public void step(SimState state)
>> > {
>> > trailSpace.updateSpatialIndex();
>> > }
>> >
>> > });
>>
>> Quick suggested improvement:
>>
>>
>> > schedule.scheduleRepeating(new Steppable()
>> > {
>> > public void step(SimState state)
>> > {
>> > trailSpace.updateSpatialIndex();
>> > }
>> >
>> > }, -1, 1);
>>
>> This will cause updateSpatialIndex() to happen before anything else each
>> timestep.
>>
>> Sean
>>
>
>
--
[log in to unmask]
|
|
|