Artificial Intelligence
Artificial Intelligence
Information

ChainingResult.Result property


      Gets the result following the execution of the InferenceEngine.Run() method.


Namespace : ielib
Assembly : ielib.dll

public ExecuteResult Result { get; }

Property value

Type : enum ChainingResult.ExecuteResult

Represents the result of execution of inference engine.


enum ExecuteResult

Conclusion : the propositional-type system reached a final conclusion.
Question : the propositional-type system has a question to the user.
Contradictory : the propositional-type system detects a contradiction.
NoResult : the propositional-type system cannot be concluded.

Example : Use the ChainingResult.Result property. Is it the result is a conclusion then it displays the result on the DataGridView control.


private void Run(InferenceEngine ie, DataGridView gv)
{
ChainingResult result = ie.Run();
Fact f;

switch(result.Result)
{
      case ChainingResult.ExecuteResult.Conclusion :
for (int i = 0; I < result.Count; i++)
      DisplayResult(result[i], gv.Rows.Add().Cells[1]);
      break;
      case ChainingResult.ExecuteResult.Question :
      AskUser(result.Question); // The question to the user
      break;
      case ChainingResult.ExecuteResult.Contradictory :
      TreatmentContradictory(result.Contradictory); // There is a contradiction
      break;
      default: // The system cannot find
      MessageBox.Show("I do not find.");
      break;
      }
}

private void DisplayResult(Fact f, DataGridViewCell cell)
{
      switch(f.Type)
      {
      case Fact.DataType.Bool :
      bool b = (bool)f.Value;
      cell.Value = b.ToString();
      break;
      case Fact.DataType.Real :
      double d = (double)f.Value;
      cell.Value = d.ToString() ;
      break;
      case Fact.DataType.Symbol :
      cell.Value = (string)f.Value;
      break;
      default: break;
      }
}