示例#1
0
 private void btnForwardChaining_Click(object sender, EventArgs e)
 {
     try
     {
         var engine = new ProductionInferenceEngine(ProductionRulesConverter.ConvertToRules(txtbxRules.Text));
         var result = engine.ExecuteForwardChaining(txtbxFact.Text, txtbxGoal.Text);
         if (result.HasSolution)
         {
             txtbxSolution.Text = ProductionRulesConverter.ConvertForwardRulesToText(result.Explanation);
         }
         else
         {
             txtbxSolution.Text = "Нет решений";
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, ex.GetType().Name, MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }