public Demo2() { Blackboard = new Blackboard(); Demo2_DefineUnits(Blackboard); m_IDSelector = new KS_ScheduledIDSelector(Blackboard); m_prologEval = new KS_ScheduledPrologEval(Blackboard, inputPool: m_IDSelector.OutputPool, prologExpName: ApplTest_Prolog); /* * fixme: consider creating a filtered by boolean result KS or a more general filter by KC_EvaluatedExpression (once I have more EvaluatedExpressions than Prolog). */ m_filterByPrologResult = new KS_ScheduledFilterSelector(Blackboard, inputPool: m_prologEval.OutputPool, outputPool: FilteredPrologResultPool, filter: KS_ScheduledPrologEval.FilterByPrologResult(ApplTest_Prolog, true)); m_uniformRandomSelector = new KS_ScheduledUniformDistributionSelector(Blackboard, inputPool: FilteredPrologResultPool, outputPool: UniformlySelectedOutputPool, numberToSelect: 1); m_choicePresenter = new KS_ScheduledChoicePresenter(Blackboard, UniformlySelectedOutputPool); m_filterPoolCleaner = new KS_ScheduledFilterPoolCleaner(Blackboard, new string[] { m_IDSelector.OutputPool, // Output pool for ID selector m_prologEval.OutputPool, // Output pool for prolog eval m_filterByPrologResult.OutputPool, // Output pool for filter that filters by prolog result m_uniformRandomSelector.OutputPool // Final output pool (written into by UniformDistributionSelector) }); Controller = new ScheduledSequenceController(); Controller.AddKnowledgeSource(m_IDSelector); Controller.AddKnowledgeSource(m_prologEval); Controller.AddKnowledgeSource(m_filterByPrologResult); Controller.AddKnowledgeSource(m_uniformRandomSelector); Controller.AddKnowledgeSource(m_choicePresenter); Controller.AddKnowledgeSource(m_filterPoolCleaner); // Put request for starting content unit in blackboard Unit req = new Unit(); req.AddComponent(new KC_IDSelectionRequest("start", true)); req.SetActiveRequest(true); Blackboard.AddUnit(req); }
public Demo1_Scheduled() { Blackboard = new Blackboard(); Demo1_KC_DefineUnits(Blackboard); m_IDSelector = new KS_ScheduledIDSelector(Blackboard); m_uniformRandomSelector = new KS_ScheduledUniformDistributionSelector(Blackboard, inputPool: m_IDSelector.OutputPool, outputPool: null, numberToSelect: 1); m_choicePresenter = new KS_ScheduledChoicePresenter(Blackboard, inputPool: m_uniformRandomSelector.OutputPool); m_filterPoolCleaner = new KS_ScheduledFilterPoolCleaner(Blackboard, new string[] { m_IDSelector.OutputPool, m_uniformRandomSelector.OutputPool }); Controller = new ScheduledSequenceController(); Controller.AddKnowledgeSource(m_IDSelector); Controller.AddKnowledgeSource(m_uniformRandomSelector); Controller.AddKnowledgeSource(m_choicePresenter); Controller.AddKnowledgeSource(m_filterPoolCleaner); // Put request for starting content unit in blackboard Unit req = new Unit(); req.AddComponent(new KC_IDSelectionRequest("start", true)); req.SetActiveRequest(true); Blackboard.AddUnit(req); }