We don't have a lot of experience using Jess with enums, so it's
possible that something odd is happening that hasn't been reported
yet. If you could assemble the smallest possible self-contained
example of the problem and send it to me personally, I'd be much
obliged.
I think Scott Moss wrote:
[Charset iso-8859-1 unsupported, filtering to ASCII...]
> Has anybody tried using enums as shadow facts? I've been getting some
> apparently bizarre results. Forgive me for showing actual code, but I
> don't understand the problem well enough to produce a simple example.
>
> Producers have activities that produce waste of various kinds. There is
> an enum WastePackagingMaterials defined as follows:
>
> public enum WastePackagingMaterial {
> paper_board(.49, 5), glass(.24, 7), steel(.05, 3), aluminium(.01,
> 9), plastic(.09, 10), wood(.12, 6);
> ...
>
>
> Each activity of each producer produces one unit of one of these types
> of waste.
>
> A rule has the following RHS
>
> (assert
> (packaging-waste-produced
> (wpm ?wpm)
> (quantity ?level)
> (activity ?activity)
> (timestep ?t)
> (clauseOwner ?producer)
> (tickStamp ?t)))
>
> A second rule fires once for each producer and has the following RHS
>
> (bind ?wpm-list (create$ (call WastePackagingMaterial values)))
> (foreach ?wpm ?wpm-list
> (printout t (?wpm toString) crlf)
> (bind ?quantity (total-packaging-waste ?producer ?wpm))
> (assert
> (total-packaging-waste-produced
> (wpm ?wpm)
> (quantity ?quantity)
> (timestep ?t)
> (clauseOwner ?producer)
> (tickStamp ?t))
>
> where total-packaging-waste is a function that calls the following defquery:
>
> (defquery waste-packaging-material-query
> (declare (max-background-rules 100000)(variables ?producer ?wpm))
> (packaging-waste-produced
> (wpm ?wpm)
> (quantity ?quantity)
> (activity ?activity)
> (timestep ?)
> (clauseOwner ?producer)
> (tickStamp ?)))
>
> This defquery calls the relevant instantiations from the first rule
> except -- and this is what seems bizarre -- it gets the facts for the
> first constant of the enum for the first rule instantiation only but it
> gets all of the facts for all of the other constants (i.e., all but
> paper_board) for all of the producers.
>
> If there is some stupid bug in my code, then I shall be as grateful as I
> will be ashamed if someone could point it out to me. If it isn't my
> bug, then there is a problem with using enums in the current (b6)
> version of Jess7.
>
>
> --
> Professor Scott Moss
> Centre for Policy Modelling
> Manchester Metropolitan University
> Aytoun Building
> Manchester M1 3GH
> UNITED KINGDOM
>
> telephone: +44 (0)161 247 3886
> mobile: +44 (0)7740 942564
> fax: +44 (0)161 247 6802
>
> http://cfpm.org/~scott
>
> --------------------------------------------------------------------
> 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]
> --------------------------------------------------------------------
>
---------------------------------------------------------
Ernest Friedman-Hill
Advanced Software Research Phone: (925) 294-2154
Sandia National Labs FAX: (925) 294-2234
PO Box 969, MS 9012 [EMAIL PROTECTED]
Livermore, CA 94550 http://herzberg.ca.sandia.gov
--------------------------------------------------------------------
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]
--------------------------------------------------------------------