public static <Task extends ITask> Deque<Task> getPlan(SimulationMap m, Person p, Collection<Task> tasks, Task goalTask) throws Exception{
        PLPlan plan = new PLPlan();
        plan.setAlgorithm(EnumAlgorithm.GRAPHPLAN);
        Collection<String> requiredFacts = getFacts(goalTask);
        for(String f: requiredFacts){
            plan.addGoalFact(f);
        }
        Collection<String> currentFacts = getState(m, p);
        for(String s: currentFacts){
            plan.addFact(s);
        }
        for(Task t: tasks){
            addTask(t, plan);
        }
        List planList = plan.findPlan();
        Deque<Task> taskPlan = new ArrayDeque<>();
        for(Object ob: planList){
            List pl = null;
            if(ob instanceof ArrayList){
                pl = (List) ob;
                for(Object obs: pl){
                    for(Task t: tasks){
                        if(obs.toString().equals(t.name())) taskPlan.add(t);
                    }
                }
            }
        }
        
        return taskPlan;
    }