Re: JESS: Finding fact the max/min slot value

2006-02-01 Thread erich.oliphant
Glad I asked, I was well on my way to create something needlessly complex.

Thanks Guys.

On Wed, 1 Feb 2006 14:00:55 -0800 (PST), ejfried wrote
> I think erich.oliphant wrote:
> [Charset iso-8859-1 unsupported, filtering to ASCII...]
> > Hi,
> > I am trying to figure out the best way to have a rule fire only for a fact
> > whose slot value is the min or max of a group of facts.
> 
> Match a negated pattern to the (nonexistent) fact in which some
> number is greater than the greatest value.
> 
>  (defrule biggest-number
>  (number (value ?val))
>  (not (number (value ?val2&:(> ?val2 ?val
>  =>
>  )
> 
> -
> Ernest Friedman-Hill  
> Advanced Software Research  Phone: (925) 294-2154
> Sandia National LabsFAX:   (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]
> 


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]




Re: JESS: Finding fact the max/min slot value

2006-02-01 Thread Roger Studner
(defrule biggest-number

(number ?number)
(not (number ?num2 > ?num))

=>

(printout t "biggest number: ")
(printout t ?number crlf)

)

I think?


On 2/1/06, erich.oliphant <[EMAIL PROTECTED]> wrote:
>
> Hi,
> I am trying to figure out the best way to have a rule fire only for a fact
> whose slot value is the min or max of a group of facts.
>
> For example:
> (deftemplate number
> (slot value))
>
> (assert number (value 1))
> (assert number (value 2))
> (assert number (value 3))
> (assert number (value 4))
>
>
> (defrule biggest-number
> (number (value ?val))
>  
> =>
> )
>
> I only want biggest-number to fire for (number (value 4)).  Is a defquery
> better here?
>
> 
> 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]

Re: JESS: Finding fact the max/min slot value

2006-02-01 Thread ejfried
I think erich.oliphant wrote:
[Charset iso-8859-1 unsupported, filtering to ASCII...]
> Hi,
> I am trying to figure out the best way to have a rule fire only for a fact
> whose slot value is the min or max of a group of facts.

Match a negated pattern to the (nonexistent) fact in which some
number is greater than the greatest value.

 (defrule biggest-number
 (number (value ?val))
 (not (number (value ?val2&:(> ?val2 ?val
 =>
 )


-
Ernest Friedman-Hill  
Advanced Software Research  Phone: (925) 294-2154
Sandia National LabsFAX:   (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]




JESS: Finding fact the max/min slot value

2006-02-01 Thread erich.oliphant
Hi,
I am trying to figure out the best way to have a rule fire only for a fact
whose slot value is the min or max of a group of facts.

For example:
(deftemplate number
(slot value))

(assert number (value 1))
(assert number (value 2))
(assert number (value 3))
(assert number (value 4))


(defrule biggest-number
(number (value ?val))
 
=>
)

I only want biggest-number to fire for (number (value 4)).  Is a defquery
better here?


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]