Exemplo n.º 1
0
        public List <string> FDPlan(Domain d, Problem p, State curentState, Formula goal, List <Action> privateActions, int cMaxMilliseconds, out bool bUnsolvable)
        {
            RunUtils.KillPlanners();
            List <string> ffLplan = new List <string>();
            List <string> lPlan   = new List <string>();

            File.Delete("plan.txt");
            File.Delete("sas_plan");

            if (privateActions != null)
            {
                d.Actions = privateActions;
            }
            if (goal != null)
            {
                p.Goal = goal;
            }

            MemoryStream msDomain    = d.WriteSimpleDomain();
            MemoryStream problem_M_S = p.WriteSimpleProblem(curentState);

            //for now, saving files in the working directory

            StreamWriter swDomainFile = new StreamWriter("dFD.pddl");
            StreamReader srDomain     = new StreamReader(msDomain);

            swDomainFile.Write(srDomain.ReadToEnd());
            swDomainFile.Close();

            StreamWriter swProblemFile = new StreamWriter("pFD.pddl");
            StreamReader srProblem     = new StreamReader(problem_M_S);

            swProblemFile.Write(srProblem.ReadToEnd());
            swProblemFile.Close();


            problem_M_S.Position = 0;
            msDomain.Position    = 0;

            bUnsolvable = false;

            if (RunFD("./", cMaxMilliseconds))
            {
                return(ReadPlan("./"));
            }
            return(null);
        }
Exemplo n.º 2
0
        public List <string> ManualSolve(Domain d, Problem p, State curentState, Formula goal, List <Action> privateActions, int cMaxMilliseconds, out bool bUnsolvable)
        {
            RunUtils.KillPlanners();
            List <string> ffLplan = new List <string>();
            List <string> lPlan   = new List <string>();


            if (privateActions != null)
            {
                d.Actions = privateActions;
            }
            if (goal != null)
            {
                p.Goal = goal;
            }
            bUnsolvable = false;
            return(ManualSolve(p, d));
        }
Exemplo n.º 3
0
        public static List <string> SolveFactored(List <Domain> lDomains, List <Problem> lProblems, ref List <Agent> m_agents, Domain joinDomain)
        {
            if (Program.highLevelPlanerType != Program.HighLevelPlanerType.ProjectionMafs)
            {
                Program.projectionVersion = Program.ProjectionVersion.NULL;
            }
            Program.Start   = DateTime.Now;
            pdbCreationTime = 0;
            var lGroundedProblems = GroundProblems(lDomains, lProblems);

            Program.internalPlaner = Program.PlanerType.ff_toActions;
            BuildAgents_II buildAgents = new BuildAgents_II(lDomains, lGroundedProblems, lProblems);
            List <Agent>   agents      = buildAgents.ReturnAgents();

            GetPublicPredicates(agents);
            List <string> lPlan = null;

            if (Program.highLevelPlanerType == Program.HighLevelPlanerType.Projection)
            {
                Console.WriteLine("Planning");
                ShareGoals(agents);
                AdvancedLandmarkProjectionPlaner planner = new AdvancedLandmarkProjectionPlaner();
                lPlan = planner.Plan(agents, lDomains, lProblems, joinDomain);
            }
            else
            {
                try
                {
                    Program.StartHighLevelPlanning = DateTime.Now;
                    if (Program.highLevelPlanerType == Program.HighLevelPlanerType.Landmark)
                    {
                        Console.WriteLine("Identifying landmarks");
                        bool stop = false;
                        while (!stop)
                        {
                            stop = true;
                            string            name        = "";
                            GroundedPredicate currentGoal = null;
                            foreach (Agent agent in agents)
                            {
                                currentGoal = agent.GetGoal();
                                if (currentGoal != null)
                                {
                                    stop = false;
                                    name = agent.name;
                                    break;
                                }
                            }
                            if (!stop)
                            {
                                foreach (Agent agent in agents)
                                {
                                    if (!agent.name.Equals(name))
                                    {
                                        agent.ReceiveGoal(currentGoal);
                                    }
                                }
                            }
                        }
                        foreach (Agent agent in agents)
                        {
                            agent.InitMutex();
                        }

                        agents = Distributed_Landmarks_Detection.Landmarks_Detection(agents, false);
                        Planer_I Planner = new Planer_I(agents);
                        Console.WriteLine("Planning");
                        lPlan = Planner.Plan();
                    }
                    else
                    {
                        if (Program.highLevelPlanerType == Program.HighLevelPlanerType.PDB)
                        {
                            DateTime startPdbCreation = DateTime.Now;
                            PdbPlaner.pdb   = new PatternDatabase(lDomains, lProblems, agents, pdbPath);
                            pdbCreationTime = DateTime.Now.Subtract(startPdbCreation).TotalSeconds;
                            foreach (Agent agent in agents)
                            {
                                agent.InitMutex();
                            }
                            Distributed_Landmarks_Detection.Reset(agents);
                            List <Landmark> PublicAndArtificialGoals = FindPublicAndArtificialGoals(agents);

                            PdbPlaner Planner = new PdbPlaner(agents, PublicAndArtificialGoals, PdbPlaner.pdb);
                            Console.WriteLine("Planning");

                            lPlan = Planner.Plan();
                        }
                        else
                        {
                            if (Program.highLevelPlanerType == Program.HighLevelPlanerType.ForwardHsp)
                            {
                                bool stop = false;
                                while (!stop)
                                {
                                    stop = true;
                                    string            name        = "";
                                    GroundedPredicate currentGoal = null;
                                    foreach (Agent agent in agents)
                                    {
                                        currentGoal = agent.GetGoal();
                                        if (currentGoal != null)
                                        {
                                            stop = false;
                                            name = agent.name;
                                            break;
                                        }
                                    }
                                    if (!stop)
                                    {
                                        foreach (Agent agent in agents)
                                        {
                                            if (!agent.name.Equals(name))
                                            {
                                                agent.ReceiveGoal(currentGoal);
                                            }
                                        }
                                    }
                                }
                                foreach (Agent agent in agents)
                                {
                                    agent.InitMutex();
                                }
                                Distributed_Landmarks_Detection.Reset(agents);
                                PlanerHsp Planner = new PlanerHsp(agents);
                                Console.WriteLine("Planning");
                                lPlan = Planner.Plan();
                            }
                            else
                            {
                                if (Program.highLevelPlanerType == Program.HighLevelPlanerType.BackwardHsp)
                                {
                                    bool stop = false;
                                    List <GroundedPredicate> publishPublic     = new List <GroundedPredicate>();
                                    List <GroundedPredicate> nextPublishPublic = new List <GroundedPredicate>();
                                    foreach (Agent a in agents)
                                    {
                                        publishPublic.AddRange(a.InitBackwardHspGraph());
                                    }
                                    bool outFlag = false;
                                    while (!stop)
                                    {
                                        stop    = true;
                                        outFlag = false;
                                        foreach (Agent agent in agents)
                                        {
                                            nextPublishPublic.AddRange(agent.UpdateBackwardHspGraph(publishPublic, out outFlag));
                                            if (outFlag)
                                            {
                                                stop = false;
                                            }
                                        }
                                        publishPublic = nextPublishPublic;
                                    }

                                    foreach (Agent agent in agents)
                                    {
                                        agent.InitMutex();
                                    }
                                    Distributed_Landmarks_Detection.Reset(agents);
                                    // agents = Distributed_Landmarks_Detection.Landmarks_Detection(agents);
                                    PlanerHspII Planner = new PlanerHspII(agents);
                                    Console.WriteLine("Planning");
                                    lPlan = Planner.Plan();
                                }
                                else
                                {
                                    if (Program.highLevelPlanerType == Program.HighLevelPlanerType.LandmarkAndHsp)
                                    {
                                        bool stop = false;
                                        while (!stop)
                                        {
                                            stop = true;
                                            string            name        = "";
                                            GroundedPredicate currentGoal = null;
                                            foreach (Agent agent in agents)
                                            {
                                                currentGoal = agent.GetGoal();
                                                if (currentGoal != null)
                                                {
                                                    stop = false;
                                                    name = agent.name;
                                                    break;
                                                }
                                            }
                                            if (!stop)
                                            {
                                                foreach (Agent agent in agents)
                                                {
                                                    if (!agent.name.Equals(name))
                                                    {
                                                        agent.ReceiveGoal(currentGoal);
                                                    }
                                                }
                                            }
                                        }
                                        foreach (Agent agent in agents)
                                        {
                                            agent.InitMutex();
                                        }

                                        agents = Distributed_Landmarks_Detection.Landmarks_Detection(agents, false);

                                        PlanerHspAndLandmarks Planner = new PlanerHspAndLandmarks(agents);

                                        Console.WriteLine("Planning..");

                                        lPlan = Planner.Plan();
                                    }
                                    else
                                    {
                                        if (Program.highLevelPlanerType == Program.HighLevelPlanerType.WeightedLandmarkAndHsp)
                                        {
                                            bool stop = false;
                                            while (!stop)
                                            {
                                                stop = true;
                                                string            name        = "";
                                                GroundedPredicate currentGoal = null;
                                                foreach (Agent agent in agents)
                                                {
                                                    currentGoal = agent.GetGoal();
                                                    if (currentGoal != null)
                                                    {
                                                        stop = false;
                                                        name = agent.name;
                                                        break;
                                                    }
                                                }
                                                if (!stop)
                                                {
                                                    foreach (Agent agent in agents)
                                                    {
                                                        if (!agent.name.Equals(name))
                                                        {
                                                            agent.ReceiveGoal(currentGoal);
                                                        }
                                                    }
                                                }
                                            }
                                            foreach (Agent agent in agents)
                                            {
                                                agent.InitMutex();
                                            }
                                            agents = Distributed_Landmarks_Detection.Landmarks_Detection(agents, false);
                                            PlanerWeightedLandmarkAndHsp Planner = new PlanerWeightedLandmarkAndHsp(agents);
                                            Console.WriteLine("Planning");
                                            lPlan = Planner.Plan();
                                        }
                                        else
                                        {
                                            if (Program.highLevelPlanerType == Program.HighLevelPlanerType.SophisticatedProjection)
                                            {
                                                bool stop = false;
                                                while (!stop)
                                                {
                                                    stop = true;
                                                    string            name        = "";
                                                    GroundedPredicate currentGoal = null;
                                                    foreach (Agent agent in agents)
                                                    {
                                                        currentGoal = agent.GetGoal();
                                                        if (currentGoal != null)
                                                        {
                                                            stop = false;
                                                            name = agent.name;
                                                            break;
                                                        }
                                                    }
                                                    if (!stop)
                                                    {
                                                        foreach (Agent agent in agents)
                                                        {
                                                            if (!agent.name.Equals(name))
                                                            {
                                                                agent.ReceiveGoal(currentGoal);
                                                            }
                                                        }
                                                    }
                                                }
                                                foreach (Agent agent in agents)
                                                {
                                                    agent.InitMutex();
                                                }
                                                //  agents = AdvancedLandmarkProjectionAgents.CreateProjAgents(agents, lDomains, lProblems);

                                                agents = Distributed_Landmarks_Detection.Landmarks_Detection(agents, false);
                                                PlanerHspAndLandmarks Planner = new PlanerHspAndLandmarks(agents);
                                                Console.WriteLine("Planning");
                                                lPlan = Planner.Plan();
                                            }
                                            else
                                            {
                                                if (Program.highLevelPlanerType == Program.HighLevelPlanerType.PDBMafs)
                                                {
                                                    MapsVertex.pdb = new PatternDatabase(lDomains, lProblems, agents, pdbPath);
                                                    bool stop = false;
                                                    while (!stop)
                                                    {
                                                        stop = true;
                                                        string            name        = "";
                                                        GroundedPredicate currentGoal = null;
                                                        foreach (Agent agent in agents)
                                                        {
                                                            currentGoal = agent.GetGoal();
                                                            if (currentGoal != null)
                                                            {
                                                                stop = false;
                                                                name = agent.name;
                                                                break;
                                                            }
                                                        }
                                                        if (!stop)
                                                        {
                                                            foreach (Agent agent in agents)
                                                            {
                                                                if (!agent.name.Equals(name))
                                                                {
                                                                    agent.ReceiveGoal(currentGoal);
                                                                }
                                                            }
                                                        }
                                                    }
                                                    foreach (Agent agent in agents)
                                                    {
                                                        agent.InitMutex();
                                                    }


                                                    Console.WriteLine("Planning");

                                                    MapsPlanner Planner = new MapsPlanner(agents, lDomains, lProblems);

                                                    Program.StartGrounding = DateTime.Now;
                                                    lPlan = Planner.Plan();
                                                }
                                                else
                                                if (Program.highLevelPlanerType == Program.HighLevelPlanerType.MafsLandmark)
                                                {
                                                    bool stop = false;
                                                    while (!stop)
                                                    {
                                                        stop = true;
                                                        string            name        = "";
                                                        GroundedPredicate currentGoal = null;
                                                        foreach (Agent agent in agents)
                                                        {
                                                            currentGoal = agent.GetGoal();
                                                            if (currentGoal != null)
                                                            {
                                                                stop = false;
                                                                name = agent.name;
                                                                break;
                                                            }
                                                        }
                                                        if (!stop)
                                                        {
                                                            foreach (Agent agent in agents)
                                                            {
                                                                if (!agent.name.Equals(name))
                                                                {
                                                                    agent.ReceiveGoal(currentGoal);
                                                                }
                                                            }
                                                        }
                                                    }
                                                    foreach (Agent agent in agents)
                                                    {
                                                        agent.InitMutex();
                                                    }

                                                    agents = Distributed_Landmarks_Detection.Landmarks_Detection(agents, true);

                                                    Console.WriteLine("Planning");

                                                    MapsPlanner Planner = new MapsPlanner(agents, lDomains, lProblems);

                                                    Program.StartGrounding = DateTime.Now;
                                                    lPlan = Planner.Plan();
                                                }
                                                else
                                                if (Program.highLevelPlanerType == Program.HighLevelPlanerType.Mafsff)
                                                {
                                                    bool stop = false;
                                                    while (!stop)
                                                    {
                                                        stop = true;
                                                        string            name        = "";
                                                        GroundedPredicate currentGoal = null;
                                                        foreach (Agent agent in agents)
                                                        {
                                                            currentGoal = agent.GetGoal();
                                                            if (currentGoal != null)
                                                            {
                                                                stop = false;
                                                                name = agent.name;
                                                                break;
                                                            }
                                                        }
                                                        if (!stop)
                                                        {
                                                            foreach (Agent agent in agents)
                                                            {
                                                                if (!agent.name.Equals(name))
                                                                {
                                                                    agent.ReceiveGoal(currentGoal);
                                                                }
                                                            }
                                                        }
                                                    }
                                                    foreach (Agent agent in agents)
                                                    {
                                                        agent.InitMutex();
                                                    }

                                                    agents = Distributed_Landmarks_Detection.Landmarks_Detection(agents, true);

                                                    Console.WriteLine("Planning");

                                                    MapsPlanner Planner = new MapsPlanner(agents, lDomains, lProblems);

                                                    Program.StartGrounding = DateTime.Now;
                                                    lPlan = Planner.PreferableFFPlan();
                                                }
                                                else
                                                {
                                                    if (Program.highLevelPlanerType == Program.HighLevelPlanerType.ProjectionMafs)
                                                    {
                                                        bool stop = false;
                                                        while (!stop)
                                                        {
                                                            stop = true;
                                                            string            name        = "";
                                                            GroundedPredicate currentGoal = null;
                                                            foreach (Agent agent in agents)
                                                            {
                                                                currentGoal = agent.GetGoal();
                                                                if (currentGoal != null)
                                                                {
                                                                    stop = false;
                                                                    name = agent.name;
                                                                    break;
                                                                }
                                                            }
                                                            if (!stop)
                                                            {
                                                                foreach (Agent agent in agents)
                                                                {
                                                                    if (!agent.name.Equals(name))
                                                                    {
                                                                        agent.ReceiveGoal(currentGoal);
                                                                    }
                                                                }
                                                            }
                                                        }
                                                        foreach (Agent agent in agents)
                                                        {
                                                            agent.InitMutex();
                                                        }

                                                        agents = Distributed_Landmarks_Detection.Landmarks_Detection(agents, true);

                                                        Console.WriteLine("Planning");

                                                        MapsPlanner Planner = new MapsPlanner(agents, lDomains, lProblems);

                                                        Program.StartGrounding = DateTime.Now;

                                                        lPlan = Planner.PreferablePlan();
                                                    }
                                                    else
                                                    if (Program.highLevelPlanerType == Program.HighLevelPlanerType.DistrebutedProjectionMafs)
                                                    {
                                                        bool stop = false;
                                                        while (!stop)
                                                        {
                                                            stop = true;
                                                            string            name        = "";
                                                            GroundedPredicate currentGoal = null;
                                                            foreach (Agent agent in agents)
                                                            {
                                                                currentGoal = agent.GetGoal();
                                                                if (currentGoal != null)
                                                                {
                                                                    stop = false;
                                                                    name = agent.name;
                                                                    break;
                                                                }
                                                            }
                                                            if (!stop)
                                                            {
                                                                foreach (Agent agent in agents)
                                                                {
                                                                    if (!agent.name.Equals(name))
                                                                    {
                                                                        agent.ReceiveGoal(currentGoal);
                                                                    }
                                                                }
                                                            }
                                                        }
                                                        foreach (Agent agent in agents)
                                                        {
                                                            agent.InitMutex();
                                                        }

                                                        agents = Distributed_Landmarks_Detection.Landmarks_Detection(agents, true);

                                                        Console.WriteLine("Planning");

                                                        MapsPlanner Planner = new MapsPlanner(agents, lDomains, lProblems);

                                                        Program.StartGrounding = DateTime.Now;
                                                        lPlan = Planner.DistrebutedPreferablePlan();
                                                    }
                                                    else
                                                    {
                                                        Console.WriteLine("highLevelPlanerType did not selected");
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    RunUtils.KillPlanners();
                    return(null);
                }
            }
            Program.End = DateTime.Now;
            RunUtils.KillPlanners();
            m_agents = agents;
            return(lPlan);
        }
Exemplo n.º 4
0
        public static void ParseAll(DirectoryInfo di, string sOutputPlanFile)
        {
            Program.Start = new DateTime(0);
            Program.StartHighLevelPlanning = new DateTime(0);
            Program.StartGrounding         = new DateTime(0);
            Program.End          = new DateTime(0);
            Program.PlanCost     = -1;
            Program.PlanMakeSpan = -1;

            Console.WriteLine("Scanning directory " + di.Name);
            bool bContainsRealDirectories = false;
            int  cSubs = 0;

            if (di.GetDirectories().Length != 0)
            {
                foreach (DirectoryInfo diSub in di.GetDirectories().OrderBy(d => d.Name.ToString()))
                {
                    if (!diSub.Name.ToLower().Contains("pdb"))
                    {
                        ParseAll(diSub, sOutputPlanFile);
                        bContainsRealDirectories = true;
                        cSubs++;

                        //if (cSubs == 2 && di.Name != "factored")
                        //   return;
                    }
                }
            }
            if (!bContainsRealDirectories)
            {
                if (di.ToString().Contains("PdbFiles"))
                {
                    return;
                }

                if (sOutputPlanFile == "")
                {
                    sOutputPlanFile = "Plan.txt";
                }
                sOutputPlanFile     += "Plan.txt";
                Vertex.agents        = new List <Agent>();
                Vertex.ffLplan       = new List <string>();
                Vertex.map           = new Dictionary <string, int>();
                Vertex.forwardSearch = null;
                Vertex.hsp           = null;

                GC.Collect();


                //ReadAgentFiles(di, sOutputPlanFile);

                Thread t = new Thread(() => ReadAgentFiles(di, sOutputPlanFile));

                t.Name = "ReadAgentFiles " + di.Name;
                t.Start();
                if (t.Join(5 * 60 * 1000))
                {
                }
                else
                {
                    t.Abort();
                    // Program.timeResults.WriteLine("*");
                    //Program.timeResults.Flush();
                    Thread.Sleep(1000);
                    //writing an empty plan file
                    StreamWriter sw = new StreamWriter(sOutputPlanFile + "plan.txt");
                    sw.Close();
                    Program.WriteResults(di.Name, " failed - timeout");
                }

                RunUtils.KillPlanners();
            }
        }
Exemplo n.º 5
0
        public List <string> PdbFFPlan(Domain d, Problem p, State curentState, Formula goal, List <Action> privateActions, int cMaxMilliseconds, out bool bUnsolvable)
        {
            RunUtils.KillPlanners();
            List <string> ffLplan = new List <string>();
            List <string> lPlan   = new List <string>();


            if (privateActions != null)
            {
                d.Actions = privateActions;
            }
            if (goal != null)
            {
                p.Goal = goal;
            }

            MemoryStream msDomain    = d.WriteSimpleDomain();
            MemoryStream problem_M_S = p.WriteSimpleProblem(curentState);


            //StreamWriter swDomainFile = new StreamWriter(@"C:\Dropbox-users\shlomi\Dropbox\Dropbox\privacyPreserving\Competition\all\factored\testd.pddl");
            // StreamReader srDomain = new StreamReader(msDomain);
            // swDomainFile.Write(srDomain.ReadToEnd());
            // swDomainFile.Close();

            // StreamWriter swProblemFile = new StreamWriter(@"C:\Dropbox-users\shlomi\Dropbox\Dropbox\privacyPreserving\Competition\all\factored\testp.pddl");
            //  StreamReader srProblem = new StreamReader(problem_M_S);
            // swProblemFile.Write(srProblem.ReadToEnd());
            // swProblemFile.Close();


            problem_M_S.Position = 0;
            msDomain.Position    = 0;



            Process planer = new Process();

            //planer.StartInfo.WorkingDirectory = @"C:\project\Planning 2 new\PDDLTEST\temp";
            planer.StartInfo.FileName = "ff.exe";
            //planer.StartInfo.Arguments += "-o dT.pddl -f pT.pddl";

            FFOutput[planer.Id] = "";

            planer.StartInfo.UseShellExecute        = false;
            planer.StartInfo.RedirectStandardInput  = true;
            planer.StartInfo.RedirectStandardOutput = true;
            planer.OutputDataReceived += new DataReceivedEventHandler(FFOutputHandler);
            planer.Start();
            planer.BeginOutputReadLine();
            StreamReader srOps = new StreamReader(msDomain);


            string domain = srOps.ReadToEnd();

            planer.StandardInput.Write(domain);
            srOps.Close();
            BinaryWriter b = new BinaryWriter(planer.StandardInput.BaseStream);

            b.Write('\0');

            StreamReader srFct   = new StreamReader(problem_M_S);
            string       problem = srFct.ReadToEnd();

            planer.StandardInput.Write(problem);
            srFct.Close();

            b.Write('\0');
            //planer.StandardInput.Flush();

            planer.StandardInput.Close();

            if (cMaxMilliseconds != -1)
            {
                if (!planer.WaitForExit(cMaxMilliseconds))//2 minutes max
                {
                    planer.Kill();
                    bUnsolvable = false;
                    return(null);
                }
            }
            else
            {
                planer.WaitForExit();
            }
            planer.Close();
            //string sOutput = planer.StandardOutput.ReadToEnd();
            // planer.WaitForExit();
            string sOutput = FFOutput[planer.Id];
            //throw new NotImplementedException();
            //Console.WriteLine(sOutput);
            MemoryStream planMs = new MemoryStream();

            if (sOutput.Contains("found legal plan as follows"))
            {
                string sPlan = sOutput.Substring(sOutput.IndexOf("found legal plan as follows"));
                sPlan = sPlan.Replace("found legal plan as follows", "").Trim();
                string[] asPlan     = sPlan.Split('\n');
                string   sFinalPlan = "";
                for (int i = 0; i < asPlan.Length; i++)
                {
                    if (!asPlan[i].Contains(":"))
                    {
                        break;
                    }
                    if (asPlan[i].Contains("time spent:"))
                    {
                        break;
                    }
                    sFinalPlan += asPlan[i].Substring(asPlan[i].IndexOf(':') + 2).Trim() + "\n";
                }
                StreamWriter sw = new StreamWriter(planMs);
                sw.WriteLine(sFinalPlan);
                sw.Close();
                bUnsolvable = false;
            }
            else
            {
                if (sOutput.Contains("goal can be simplified to TRUE"))
                {
                    ffLplan     = new List <string>();
                    bUnsolvable = false;
                    return(ffLplan);
                }
                else if (sOutput.Contains("goal can be simplified to FALSE"))
                {
                    ffLplan     = null;
                    bUnsolvable = true;
                    return(null);
                }
                else
                {
                    ffLplan     = null;
                    bUnsolvable = false;
                    return(null);
                }
            }


            lPlan   = ReadPlan(new MemoryStream(planMs.ToArray()));
            ffLplan = lPlan;
            return(lPlan);
        }