Exemplo n.º 1
0
 public Plan(Operator _initial, Operator _goal)
 {
     steps       = new List <IPlanStep>();
     causalLinks = new List <CausalLink <IPlanStep> >();
     orderings   = new Graph <IPlanStep>();
     flaws       = new Flawque();
     initial     = new State(_initial.Effects);
     goal        = new State(_goal.Preconditions);
     initialStep = new PlanStep(_initial);
     goalStep    = new PlanStep(_goal);
 }
Exemplo n.º 2
0
 public Plan(IState _initial, IState _goal)
 {
     steps       = new List <IPlanStep>();
     causalLinks = new List <CausalLink <IPlanStep> >();
     orderings   = new Graph <IPlanStep>();
     flaws       = new Flawque();
     initial     = _initial;
     goal        = _goal;
     initialStep = new PlanStep(new Operator("initial", new List <IPredicate>(), initial.Predicates));
     goalStep    = new PlanStep(new Operator("goal", goal.Predicates, new List <IPredicate>()));
 }
Exemplo n.º 3
0
 // Used when cloning a plan: <S, O, L>, F
 public Plan(List <IPlanStep> steps, IState initial, IState goal, IPlanStep initialStep, IPlanStep goalStep, Graph <IPlanStep> orderings, List <CausalLink <IPlanStep> > causalLinks, Flawque flaws)
 {
     this.steps       = steps;
     this.causalLinks = causalLinks;
     this.orderings   = orderings;
     this.flaws       = flaws;
     this.initial     = initial;
     this.goal        = goal;
     this.initialStep = initialStep;
     this.goalStep    = goalStep;
 }
Exemplo n.º 4
0
 // Used when cloning a plan: <S, O, L>, F
 public Plan(List <IPlanStep> steps, IState initial, IState goal, IPlanStep initialStep, IPlanStep goalStep, Graph <IPlanStep> orderings, List <CausalLink <IPlanStep> > causalLinks, Flawque flaws)
 {
     this.steps       = steps;
     this.causalLinks = causalLinks;
     this.orderings   = orderings;
     this.flaws       = flaws;
     this.initial     = initial;
     this.goal        = goal;
     this.initialStep = initialStep;
     this.goalStep    = goalStep;
     id = System.Threading.Interlocked.Increment(ref Counter).ToString();
 }
Exemplo n.º 5
0
 public Plan(Operator _initial, Operator _goal)
 {
     steps       = new List <IPlanStep>();
     causalLinks = new List <CausalLink <IPlanStep> >();
     orderings   = new Graph <IPlanStep>();
     flaws       = new Flawque();
     initial     = new State(_initial.Effects);
     goal        = new State(_goal.Preconditions);
     initialStep = new PlanStep(_initial);
     goalStep    = new PlanStep(_goal);
     id          = System.Threading.Interlocked.Increment(ref Counter).ToString();
 }
Exemplo n.º 6
0
 public Plan(IState _initial, IState _goal)
 {
     steps       = new List <IPlanStep>();
     causalLinks = new List <CausalLink <IPlanStep> >();
     orderings   = new Graph <IPlanStep>();
     flaws       = new Flawque();
     initial     = _initial;
     goal        = _goal;
     initialStep = new PlanStep(new Operator("initial", new List <IPredicate>(), initial.Predicates));
     goalStep    = new PlanStep(new Operator("goal", goal.Predicates, new List <IPredicate>()));
     id          = System.Threading.Interlocked.Increment(ref Counter).ToString();
 }
Exemplo n.º 7
0
        public Plan()
        {
            // S
            steps = new List <IPlanStep>();
            // O
            orderings = new Graph <IPlanStep>();
            // L
            causalLinks = new List <CausalLink <IPlanStep> >();

            flaws       = new Flawque();
            initial     = new State();
            goal        = new State();
            initialStep = new PlanStep(new Operator("initial", new List <IPredicate>(), initial.Predicates));
            goalStep    = new PlanStep(new Operator("goal", goal.Predicates, new List <IPredicate>()));
        }
Exemplo n.º 8
0
        // Creates a clone of the plan. (orderings, and Links are Read-only, so only their host containers are replaced)
        public Object Clone()
        {
            List <IPlanStep> newSteps = new List <IPlanStep>();

            foreach (var step in steps)
            {
                // need clone because these have fulfilled conditions that are mutable.
                newSteps.Add(step.Clone() as IPlanStep);
            }

            // these are static read only things
            //IState newInitial = initial.Clone() as IState;
            //IState newGoal = goal.Clone() as IState;


            IPlanStep newInitialStep = initialStep.Clone() as IPlanStep;
            // need clone of goal step because this as fulfillable conditions
            IPlanStep newGoalStep = goalStep.Clone() as IPlanStep;

            // Assuming for now that members of the ordering graph are never mutated.  If they are, then a clone will keep references to mutated members
            Graph <IPlanStep> newOrderings = orderings.Clone() as Graph <IPlanStep>;

            // Causal Links are containers whose members are not mutated.
            List <CausalLink <IPlanStep> > newLinks = new List <CausalLink <IPlanStep> >();

            foreach (var cl in causalLinks)
            {
                newLinks.Add(cl as CausalLink <IPlanStep>);
                //newLinks.Add(cl.Clone() as CausalLink<IPlanStep>);
            }

            // Inherit all flaws, must clone very flaw
            Flawque flawList = flaws.Clone() as Flawque;

            //return new Plan(newSteps, newInitial, newGoal, newInitialStep, newGoalStep, newOrderings, newLinks, flawList);
            var p = new Plan(newSteps, Initial, Goal, newInitialStep, newGoalStep, newOrderings, newLinks, flawList)
            {
                Hdepth  = hdepth,
                Decomps = decomps
            };

            p.id = id + p.id;
            return(p);
        }
Exemplo n.º 9
0
 public Plan()
 {
     // S
     steps = new List <IPlanStep>();
     // O
     orderings = new Graph <IPlanStep>();
     // L
     causalLinks = new List <CausalLink <IPlanStep> >();
     // D
     decomplinks = new DecompositionLinks();
     // F
     flaws = new Flawque();
     // I
     initial = new State();
     // G
     goal = new State();
     // d_i
     initialStep = new PlanStep(new Operator("initial", new List <IPredicate>(), initial.Predicates));
     // d_g
     goalStep = new PlanStep(new Operator("goal", goal.Predicates, new List <IPredicate>()));
     id       = System.Threading.Interlocked.Increment(ref Counter).ToString();
 }