swarm-support
[Top][All Lists]
Advanced

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

Re: Swarm: removing actions from a schedule


From: Roger M. Burkhart
Subject: Re: Swarm: removing actions from a schedule
Date: Thu, 4 Jan 1996 18:26:45 -0600

> We now want to remove actions from the Schedule that are directed to such
> an agent.
> 
> Can you help us with this problem? We didn't find out how to remove an
> action from a schedule.

This is a slightly embarrassing question.  Not because there isn't a good
answer.  Every time you insert an action into a schedule, the createAction
message returns the id of the action object that was created.  This action
object contains information about its point in a schedule so that you
should be able to remove it using simply a "remove:" message on the
schedule.  Thus, if you created an action and saved its id, like this:

  moveAction = [aSchedule createActionTo: someAgent message: M(move)];

then later you should be able to remove it like this:

  [aSchedule remove: moveAction];

Unfortunately, on a Schedule this doesn't work just yet.  None of the
demo examples is currently removing actions, with the exception of the
mousetraps chain reaction simulation, but that demo uses a different
remove technique based on dropping actions automatically as they're
executed, not removing them explicitly one-by-one.  Removal does work
fine on ActionGroup plans, but they're not the same as schedules.  On
schedules, I tried it and found there's both a bug and some not fully
implemented capability.  This will be fixed in the next release we're
supposed to be getting out early next week; if you're in a big hurry I
might be able to get you something sooner or suggest other workarounds.
For example, if it's only a matter of one agent dying out of a whole
collection of similar agents, you could maintain the agent in the
collection, use a ForEach action to send the needed messages to all agents
of the collection, and just remove the agent from the collection when it
expires.  That's often an easier way of handling dynamic populations, so
long as the actions within them are uniform.

A bit of explanation on the relationship of collections and schedules.
Schedules and all other plans of actions on objects are implemented
directly on top of the underlying collection structures.  This is true to
such an extent, including specialized and advanced features of the
collection library design, that the needed work to finish up and document
the collection library has been deliberately held back until the activity
library has completed defining all its needs.  Even though the collection
library is intended for heavy use within user application models (indeed,
it may often supply the backbone of many model representations), the
emphasis up to now has been on building one advanced but internal form of
use of the library, namely an efficient interpreter of arbritrary time- or
order-based action structures.

In the pending release nearly all the activity features we intend for now
are present, so attention has been been switching back to long-delayed
completion of the collections library.  That's part of what will enable
the action removal from schedules you asked about.

An important thing to know for dynamic modification of schedules or other
action plans is that their underlying implementation is nothing but one of
the basic collections.  For a Schedule the underlying collection is a Map,
which keeps an ordered mapping of time values to actions, and for an
ActionGroup the underlying collection is a form of Set.  So you can traverse
the actions or remove or reshuffle them using all the basic messages of
these collection types.  That's very powerful, but not yet very helpful
when there isn't more information about how to use collections (and when
their current implementation is only an interim and incomplete one).


reply via email to

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