public static void Initialise(GdlList description) { SymbolTable = Parser.SymbolTable; GameInformation = new MetaGdl(Parser).ExamineGdl(description); var expressions = new List<Expression>(); expressions.AddRange(GameInformation.GetRules()); expressions.AddRange(GameInformation.GetAllGrounds()); Prover = new AimaProver(expressions); }
//INFO: using the old BasicReasoner which appears to be much slower //private static void AddSentencesTrueByRules( // MultiDictionary<ISentenceForm, Fact> sentencesByForm, // ISentenceFormModel model) //{ // BasicReasoner prover = GameContainer.Reasoner; // var context = new ProofContext(new BasicKB(), GameContainer.Parser); // foreach (ISentenceForm form in model.ConstantSentenceForms) // { // Fact query = form.GetSentenceFromTuple(GetVariablesTuple(form.TupleSize)); // IEnumerable<GroundFact> answers = prover.GetAllAnswers(query, context); // foreach (GroundFact result in answers) // { // //ConcurrencyUtils.checkForInterruption(); // //Variables may end up being replaced with functions, which is not what we want here, so we have to double-check that the form is correct. // if (form.Matches(result)) // sentencesByForm.Add(form, result); // } // } //} private static void AddSentencesTrueByRules(MultiDictionary<ISentenceForm, Fact> sentencesByForm, ISentenceFormModel model) { AimaProver prover = new AimaProver(model.Description); foreach (ISentenceForm form in model.ConstantSentenceForms) { Fact query = form.GetSentenceFromTuple(GetVariablesTuple(form.TupleSize)); HashSet<Fact> context = new HashSet<Fact>(); foreach (Fact result in prover.AskAll(query, context)) if (form.Matches(result)) sentencesByForm.Add(form, result); } }