logic - Prolog Beginner - Is This a Bad Idea? -
the application i'm working on "configurator" of sorts. it's written in c# , wrote rules engine go it. idea there bunch of propositional logic statements, , user can make selections. based on they've selected, other items become required or unavailable.
the propositional logic statements take following forms:
a => ~x abc => ~(x+y) a+b => q a(~(b+c)) => ~q <=> b
the symbols:
=> -- implication <=> -- material equivalence ~ -- not + -- or 2 letters side-by-side -- ,
i'm new prolog, seems might able handle of "rules processing" me, allowing me out of current rules engine (it works, it's not fast or easy maintain like).
in addition, of available options fall in hierarchy. instance:
outside color red blue green material wood metal
if item @ second level (feature, such color) implied, item @ third level (option, such red) must selected. if know feature false, of options under false.
the catch every product has it's own set of rules. reasonable approach set knowledge base containing these operators predicates, @ runtime start buliding of rules product?
the way imagine might work set idea of components, features, , options. set relationships between (for instance, if feature false, of options false). @ runtime, add product's specific rules. pass of user's selections function, retrieving output items true , items false.
i don't know implications of i'm asking about, i'm getting prolog, i'm trying avoid going down bad path , wasting lots of time in process.
some questions might target i'm trying find out:
- does sound do-able?
- am barking wrong tree?
- are there drawbacks or concerns trying create of these rules @ runtime?
- is there better system kind of thing out there might able squeeze c# app (silverlight, exact)?
- are there other competing systems should examine?
- do have general advice sort of thing?
thanks in advance advice!
- sure, prolog has learning curve.
- rule-based inference prolog's game, though may have rewrite many rules horn clauses.
a+b => q
doable (it becomesq :- a. q :- b.
orq :- (a;b).
) other examples must rewritten, includinga => ~x
. - depends on prolog compiler, whether supports indexing dynamic predicates.
- search around terms "forward checking", "inference engine" , "business rules". various communities keep inventing different terminologies problem.
- constraint handling rules (chr) logic programming language, implemented prolog extension, closer rule-based inference/forward chaining/business rules engines. if want use it, you'll still have learn basic prolog, though.
- keep in mind prolog programming language, not silver bullet logical inference. cuts corners of first-order logic keep things efficiently computable. why handles horn clauses: can mapped one-to-one procedures/subroutines.
Comments
Post a Comment