Пример #1
0
        public void DeCacheWithProblemSpec(string storedproblemFile)
        {
            Parser.path = @"D:\documents\frostbow\";
            DecacheSteps();

            //var problemPath = @"D:\Documents\Frostbow\Benchmarks\Problems\" + problemname + "problem.txt";
            //var problemPath = problemDirectory + problemName;
            var prob         = BlockTest.ReadStringGeneratedProblem(storedproblemFile, 0);
            var initialState = prob.Initial;
            var goalState    = prob.Goal;

            var CausalMapFileName = GetCausalMapFileName();
            var ThreatMapFileName = GetThreatMapFileName();
            var EffortMapFileName = GetEffortDictFileName();

            CacheMaps.CacheLinks(GroundActionFactory.GroundActions);
            CacheMaps.CacheGoalLinks(GroundActionFactory.GroundActions, goalState);

            var iniTstate = new State(initialState) as IState;

            CacheMaps.CacheAddReuseHeuristic(iniTstate);
            CacheMaps.PrimaryEffectHack(iniTstate);


            initial = initialState;
            goal    = goalState;
        }
Пример #2
0
        public void DeCacheIt()
        {
            Parser.path = @"D:\documents\frostbow\";
            DecacheSteps();

            // create initial State
            // initialState = MakeObservable(initialState);
            // initialState = AddObservedNegativeConditions(initialState);

            // create goal state
            //var goalState = CreateGoalState();
            //var goalState = CreateGoalState_GetBlock1ToL1();
            //var goalState = CreateGoalState_GetBlock2ToL1();
            //var goalState = CreateGoalState_GetBlock2ToL4();
            //var goalState = CreateGoalState_GetBlock1ToL4();
            //var goalState = CreateGoalState_Race1();
            //goalState = MakeObservable(goalState);

            //// Race World
            //var initialState = CreateInitialStateRace();
            //var goalState = CreateGoalState_DuelState();

            //// RaceBlock World
            //var initialState = CreateInitialState_RaceBlockTest();
            var initialState = CreateInitialState_RaceBlock();
            //var goalState = CreateGoalState_RaceBlockTest();
            var goalState = CreateGoalState_RaceBlock();

            var CausalMapFileName = GetCausalMapFileName();
            var ThreatMapFileName = GetThreatMapFileName();
            var EffortMapFileName = GetEffortDictFileName();

            CacheMaps.CacheLinks(GroundActionFactory.GroundActions);
            CacheMaps.CacheGoalLinks(GroundActionFactory.GroundActions, goalState);

            var iniTstate = new State(initialState) as IState;

            CacheMaps.CacheAddReuseHeuristic(iniTstate);
            CacheMaps.PrimaryEffectHack(iniTstate);


            initial = initialState;
            goal    = goalState;
        }
        public static IPlan ReadAndCompile(bool serializeIt, int whichProblem)
        {
            Parser.path = @"D:\documents\frostbow\boltfreezer\";

            GroundActionFactory.Reset();
            CacheMaps.Reset();

            Tuple <Domain, Problem> problemSpec = JustReadDomainAndProblem(whichProblem);
            var domain  = problemSpec.First;
            var problem = problemSpec.Second;

            GroundActionFactory.PopulateGroundActions(domain, problem);
            GroundActionFactory.DetectStatics();
            var subsetOfOps = RemoveIrrelevantActions(new State(problem.Initial));

            GroundActionFactory.Reset();
            GroundActionFactory.GroundActions = subsetOfOps;
            GroundActionFactory.GroundLibrary = subsetOfOps.ToDictionary(item => item.ID, item => item);
            RemoveStaticPreconditions(GroundActionFactory.GroundActions);

            CacheMaps.CacheLinks(GroundActionFactory.GroundActions);
            CacheMaps.CacheGoalLinks(GroundActionFactory.GroundActions, problem.Goal);
            CacheMaps.CacheAddReuseHeuristic(new State(problem.Initial));

            var decomps   = ReadDecompositions();
            var composite = AddCompositeOperator();

            var CompositeMethods = new Dictionary <Composite, List <Decomposition> >();

            CompositeMethods[composite] = decomps;
            Composite.ComposeHTNs(2, CompositeMethods);

            // Cache links, now not bothering with statics
            CacheMaps.Reset();
            CacheMaps.CacheLinks(GroundActionFactory.GroundActions);
            CacheMaps.CacheGoalLinks(GroundActionFactory.GroundActions, problem.Goal);
            CacheMaps.PrimaryEffectHack(new State(problem.Initial) as IState);


            var initPlan = PlanSpacePlanner.CreateInitialPlan(problem);

            return(initPlan);
        }