MASON-INTEREST-L Archives

August 2013

MASON-INTEREST-L@LISTSERV.GMU.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Sean Luke <[log in to unmask]>
Reply To:
MASON Multiagent Simulation Toolkit <[log in to unmask]>
Date:
Wed, 14 Aug 2013 22:24:05 -0400
Content-Type:
text/plain
Parts/Attachments:
text/plain (10 lines)
On Aug 14, 2013, at 7:55 PM, Aуdar Aliev wrote:

> The problem is that I need to remove an agent from the schedule (I presume that after removing it from the schedule garbage collector will get to it) when his internal condition becomes true. For example, when agent stepped more than 50 times. How do I do that?

When you schedule an agent repeating, the scheduleRepeating() method returns a Stoppable object.  Store that Stoppable somewhere (perhaps in the agent itself), and call it when the condition has become true.  The agent will then not be rescheduled any more.  You don't need to implement the Stoppable interface.

You can also do this if you have scheduled an agent once but may wish to prevent his upcoming step() from ever occurring: this is done by using TentativeStep (see the manual). 

Sean

ATOM RSS1 RSS2