Hi Ernest, all,
On Tue, 27 Feb 2001 [EMAIL PROTECTED] wrote:
> ...
>
> This does, though, have some problems. readObject/writeObject must
> discard everything not serializable which includes, unfortunately,
> readers and writers; so this clone would discard all I/O routers. It
> would also lose all registered event handlers, and it would make
> duplicates of any definstanced beans. In a situation like Willie's
> where the Rete object is likely connected rather densely to a GUI
> interface, this could make a big mess.
Actually I don't have any event handlers listening to my Rete
instance. My Java program is driving Jess in a synchronous fashion,
calling Rete.executeCommand(). (User requests a hint from the tutor,
tutor runs Jess student model til Jess finds a hint, tutor delivers hint
to user.) Therefore losing event handlers is, for me at least, a
nonissue. Regarding I/O routers, I haven't looked into this at all, but
I'm guessing that this refers to the I/O streams. Here I'm just using the
defaults, which are easily reconstructed upon deserialization.
> That's the problem with implementing a generic method like clone() for
> a very complex object like Rete: subtleties in the definition can't
> be satisfactorily resoved for everyone at once. In this case there's
> no good middle ground, really, so I'd prefer to simply let people use
> ad-hoc solutions like the one presented here.
It seems to me that the problems described above are problems
concerning serialization, not cloning. Perhaps analogous problems attend
cloning--e.g., can't clone the event listeners or I/O routers--but I
imagine that for 80% of cases, cloning the data itself is just fine. If
foo wants to create a clone of Rete instance bar, then foo can grab the
event listeners and I/O routers from bar and set them on the clone, no?
I am not sure whether the above considerations bear at all upon
the technical issues related to cloning. But if user interest is the
issue, then I want to register mine! ;-) Others building intelligent
tutoring systems would probably benefit as well, since they need to be
able to revert the engine state after finding a hint.
Willie
> Future restructuring (Rete has already been radically restructured in
> the latest release, and there may be more to come) might improve
> matters somewhat.
>
>
>
> I think Matt Bishop wrote:
> [Charset iso-8859-1 unsupported, filtering to ASCII...]
> > One way you could clone is to serialize the Rete object to an in-memory
> > array, then deserialize from that array as needed. It would be as fast as a
> > deep clone, maybe faster.
> >
> > The trick is determining how big of an array you'd need, but that can be
> > determined by serializing to a file and counting the bytes. Add a few K
> > just for safety's sake.
> >
> > The relevant classes are java.io.ByteArrayInputStream and
> > java.io.ByteArrayOutputStream.
> >
> >
> > -Matt Bishop
> >
> >
> > -----Original Message-----
> > From: Willie Wheeler
> > To: [EMAIL PROTECTED]
> > Sent: 02/27/2001 2:02 PM
> > Subject: JESS: Question about cloning Rete
> >
> > Hi Ernest, or anyone who knows the answer, :-)
> >
> > Earlier this month (2/8/01) a user asked how to clone a Rete
> > instance, and the answer was to bsave and bload. While this works for
> > my
> > application, it is a little slow. Ernest said that there is no
> > Rete.clone() and that he has no plans to support it. I am curious as to
> > the reason--is it that performance would be no better than bload/bsave,
> > is
> > it that there is insufficient user interest, etc.?
> > Maybe there is a better way to do what I'm trying to do.
> > Basically I need to perform revert() operations on the Rete instance
> > from
> > time to time. To accomplish this I have been cloning the Rete instance
> > before performing operations that end in a revert.
> >
> > Thanks,
> > Willie
> >
> >
> >
>
> ---------------------------------------------------------
> Ernest Friedman-Hill
> Distributed Systems Research Phone: (925) 294-2154
> Sandia National Labs FAX: (925) 294-2234
> Org. 8920, MS 9012 [EMAIL PROTECTED]
> PO Box 969 http://herzberg.ca.sandia.gov
> Livermore, CA 94550
>
> ---------------------------------------------------------------------
> To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
> in the BODY of a message to [EMAIL PROTECTED], NOT to the
> list (use your own address!) List problems? Notify [EMAIL PROTECTED]
> ---------------------------------------------------------------------
>
>
---------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the
list (use your own address!) List problems? Notify [EMAIL PROTECTED]
---------------------------------------------------------------------