A "bid" deftemplate could be inherited.  Each "expert" could create a 
specialized bid to work on a problem that the expert is qualified to handle (at 
a higher salience).  Each expert could maintain a count of problems handled.  A 
rule could select (at a lower salience) the bid from the expert with the lowest 
count on unaddressed problems.

(defrule an-expert-bids-on-problem
    "An example expert bids on problem"
    (declare (salience +1))
    (problem (id ?problem-id) (addressed FALSE))
    ... ; determine if problem is applicable
    =>
    (assert (bid-child (problem ?problem-id) (expert "my-expert-id")
                 ... ; other relevant information
                 )))

(defrule an-expert-accepts-problem
    "The example expert starts addressing a problem"
    (declare (salience -1))
    ?bid <- (bid-child (problem ?problem-id) (expert "my-expert-id")
                       ... ; other relevant information
                       )
    ?problem <- (problem (id ?problem-id) (addressed FALSE))
    ?expert <- (expert (id "my-expert-id") (problem-count ?problem-count))
    (not (and (bid (problem ?problem-id)
                   (expert ?other-expert-id&~"my-expert-id"))
              (expert (id ?other-expert-id)
                      (problem-count ?other-count
                                     &:(< ?other-count ?problem-count)))))
    =>
    (modify ?expert (problem-count (+ ?problem-count 1)))
    (modify ?problem (addressed TRUE))
    ... ; Start addressing the problem
    (bind ?results (run-query* bid-query ?problem-id))
    (while (?results next)
        (retract (?results get bid)))
    (?results close))

Bob Kirby

At 05:31 AM 8/26/2007, Noël Huebers wrote:
>Dear Jessers,
>
>I am developing a kind of an expert system. If a user has a problem, a problem 
>fact is asserted. Now I'm looking at a rule to find an expert for my problem.
>In my implementation it is possible that several experts (facts) can match for 
>the asserted problem. 
>
>Right now, the user with the problem receives multiple expert proposal. But I 
>want the user to get only one by time. Therefore, the rule should only fire 
>once. I tried to modify the rule with 'exists'-test. Unfortunatly, I use some 
>slots of the expert fact ( e.g. name) on the RHS of the rule. Jess throws an 
>exception that the bound variable of the expert fact is unknown. I read 
>something according to this on the Jess book. Is there another way of 
>achieving this?
>
>Another solution would be to retract the problem fact after the rule found the 
>first expert. But later on, I want to implement a confirmation that the 
>contact was established. If the expert is not available the problem fact 
>should remain in the working memory. 
>
>Another question is, after this problem is solved: Is it possible to randomize 
>the matching expert fact? I don't want the first expert in the memory to get 
>all of the help calls.
>
>Thanks for your suggestions! 
>
>Best regards,
>
>Noel Huebers

--------------------------------------------------------------------
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]
--------------------------------------------------------------------

Reply via email to