Artificial Intelligence
Artificial Intelligence
Information

InferenceEngine.Run method


      Runs the inference engine. This method works with the mode of joint chaining combining chaining forward that has deducted all what with the rules follows, and chaining backward that determines what question should be asked to move towards a fixed goal.


Namespace : ielib
Assembly : ielib.dll

public ChainingResult Run()

Return value

      Returns the result of execution as an object of the ChainingResult class.

      This method executes chaining forward to find a conclusion, if it does not find it then seeks a question by running chaining backward to find a "smart" question to lead as quickly as possible to a conclusion.


The tracking strategy chaining backward

      Back chaining seeks first a rule that has a small number of unknown facts, and then among the unknown facts, it is a fact that is found in the part of premise of more rules.


Example City base

      Run, chaining backward system seeks the shortest path to conclude "The city deserves the trip" so he find 2 facts: "Many museums" and "Old city", and he chose the first fact to pose the question to the user, here it is "Many museums".


Example of InferenceEngine.Run() method
using ielib;
public void RunIE(string XmlBaseName)
{
     // Instantiates the inference engine from an Xml file
     InferenceEngine ie = new InferenceEngine(XmlBaseName);
     ChainingResult result = ie.Run();

     switch(result.Result)
     {
     case ChainingResult.ExecuteResult.Contradictory:
             //The contradiction is detected
            MessageBox.Show("The Fact " + result.ContradictoryConclusion.FactObject.Name + "is contradictory");
             break;
     case ChainingResult.ExecuteResult.Question:
             //The inference engine my pose the question regarding this Fact
            AskFor(result.Question);
             break;
     case ChainingResult.ExecuteResult.Conclusion:
             //The expert system can binding the result
            for (int i = 0; i < result.Count; i++)
                   DisplayResult(result[i]);
             break;
     default:
             MessageBox.Show("I can not binding");
             break;
     }
}