Esempio n. 1
0
        public void setSolution(GoapState cState, string solutionMt, string nowMt, string backgroundMt)
        {
            // Make the description in cState the focus
            prologEngine.markKBScratchpad(solutionMt);

            prologEngine.clearKB(solutionMt);
            prologEngine.clearConnectionsFromMt(solutionMt);
            if (backgroundMt != null)
            {
                prologEngine.connectMT(solutionMt, backgroundMt);
            }
            // foreach (string moduleMt in cState.modList)
            // {
            //     prologEngine.connectMT(solutionMt, moduleMt);
            // }
            string goalCode = "";

            foreach (string p in cState.missingList)
            {
                goalCode += String.Format("precond({0}).\n", p);
            }
            prologEngine.appendKB(goalCode, solutionMt);

            List <string> solutionMissingList = missingInMt(solutionMt, nowMt);

            //List<string> solutionViolationList = violationsInMt(problemMt);

            cState.missingList = solutionMissingList;
            //cState.violationList = solutionViolationList;
        }
Esempio n. 2
0
        public void setSolution(CemaState cState, string solutionMt, string problemMt)
        {
            // Make the description in cState the focus
            prologEngine.clearKB(solutionMt);
            prologEngine.clearConnectionsFromMt(solutionMt);
            prologEngine.connectMT(solutionMt, problemMt);
            foreach (string moduleMt in cState.modList)
            {
                prologEngine.connectMT(solutionMt, moduleMt);
            }
            List <string> solutionMissingList   = missingInMt(solutionMt);
            List <string> solutionViolationList = violationsInMt(problemMt);

            cState.missingList   = solutionMissingList;
            cState.violationList = solutionViolationList;
        }