Beispiel #1
0
    KB5() :
        vmd::KnowledgeBase(), mNbUpdate(0), mNbAck(0), mNbOut(0)
    {
        std::cout << fmt("KB5 start\n");
        vmd::Activity& a = addActivity("A", 0.0, vd::infinity);
        vmd::Activity& b = addActivity("B", 1.0, vd::infinity);
        vmd::Activity& c = addActivity("C", 1.0, vd::infinity);
        vmd::Activity& d = addActivity("D", 2.0, vd::infinity);
        vmd::Activity& e = addActivity("E", 3.0, vd::infinity);
        vmd::Activity& f = addActivity("F", 4.0, vd::infinity);

        addOutputFunctions(this) += O("out", &KB5::out);
        addUpdateFunctions(this) += U("update", &KB5::update);

        a.addOutputFunction(outputFunctions()["out"]);
        b.addOutputFunction(outputFunctions()["out"]);
        c.addOutputFunction(outputFunctions()["out"]);
        d.addOutputFunction(outputFunctions()["out"]);
        e.addOutputFunction(outputFunctions()["out"]);
        f.addOutputFunction(outputFunctions()["out"]);

        a.addUpdateFunction(updateFunctions()["update"]);
        b.addUpdateFunction(updateFunctions()["update"]);
        c.addUpdateFunction(updateFunctions()["update"]);
        d.addUpdateFunction(updateFunctions()["update"]);
        e.addUpdateFunction(updateFunctions()["update"]);
        f.addUpdateFunction(updateFunctions()["update"]);
    }
Beispiel #2
0
    KnowledgeBase()
        : vmd::KnowledgeBase(), mNbUpdate(0), mNbAck(0), mNbOut(0)
    {
        addFacts(this) +=
            F("fact 1", &KnowledgeBase::updateFact1),
            F("fact 2", &KnowledgeBase::updateFact2);

        addPredicates(this) +=
            P("pred 1", &KnowledgeBase::isAlwaysTrue),
            P("pred 2", &KnowledgeBase::isAlwaysTrue),
            P("pred 3", &KnowledgeBase::isAlwaysTrue),
            P("pred 4", &KnowledgeBase::isAlwaysTrue),
            P("pred 5", &KnowledgeBase::isAlwaysTrue),
            P("pr ed 5", &KnowledgeBase::isAlwaysTrue),
            P("pred 6", &KnowledgeBase::isAlwaysTrue),
            P("pred 7", &KnowledgeBase::isAlwaysFalse);

        addOutputFunctions(this) +=
            O("output function", &KnowledgeBase::out);

        addAcknowledgeFunctions(this) +=
            A("ack function", &KnowledgeBase::ack);

        addUpdateFunctions(this) +=
            U("update function", &KnowledgeBase::update);
    }