Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CS term for rule matching algorithms on tuples of mandatory and optional conditions

I'm trying to research literature for algorithms to solve a particular problem, but I don't think I quite know the right search term to describe what I'm looking for.

The goal is to have a queryable rules database, where each rule is specified as tuple conditions — some mandatory, some optional. A query into the system consists of a tuple of facts about the world, and returns a list of all the rules whose mandatory conditions matched the facts in the query. Each rule is scored by the number×weight of optional conditions matched and the list is sorted thereby.

So for an example, if I were using this to write a roommate-matching service, the rules would be something like

alice : { mandatory : { nightowl = no, smoker = no, pets < 2 }, 
          optional : { pets = 0 } }
bob :   { mandatory : { nightowl = yes, pets = 0 }, 
          optional : {smoker = no} }
charlie : { mandatory : { musician = no }, 
            optional : {nightowl = yes, pets < 2 } }

and the query would be

( nightowl = no, pets = 1, smoker = no, musician = no )

returning

( charlie : 1/1 mandatory matched, 1/2 optional matched,
  alice   : 3/3 mandatory matched, 0/1 optional matched )

I know this is a problem that must have been solved many times in computer science already, but I don't know what keywords to search for. It's not a distance function, because some conditions are discrete true/false rejectors whereas others are optional or have linear scores. It's not pattern matching or fuzzy matching, because those seem to refer mostly to strings and graphs. It's not a production system or rules engine like the Rete algorithm, because it doesn't draw IF-THEN inferences from rules, nor does it remember facts from one call to the next.

What is it called?

I only need research or descriptions of algorithms, not actual implementations. Our application has such severe realtime and memory constraints that we'll need to build an implementation of our own anyway, but I'd like to know what else has been done in the space before I start inventing code. An ACM paper that I could chase citations from would be great, too.

like image 288
Crashworks Avatar asked Oct 10 '22 05:10

Crashworks


2 Answers

The term I'd say most accurately describes the type of problem you're talking about is a constraint satisfaction problem.

More specifically, you're in the realm of weighted constraint satisfaction.

Constraint programming is the usual term for a set of tools and languages that are designed specifically for solving these types of problems.

like image 142
John Flatness Avatar answered Oct 30 '22 14:10

John Flatness


Matching the mandatory conditions is range searching, specifically orthogonal range searching. The relevant literature belongs to computational geometry. Ranking by optional conditions is a sorting operation.

like image 29
adlfkajldf Avatar answered Oct 30 '22 14:10

adlfkajldf