ChainingResult.Question property
Returns the question posed by the inference engine.
Namespace : ielib
Assembly : ielib.dll
public Fact Question { get; }Property valueType : ielib.Fact
Represents the question concerning a fact that the propositional-type system application to the user.
Note: Consultation with the
ChainingResult.Result property to know if it is a question.
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;
}
}