public void PrepareAndRun()
        {
            Parser.path = @"D:\documents\frostbow\";
            UPC.ReadProblem();

            if (DeCacheIt)
            {
                DeCacheIt = false;
                cacheManager.DeCacheIt();
            }
            else if (justCacheMapsAndEffort)
            {
                cacheManager.DecacheSteps();
                AddObservedNegativeConditions(UPC);

                CacheMaps.CacheLinks(GroundActionFactory.GroundActions);
                CacheMaps.CacheGoalLinks(GroundActionFactory.GroundActions, UPC.goalPredicateList);
                CacheMaps.CacheAddReuseHeuristic(new State(UPC.initialPredicateList) as IState);
                UnityGroundActionFactory.PrimaryEffectHack(new State(UPC.initialPredicateList) as IState);

                cacheManager.justCacheMapsAndEffort = true;
                cacheManager.CacheIt();
                cacheManager.justCacheMapsAndEffort = false;
                return;
            }
            else
            {
                UGAF.PreparePlanner(true);
                GroundActionFactory.GroundActions = new HashSet <IOperator>(GroundActionFactory.GroundActions).ToList();
                AddObservedNegativeConditions(UPC);
                UnityGroundActionFactory.CreateSteps(UPC, UGAF.DecompositionSchemata);

                cacheManager.CacheIt();
            }

            var initialPlan = PlannerScheduler.CreateInitialPlan(UPC.initialPredicateList, UPC.goalPredicateList);


            Debug.Log("Planner and initial plan Prepared");

            // MW-Loc-Conf
            var solution = Run(initialPlan, new ADstar(false), new E0(new AddReuseHeuristic(), true), cutoffTime);

            //var solution = Run(initialPlan, new ADstar(false), new E3(new AddReuseHeuristic()), cutoffTime);
            //var solution = Run(initPlan, new BFS(), new Nada(new ZeroHeuristic()), 20000);
            if (solution != null)
            {
                //Debug.Log(solution.ToStringOrdered());
                PlanSteps = new List <string>();
                foreach (var step in solution.Orderings.TopoSort(solution.InitialStep))
                {
                    Debug.Log(step);
                    PlanSteps.Add(step.ToString());
                }
            }
            else
            {
                Debug.Log("No good");
            }
        }
Пример #2
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;
        }
Пример #3
0
        public static void RunProblem(string directory, string domainName, string domainDirectory, Domain domain, Problem problem, float cutoff, int HTN_level, Dictionary <Composite, List <Decomposition> > CompositeMethods)
        {
            // Reset Cached Items
            GroundActionFactory.Reset();
            CacheMaps.Reset();

            var PF = new ProblemFreezer(domainName, domainDirectory, domain, problem);

            PF.Serialize();

            Console.WriteLine("Detecting Statics");
            GroundActionFactory.DetectStatics();

            var initPlan = PlanSpacePlanner.CreateInitialPlan(PF);

            // Removing irrelevant actions
            Console.WriteLine("Removing Irrelevant Actions");
            var staticInitial = initPlan.Initial.Predicates.Where(state => GroundActionFactory.Statics.Contains(state));

            // Every action that has No preconditions which are both static and not in staticInitial
            var possibleActions = GroundActionFactory.GroundActions.Where(action => !action.Preconditions.Any(pre => GroundActionFactory.Statics.Contains(pre) && !staticInitial.Contains(pre)));

            GroundActionFactory.GroundActions = possibleActions.ToList();
            GroundActionFactory.GroundLibrary = possibleActions.ToDictionary(item => item.ID, item => item);

            // Composing HTNs
            Console.WriteLine("Composing HTNs");
            Composite.ComposeHTNs(HTN_level, CompositeMethods);

            // Caching Causal Maps
            Console.WriteLine("Caching Causal Maps");
            CacheMaps.Reset();
            CacheMaps.CacheLinks(GroundActionFactory.GroundActions);
            CacheMaps.CacheGoalLinks(GroundActionFactory.GroundActions, initPlan.Goal.Predicates);

            // Cache Heuristic Costs (dynamic programming)
            Console.WriteLine("Caching Heuristic Costs");
            CacheMaps.CacheAddReuseHeuristic(initPlan.Initial);

            // Redo to gaurantee accuracy (needs refactoring)
            initPlan = PlanSpacePlanner.CreateInitialPlan(PF);

            var probNum = Int32.Parse(problem.Name);


            Console.WriteLine(String.Format("Running Problem {0}", probNum));

            RunPlanner(initPlan.Clone() as IPlan, new ADstar(false), new E0(new AddReuseHeuristic(), true), cutoff, directory, probNum);

            //RunPlanner(initPlan.Clone() as IPlan, new ADstar(true), new E0(new AddReuseHeuristic()), cutoff, directory, probNum);
            //RunPlanner(initPlan.Clone() as IPlan, new ADstar(true), new E1(new AddReuseHeuristic()), cutoff, directory, probNum);
            //RunPlanner(initPlan.Clone() as IPlan, new ADstar(true), new E2(new AddReuseHeuristic()), cutoff, directory, probNum);
            //RunPlanner(initPlan.Clone() as IPlan, new ADstar(true), new E3(new AddReuseHeuristic()), cutoff, directory, probNum);
            //RunPlanner(initPlan.Clone() as IPlan, new BFS(false), new Nada(new ZeroHeuristic()), cutoff, directory, probNum);

            // RunPlanner(initPlan.Clone() as IPlan, new BFS(true), new Nada(new ZeroHeuristic()), cutoff, directory, probNum);
        }
Пример #4
0
        static void Main(string[] args)
        {
            Console.Write("hello world\n");

            var cutoff = 100000f;
            var k      = 1;

            // var testDomainName = "batman";
            // var directory = Parser.GetTopDirectory() + @"/Results/" + testDomainName + @"/";
            // System.IO.Directory.CreateDirectory(directory);
            //    var testDomainDirectory = Parser.GetTopDirectory() + @"Benchmarks\" + testDomainName + @"\domain.pddl";
            //var testDomain = Parser.GetDomain(Parser.GetTopDirectory() + @"Benchmarks\" + testDomainName + @"\domain.pddl", PlanType.PlanSpace);
            //var testProblem = Parser.GetProblem(Parser.GetTopDirectory() + @"Benchmarks\" + testDomainName + @"\prob01.pddl");

            Parser.path = @"D:\Documents\classical-domains\classical\hiking-sat14-strips\";
            var testDomainName = "hiking -sat14-strips";
            var directory      = @"D:\Documents\classical-domains\classical\hiking-sat14-strips\Results\";

            System.IO.Directory.CreateDirectory(directory);
            var testDomainDirectory = @"D:\Documents\classical-domains\classical\hiking-sat14-strips\domain.pddl";
            var testDomain          = Parser.GetDomain(testDomainDirectory, PlanType.PlanSpace);
            var testProblem         = Parser.GetProblem(@"D:\Documents\classical-domains\classical\hiking-sat14-strips\ptesting-1-2-7.pddl");

            Console.WriteLine("Creating Ground Operators");
            GroundActionFactory.Reset();

            GroundActionFactory.PopulateGroundActions(testDomain, testProblem);

            CacheMaps.Reset();
            CacheMaps.CacheLinks(GroundActionFactory.GroundActions);
            CacheMaps.CacheGoalLinks(GroundActionFactory.GroundActions, testProblem.Goal);

            var iniTstate = new State(testProblem.Initial) as IState;

            CacheMaps.CacheAddReuseHeuristic(iniTstate);

            // var problemFreezer = new ProblemFreezer(testDomainName, testDomainDirectory, testDomain, testProblem);

            //problemFreezer.Serialize();
            //problemFreezer.Deserialize();

            var initPlan = PlanSpacePlanner.CreateInitialPlan(testProblem);

            RunPlanner(initPlan.Clone() as IPlan, new ADstar(), new E0(new AddReuseHeuristic()), k, cutoff, directory, 1);
            //initPlan = PlanSpacePlanner.CreateInitialPlan(testProblem);
            //RunPlanner(initPlan.Clone() as IPlan, new ADstar(), new E0(new NumOpenConditionsHeuristic()), k, cutoff, directory, 1);
            //RunPlanner(initPlan.Clone() as IPlan, new DFS(), new Nada(new ZeroHeuristic()), k, cutoff, directory, 1);
            //RunPlanner(initPlan.Clone() as IPlan, new BFS(), new Nada(new ZeroHeuristic()), k, cutoff, directory, 1);
        }
Пример #5
0
        // Update is called once per frame
        void Update()
        {
            if (compilePrimitiveSteps)
            {
                compilePrimitiveSteps = false;
                initialPlan           = PreparePlanner(true);
                PrimitiveOps          = GroundActionFactory.GroundActions;
                PrimitiveSteps        = PrimitiveOps.Count;
                CompositeSteps        = 0;
            }

            if (compileCompositeSteps)
            {
                compileCompositeSteps = false;
                CompileCompositeSteps();
            }

            if (checkEffects)
            {
                checkEffects = false;
                foreach (var compstep in CompositeOps)
                {
                    foreach (var effect in compstep.Effects)
                    {
                        if (effect.Name != "obs") // && effect.Name != "obs-starts")
                        {
                            continue;
                        }
                        Debug.Log(effect.ToString());
                    }
                }
                // do we have what we need?
            }

            if (regenerateInitialPlanWithComposite)
            {
                regenerateInitialPlanWithComposite = false;

                Parser.path = "/";
                var domainOperatorComponent = GameObject.FindGameObjectWithTag("ActionHost").GetComponent <DomainOperators>();
                domainOperatorComponent.Reset();
                var problem  = CreateProblem(domainOperatorComponent.DomainOps);
                var domain   = CreateDomain(domainOperatorComponent);
                var PF       = new ProblemFreezer("Unity", "", domain, problem);
                var initPlan = PlannerScheduler.CreateInitialPlan(PF);
                CacheMaps.CacheAddReuseHeuristic(initPlan.Initial);
                PrimaryEffectHack(InitialPlan.Initial);
            }
        }
Пример #6
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;
        }
Пример #7
0
        public static IPlan ReadAndCompile(bool serializeIt, int whichProblem)
        {
            Parser.path = @"D:\documents\frostbow\boltfreezer\";

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

            // Reads Domain and problem, also populates ground actions and caches causal maps
            var pfreeze = ReadDomainAndProblem(serializeIt, whichProblem);

            // Detecting static conditions
            Console.WriteLine("Detecting Statics");
            GroundActionFactory.DetectStatics();

            var initPlan = PlanSpacePlanner.CreateInitialPlan(pfreeze);

            // Removing irrelevant actions
            Console.WriteLine("Removing Irrelevant Actions");
            var staticInitial = initPlan.Initial.Predicates.Where(state => GroundActionFactory.Statics.Contains(state));

            // Every action that has No preconditions which are both static and not in staticInitial
            var possibleActions = GroundActionFactory.GroundActions.Where(action => !action.Preconditions.Any(pre => GroundActionFactory.Statics.Contains(pre) && !staticInitial.Contains(pre)));

            GroundActionFactory.GroundActions = possibleActions.ToList();
            GroundActionFactory.GroundLibrary = possibleActions.ToDictionary(item => item.ID, item => item);

            var CompositeMethods = ReadCompositeOperators();

            // Composing HTNs
            Console.WriteLine("Composing HTNs");
            Composite.ComposeHTNs(2, CompositeMethods);

            // Caching Causal Maps
            Console.WriteLine("Caching Causal Maps");
            CacheMaps.Reset();
            CacheMaps.CacheLinks(GroundActionFactory.GroundActions);
            CacheMaps.CacheGoalLinks(GroundActionFactory.GroundActions, initPlan.Goal.Predicates);
            CacheMaps.CacheAddReuseHeuristic(initPlan.Initial);
            initPlan = PlanSpacePlanner.CreateInitialPlan(pfreeze);


            return(initPlan);
        }
        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);
        }
Пример #9
0
        public void DeCacheIt()
        {
            Parser.path = @"D:\documents\frostbow\";
            DecacheSteps();

            UnityPlanningInterface.AddObservedNegativeConditions(UPC);

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

            try
            {
                var cmap = BinarySerializer.DeSerializeObject <TupleMap <IPredicate, List <int> > >(CausalMapFileName + ".CachedCausalMap");
                CacheMaps.CausalTupleMap = cmap;

                var tcmap = BinarySerializer.DeSerializeObject <TupleMap <IPredicate, List <int> > >(ThreatMapFileName + ".CachedThreatMap");
                CacheMaps.ThreatTupleMap = tcmap;

                try
                {
                    var emap = BinarySerializer.DeSerializeObject <TupleMap <IPredicate, int> >(EffortMapFileName + ".CachedEffortMap");
                    HeuristicMethods.visitedPreds = emap;
                }
                catch
                {
                    CacheMaps.CacheAddReuseHeuristic(new State(UPC.initialPredicateList) as IState);
                    UnityGroundActionFactory.PrimaryEffectHack(new State(UPC.initialPredicateList) as IState);
                }
            }
            catch
            {
                CacheMaps.CacheLinks(GroundActionFactory.GroundActions);
                CacheMaps.CacheGoalLinks(GroundActionFactory.GroundActions, UPC.goalPredicateList);
                CacheMaps.CacheAddReuseHeuristic(new State(UPC.initialPredicateList) as IState);
                UnityGroundActionFactory.PrimaryEffectHack(new State(UPC.initialPredicateList) as IState);
            }
        }
Пример #10
0
        static void Main(string[] args)
        {
            Console.Write("hello world\n");

            ///////////////////////
            //// Set path variables
            ///////////////////////

            Parser.path = @"D:\Documents\Frostbow\VHPOP-PlayTrace\Benchmarks\Rogelio_POCL_compilation";

            // Where the Results will be inserted
            var directory = Parser.path + @"\Results";

            System.IO.Directory.CreateDirectory(directory);

            // Where the ground operator instances will be cached
            var problemFreezeDirectory = Parser.path + @"\Cached\";

            System.IO.Directory.CreateDirectory(problemFreezeDirectory);

            // Where to read the domain and problem
            var domainDirectory  = Parser.path + @"\domain.pddl";
            var problemDirectory = Parser.path + @"\prob01.pddl";

            // Where to read the player trace
            var playerTraceDirectory = Parser.path + @"\chronology_arthur156.pddl";

            /////////////////////
            //// Read Domain ////
            /////////////////////

            var domain  = Parser.GetDomain(domainDirectory, PlanType.PlanSpace);
            var problem = Parser.GetProblem(problemDirectory);

            // Create Operators
            Console.WriteLine("Creating Ground Operators");
            GroundActionFactory.Reset();

            /*
             * For compiling the player trace, we only need just those ground instances of steps that appear in the trace
             * Whereas typically one can follow the following code to Serialize and Deserialize all ground action instances as follows...
             *
             *  /*
             *
             *  // To Serialize: it's a large problem, so we only want to read this once.
             *  ProblemFreezer.Serialize(domain, problem, problemFreezeDirectory);
             *
             *  //// To Deserialize, if we're already read it and serialized
             *  ////ProblemFreezer.Deserialize(problemFreezeDirectory);
             *
             *  //// If you want to avoid serialization/deserialization, you've got to do this every time.
             *  ////GroundActionFactory.PopulateGroundActions(domain, problem);
             *  /*
             *
             *  Here instead we read the player trace and compile just those action instances that appear. Note then that this removes the functionality of considering "what-if" actions
             */

            //////////////////////////////////////////////////////
            //// Read Player trace ///////////////////////////////
            //////////////////////////////////////////////////////

            // Needs to be set manually because we aren't running standard "Populate" method
            GroundActionFactory.CreateTypeDict(domain, problem);

            // playerTraceDirectory
            var PlanStepList = PlayerTraceUtilities.ReadPlayerTrace(playerTraceDirectory, domain, problem);

            // Remove those that aren't any good
            PlanStepList = PlayerTraceUtilities.RemoveUseless(PlanStepList);

            // Find Quests completed to create goal conditions.
            var goals = PlayerTraceUtilities.CreateGoalDisjunctions(problem.Initial, PlanStepList);

            problem.Goal = goals;

            /////////////////////////////////////////////////////////////////////////////////
            // Create Causal Maps (using just those gorund actions found in the plan trace
            /////////////////////////////////////////////////////////////////////////////////

            CacheMaps.Reset();
            CacheMaps.CacheLinks(GroundActionFactory.GroundActions);
            CacheMaps.CacheGoalLinks(GroundActionFactory.GroundActions, problem.Goal);

            //////////////////////////////////////////////////////
            // Create Initial State ///////////////////////////
            //////////////////////////////////////////////////////

            var iniTstate = new State(problem.Initial) as IState;

            // Use Initial State to Cache effort values VHPOP style
            CacheMaps.CacheAddReuseHeuristic(iniTstate);

            //////////////////////////////////////////////////////
            // Create Initial Plan///////////////////////////
            //////////////////////////////////////////////////////

            // Need to modify goal state
            var initPlan = PlanSpacePlanner.CreateInitialPlan(problem);

            var lastInsertedStep = initPlan.InitialStep;

            foreach (var step in PlanStepList)
            {
                initPlan.Insert(step);
                initPlan.Orderings.Insert(lastInsertedStep, step);
                lastInsertedStep = step;
            }


            ////////////////////////////////////////////////
            //// Run Planner ///////////////////////////////
            ////////////////////////////////////////////////

            // Time limit in milliseconds for search
            var cutoff = 6000000f;

            // Number of plans to return
            var k = 1;

            // Static method called
            RunPlanner(initPlan.Clone() as IPlan, new ADstar(), new E0(new AddReuseHeuristic()), k, cutoff, directory, 1);

            /*
             *  ************************************************************
             *  *************** Other ways to run the planner **************
             *  ************************************************************
             *  RunPlanner(initPlan.Clone() as IPlan, new ADstar(), new E0(new NumOpenConditionsHeuristic()), k, cutoff, directory, 1);
             *  RunPlanner(initPlan.Clone() as IPlan, new DFS(), new Nada(new ZeroHeuristic()), k, cutoff, directory, 1);
             *  RunPlanner(initPlan.Clone() as IPlan, new BFS(), new Nada(new ZeroHeuristic()), k, cutoff, directory, 1);
             */
        }
Пример #11
0
        public IPlan PreparePlanner(bool resetCache)
        {
            Parser.path = "/";

            // Update Domain Operators
            var domainOperatorComponent = GameObject.FindGameObjectWithTag("ActionHost").GetComponent <DomainOperators>();

            domainOperatorComponent.Reset();

            // Read and Create Problem
            var problem = CreateProblem(domainOperatorComponent.DomainOps);

            // Create Domain
            var domain = CreateDomain(domainOperatorComponent);

            // Create Problem Freezer.
            var PF = new ProblemFreezer("Unity", "", domain, problem);

            // Create Initial Plan
            var initPlan = PlannerScheduler.CreateInitialPlan(PF);

            if (!resetCache)
            {
                if (GroundActionFactory.GroundActions != null)
                {
                    if (HeuristicMethods.visitedPreds == null || HeuristicMethods.visitedPreds.Get(true).Count == 0)
                    {
                        CacheMaps.CacheAddReuseHeuristic(initPlan.Initial);
                        //PrimaryEffectHack(initPlan.Initial);
                    }
                    Debug.Log("test");
                    return(initPlan);
                }
            }

            // Reset Cache
            GroundActionFactory.Reset();
            CacheMaps.Reset();

            GroundActionFactory.PopulateGroundActions(domain, problem);

            // Remove Irrelevant Actions (those which require an adjacent edge but which does not exist. In Refactoring--> make any static
            Debug.Log("removing irrelevant actions");
            var adjInitial      = initPlan.Initial.Predicates.Where(state => state.Name.Equals("adjacent"));
            var replacedActions = new List <IOperator>();

            foreach (var ga in GroundActionFactory.GroundActions)
            {
                // If this action has a precondition with name adjacent this is not in initial state, then it's impossible. True ==> impossible. False ==> OK!
                var isImpossible = ga.Preconditions.Where(pre => pre.Name.Equals("adjacent") && pre.Sign).Any(pre => !adjInitial.Contains(pre));
                if (isImpossible)
                {
                    continue;
                }
                replacedActions.Add(ga);
            }
            GroundActionFactory.Reset();
            GroundActionFactory.GroundActions = replacedActions;
            GroundActionFactory.GroundLibrary = replacedActions.ToDictionary(item => item.ID, item => item);


            CacheMaps.CacheLinks(GroundActionFactory.GroundActions);
            CacheMaps.CacheGoalLinks(GroundActionFactory.GroundActions, problem.Goal);


            // Detect Statics
            Debug.Log("Detecting Statics");
            GroundActionFactory.DetectStatics(CacheMaps.CausalTupleMap, CacheMaps.ThreatTupleMap);


            Debug.Log("Caching Heuristic costs");
            CacheMaps.CacheAddReuseHeuristic(initPlan.Initial);

            // Recreate Initial Plan
            initPlan = PlannerScheduler.CreateInitialPlan(PF);

            return(initPlan);
        }