Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in AI and Deep Learning by (50.2k points)

What will be the best approach to implement forward chaining and backward chaining for the reasoning process in java?

We have been given a Horn-form knowledge base which has a set of statements.

I have tried to search on the 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 the Backward or Forward chain, It will check the 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 the above class by saying...

Sentence s = new Sentence("a&b=>c");

Am I on the right track of sorry I am a noob for these sorts of complicated programming and as per my prediction I might need lots of optimization to run this sort of reasoning at a very high level? But it seems like I need a good understanding with someone to thank you if some of you can help...

Thanks!

1 Answer

0 votes
by (108k points)

Both forward & backward chaining can be viewed as different strategies to deal with resolution. Whereas forward chaining corresponds to unit resolution, backward chaining will correspond to input resolution.

You can refer to the following links for the Forward chaining and Backward chaining in java:

AI Forward Chaining implementation for propositional logic horn form knowledge bases

AI Backward Chaining implementation for propositional logic horn form knowledge bases

If you wish to learn about Java then visit this Java Tutorial as well as the Java course

Browse Categories

...