Forward chaining and Backward chaining in java
I'd use a rules engine like Drools or JESS before I'd try writing this for myself.
Unless your purpose is to learn how to write a Rete rules engine, in which case I'll withdraw my answer. I'd go and look for Charles Forgy's papers.
Comments
-
TeaCupApp almost 2 years
What will be the best approach to implement forward chaining and backward chaining for reasoning process in java?
We have been given Horn-form knowledge base which has set of statements.
I have tried to search on internet but I was unable to find any description regarding how to implement these sort of Artificial Intelligence concept into coding.
My understanding :
I have thought so far that I will read each sentence(Horn-Form) and create an object of it. Each Sentence class object will have relationship variables and when I will ask knowledge bases for Backward or Forward chain, It will check array of those objects and constructs my desired chain.
public class Sentence{ private String impliedBy; private String implementedVar; public Sentence(String sentence){ String[] relation = sentence.split("=>"); this.impliedBy = relation[0]; this.implementedVar = relation[1]; } ... }
Calling above class by saying...
Sentence s = new Sentence("a&b=>c");
Am I on right track of sorry I am noob for these sort of complicated programming and as per my prediction I might need lots of optimisation to run these sort of reasoning at very high level. But it seems like I need good understanding by someone thank you if some of you can help...
Thanks!
-
Voo almost 13 yearsI'd assume it's a homework. And checking if a simple Horn clause holds or not, really isn't especially hard. Even a HORNSAT really shouldn't be too hard to get right - but then we'd need to know what exactly should be implemented.
-
TeaCupApp almost 13 yearsThank you very much I have extended my understanding regarding these techniques...However I may have to research more to actually implement at higher level, so as Voo said my homework must be easier to solve but I thought if I am learning something why not to learn a right and efficient way, :) Thanks
-
TeaCupApp almost 13 years@Voo , Yes mate you are right! It will be fairly easy to implement if my my above given thoughts(In question) are right on track. :) Thanks for help.