
www.Usenet.com
Group Index
Comp Thread Archive from Usenet.com
CLIPS Question.
- __From__: StupendousMan
- __Subject__: CLIPS Question.
- __Date__: Sun, 14 Sep 2003 18:39:29 -0500
I think shells is the right group for this question.
I am creating my first clips program and I have had a good read through
the Giarratano and Riley book but I think this is more of a taste/style
issue.
I basically have two pools of objects that I need to match up based on
how well suited they are to each other. There are numerous ways that
objects can match with each other, but in the end I need to end up with
one on one pairings of objects. (no this isn't a dating service :-) )
I have several dozen parameters that the objects could have in common,
which can be broken into two groups: mandatory and desirable. Of course
the mandatory parameters must be met, which is easily done in CLIPS, but
its the desirable parameters that have me confused.
Naturally, I want the object with the most matches in the desirable
group. I'm really not sure how to accomplish this.
If the desirable traits had some sort of weighting, I could create a
rule with every trait, give it the higest salience, then make another
rule with slightly lower salience that has one less trait in the LHS.
The only solution I have come up with seems to be very inefficient, and
somewhat contrary to the principles of the language, but here goes (in
pseudo code)
Add two new slots to the object, matches_mandatory and count_desirables
IF object matches all mandatory constraints
THEN set matches_mandatory to true.
IF object matches_mandatory AND matches desirable_quality_1
THEN set count_desirables = count_desirables + 1
IF object matches_mandatory AND matches desirable_quality_2
THEN set count_desirables = count_desirables + 1
blah ... blah ... blah...
Finally, the object with the highest count is the right one and the rest
can be reset for the next object that comes along (since it will have
different desirable traits that it is looking for)
Is there a better way?
Rick
- CLIPS Question.,
StupendousMan