예제 #1
0
 private void Update()
 {
     if (Input.GetKeyDown(KeyCode.O) && _inRange)
     {
         if (GetComponent <OpenCondition>())
         {
             _condition = GetComponent <OpenCondition>();
             if (_condition.ConditionsMet())
             {
                 Destroy(_condition);
                 _animator.SetTrigger("Open");
                 ToggleActiveRoom();
             }
             else
             {
                 _condition.ConditionMessage();
             }
         }
         else
         {
             _animator.SetTrigger("Open");
             ToggleActiveRoom();
         }
     }
 }
        public void AddStep(IPlan plan, OpenCondition oc)
        {
            foreach (var cndt in CacheMaps.GetCndts(oc.precondition))
            {
                if (cndt == null)
                {
                    continue;
                }

                var planClone = plan.Clone() as IPlan;

                planClone.ID += "a";

                IPlanStep newStep;
                if (cndt.Height > 0)
                {
                    //continue;
                    var compCndt = cndt as Composite;
                    newStep = new CompositePlanStep(compCndt.Clone() as Composite)
                    {
                        Depth = oc.step.Depth
                    };
                    //planClone.Hdepth += compCndt.SubSteps.Count; // this is done now in beginning of Insert Decomp
                }
                else
                {
                    newStep = new PlanStep(cndt.Clone() as IOperator)
                    {
                        Depth = oc.step.Depth
                    };
                }

                // For debugging
                //planClone.ID += "(" + GroundActionFactory.GroundActions.IndexOf(newStep.Action) + ")";

                planClone.Insert(newStep);
                planClone.Repair(oc, newStep);

                if (oc.isDummyGoal)
                {
                    if (newStep.Height > 0)
                    {
                        var compNewStep = newStep as CompositePlanStep;
                        planClone.Orderings.Insert(oc.step.InitCndt, compNewStep.InitialStep);
                    }
                    else
                    {
                        planClone.Orderings.Insert(oc.step.InitCndt, newStep);
                    }
                }

                planClone.DetectThreats(newStep);
                Insert(planClone);
            }
        }
예제 #3
0
 public new void Repair(OpenCondition oc, IPlanStep repairStep)
 {
     if (repairStep.Height > 0)
     {
         RepairWithComposite(oc, repairStep as CompositeSchedulePlanStep);
     }
     else
     {
         RepairWithPrimitive(oc, repairStep);
     }
 }
예제 #4
0
        public void AddStep(IPlan plan, OpenCondition oc)
        {
            foreach (var cndt in CacheMaps.GetCndts(oc.precondition))
            {
                if (cndt == null)
                {
                    continue;
                }

                var       planClone = plan.Clone() as IPlan;
                IPlanStep newStep;
                if (cndt.Height > 0)
                {
                    //continue;
                    var compCndt = cndt as IComposite;
                    newStep = new CompositePlanStep(compCndt.Clone() as IComposite)
                    {
                        Depth = oc.step.Depth
                    };
                }
                else
                {
                    newStep = new PlanStep(cndt.Clone() as IOperator)
                    {
                        Depth = oc.step.Depth
                    };
                }
                //newStep.Height = cndt.Height;

                planClone.Insert(newStep);
                planClone.Repair(oc, newStep);


                // check if inserting new Step (with orderings given by Repair) add cndts/risks to existing open conditions, affecting their status in the heap
                //planClone.Flaws.UpdateFlaws(planClone, newStep);

                if (oc.isDummyGoal)
                {
                    if (newStep.Height > 0)
                    {
                        var compNewStep = newStep as ICompositePlanStep;
                        planClone.Orderings.Insert(oc.step.InitCndt, compNewStep.InitialStep);
                    }
                    else
                    {
                        planClone.Orderings.Insert(oc.step.InitCndt, newStep);
                    }
                }
                planClone.DetectThreats(newStep);
                Insert(planClone);
            }
        }
예제 #5
0
        public void RepairWithComposite(OpenCondition oc, CompositeSchedulePlanStep repairStep)
        {
            var needStep = Find(oc.step);

            if (!needStep.Name.Equals("DummyGoal") && !needStep.Name.Equals("DummyInit"))
            {
                needStep.Fulfill(oc.precondition);
            }

            // need to merge all steps that are being connected by this predicate:
            if (oc.precondition.Name.Equals("obs-starts"))
            {
                var       stepThatNeedsToBeMerged = oc.precondition.Terms[0];
                IPlanStep ReferencedStep1         = new PlanStep();
                IPlanStep ReferencedStep2         = new PlanStep();
                foreach (var step in Steps)
                {
                    if (step.Action.ID.ToString().Equals(stepThatNeedsToBeMerged))
                    {
                        if (repairStep.SubSteps.Contains(step))
                        {
                            ReferencedStep1 = step;
                        }

                        else
                        {
                            ReferencedStep2 = step;
                        }
                    }
                }
                if (ReferencedStep1.Name.Equals("") || ReferencedStep2.Name.Equals(""))
                {
                    Debug.Log("never found steps to merge");
                    throw new System.Exception();
                }
                if (ReferencedStep1.OpenConditions.Count > ReferencedStep2.OpenConditions.Count)
                {
                    MergeSteps(ReferencedStep1, ReferencedStep2);
                }
                else
                {
                    MergeSteps(ReferencedStep2, ReferencedStep1);
                }
            }

            orderings.Insert(repairStep.GoalStep as IPlanStep, needStep);
            var clink = new CausalLink <IPlanStep>(oc.precondition as Predicate, repairStep.GoalStep as IPlanStep, needStep);

            causalLinks.Add(clink);
        }
예제 #6
0
        public void Reuse(IPlan plan, OpenCondition oc)
        {
            // if repaired by initial state
            if (plan.Initial.InState(oc.precondition))
            {
                var planClone = plan.Clone() as IPlan;
                planClone.Repair(oc, planClone.InitialStep);
                Insert(planClone);
            }

            foreach (var step in plan.Steps)
            {
                if (oc.step.ID == step.ID)
                {
                    continue;
                }

                if (step.Height > 0)
                {
                    continue;
                }

                if (step == oc.step.InitCndt && oc.hasDummyInit)
                {
                    var planClone = plan.Clone() as IPlan;
                    planClone.Repair(oc, step);
                    Insert(planClone);
                    continue;
                }

                //if (step.Effects.Contains(oc.precondition))
                //{
                //    Console.Write("here");
                //}

                if (CacheMaps.IsCndt(oc.precondition, step))
                {
                    // before adding a repair, check if there is a path.
                    if (plan.Orderings.IsPath(oc.step, step))
                    {
                        continue;
                    }

                    var planClone = plan.Clone() as IPlan;
                    planClone.Repair(oc, step);
                    Insert(planClone);
                }
            }
        }
예제 #7
0
        public Gate(Vector2 position, OpenCondition condition = OpenCondition.KEYS) : base(position, new Box(position, new Vector2(16, 16)))
        {
            InitState("Closed");

            AddComponent(new TopDownPhysics(0, 0));

            List <string> newTags = tags;

            newTags.Add("gate");

            _openCondition = condition;

            mapIndex = util.CorrespondingMapIndex(transform.position);

            switch (condition)
            {
            case OpenCondition.KEYS:
                openedCondition = () => { return(keysLeft <= 0); };
                keysLeft        = 1;
                break;

            case OpenCondition.NO_ENEMIES:
                openedCondition = () => {
                    var enemies = GameObjectManager.FindObjectsWithTag("enemy");
                    currentEnemyCount = 0;

                    foreach (var e in enemies)
                    {
                        if (mapIndex == util.CorrespondingMapIndex(e.transform.position))
                        {
                            currentEnemyCount += 1;
                        }
                    }
                    return(currentEnemyCount <= 0);
                };
                newTags.Add("nonpersistent");
                break;

            default:
                openedCondition = () => { return(keysLeft <= 0); };
                keysLeft        = 1;
                break;
            }

            tags = newTags;
        }
        public void AddStep(IPlan plan, OpenCondition oc)
        {
            foreach (var cndt in CacheMaps.GetCndts(oc.precondition))
            {
                var planClone = plan.Clone() as IPlan;
                var newStep   = new PlanStep(cndt.Clone() as IOperator);

                planClone.Insert(newStep);
                planClone.Repair(oc, newStep);

                // Check if inserting new Step (with orderings given by Repair) add cndts/risks to existing open conditions, affecting their status in the heap
                //planClone.Flaws.UpdateFlaws(planClone, newStep);

                // Detect if this new step threatens existing causal links
                planClone.DetectThreats(newStep);

                Insert(planClone);
            }
        }
        public void Reuse(IPlan plan, OpenCondition oc)
        {
            // If repaired by initial state
            if (plan.Initial.InState(oc.precondition))
            {
                var planClone = plan.Clone() as IPlan;
                planClone.Repair(oc, planClone.InitialStep);
                Insert(planClone);
            }

            // For each existing step, check if it is a candidate for repair
            foreach (var step in plan.Steps)
            {
                if (oc.step.ID == step.ID)
                {
                    continue;
                }

                if (CacheMaps.IsCndt(oc.precondition, step))
                {
                    // Before adding a repair, check if there is a path.
                    if (plan.Orderings.IsPath(oc.step, step))
                    {
                        continue;
                    }

                    // Create child plan-space node
                    var planClone = plan.Clone() as IPlan;

                    // Make repair, check if new causal link is threatened
                    planClone.Repair(oc, step);

                    // Insert plan as child on search frontier
                    Insert(planClone);
                }
            }
        }
예제 #10
0
        public new void AddStep(IPlan plan, OpenCondition oc)
        {
            long before = 0;
            var  watch  = System.Diagnostics.Stopwatch.StartNew();

            foreach (var cndt in CacheMaps.GetCndts(oc.precondition))
            {
                if (cndt == null)
                {
                    continue;
                }
                if (cndt.Height == 0)
                {
                    continue;
                }

                before = watch.ElapsedMilliseconds;


                var       planClone = plan.Clone() as PlanSchedule;
                IPlanStep newStep;
                if (cndt.Height > 0)
                {
                    //continue;
                    var compCndt = cndt as CompositeSchedule;
                    newStep = new CompositeSchedulePlanStep(compCndt.Clone() as IComposite, compCndt.Cntgs)
                    {
                        Depth = oc.step.Depth
                    };
                }
                else
                {
                    // only add composite steps...
                    //continue;
                    newStep = new PlanStep(cndt.Clone() as IOperator)
                    {
                        Depth = oc.step.Depth
                    };
                }
                LogTime("CloneCndt", watch.ElapsedMilliseconds - before);



                before = watch.ElapsedMilliseconds;
                planClone.Insert(newStep);
                LogTime("InsertDecomp", watch.ElapsedMilliseconds - before);

                //newStep.Height = cndt.Height;


                // planClone.Insert(newStep);


                before = watch.ElapsedMilliseconds;
                planClone.Repair(oc, newStep);
                LogTime("RepairDecomp", watch.ElapsedMilliseconds - before);

                // check if inserting new Step (with orderings given by Repair) add cndts/risks to existing open conditions, affecting their status in the heap
                //planClone.Flaws.UpdateFlaws(planClone, newStep);

                if (oc.isDummyGoal)
                {
                    if (newStep.Height > 0)
                    {
                        var compNewStep = newStep as CompositeSchedulePlanStep;
                        planClone.Orderings.Insert(oc.step.InitCndt, compNewStep.InitialStep);
                    }
                    else
                    {
                        planClone.Orderings.Insert(oc.step.InitCndt, newStep);
                    }
                }


                before = watch.ElapsedMilliseconds;
                planClone.DetectThreats(newStep);
                LogTime("DetectThreats", watch.ElapsedMilliseconds - before);

                before = watch.ElapsedMilliseconds;
                Insert(planClone);
                LogTime("InsertPlan", watch.ElapsedMilliseconds - before);
            }
        }
예제 #11
0
        public new void AddStep(IPlan plan, OpenCondition oc)
        {
            long before = 0;
            // check oc step depth.

            var watch = System.Diagnostics.Stopwatch.StartNew();

            foreach (var cndt in CacheMaps.GetCndts(oc.precondition))
            {
                if (cndt == null)
                {
                    continue;
                }
                if (cndt.Height == 0)
                {
                    continue;
                }

                before = watch.ElapsedMilliseconds;


                var planClone = plan.Clone() as PlanSchedule;
                //if (planClone.ID.Equals("1335"))
                //{
                //    Console.WriteLine("Here");
                //}

                planClone.ID += "a";
                IPlanStep newStep;
                if (cndt.Height > 0)
                {
                    //continue;
                    var compCndt = cndt as CompositeSchedule;
                    newStep = new CompositeSchedulePlanStep(compCndt.Clone() as CompositeSchedule)
                    {
                        Depth = oc.step.Depth
                    };
                }
                else
                {
                    // only add composite steps...
                    //continue;
                    newStep = new PlanStep(cndt.Clone() as IOperator)
                    {
                        Depth = oc.step.Depth
                    };
                }
                planClone.ID += "(" + GroundActionFactory.GroundActions.IndexOf(newStep.Action) + ")";
                LogTime("CloneCndt", watch.ElapsedMilliseconds - before);



                before = watch.ElapsedMilliseconds;
                planClone.Insert(newStep);
                LogTime("InsertDecomp", watch.ElapsedMilliseconds - before);

                //newStep.Height = cndt.Height;


                // planClone.Insert(newStep);


                before = watch.ElapsedMilliseconds;
                planClone.Repair(oc, newStep);
                LogTime("RepairDecomp", watch.ElapsedMilliseconds - before);

                // check if inserting new Step (with orderings given by Repair) add cndts/risks to existing open conditions, affecting their status in the heap
                //planClone.Flaws.UpdateFlaws(planClone, newStep);

                if (oc.isDummyGoal)
                {
                    if (newStep.Height > 0)
                    {
                        var compNewStep = newStep as CompositeSchedulePlanStep;
                        planClone.Orderings.Insert(oc.step.InitCndt, compNewStep.InitialStep);
                        //planClone.ID +=  string.Format("(^Oa[{0},{1}])", oc.step.InitCndt.ID, compNewStep.InitialStep.ID);
                    }
                    else
                    {
                        planClone.Orderings.Insert(oc.step.InitCndt, newStep);
                        //planClone.ID += string.Format("(^Oa[{0},{1}])", oc.step.InitCndt.ID, newStep.ID);
                    }
                }


                before = watch.ElapsedMilliseconds;
                planClone.DetectThreats(newStep);
                LogTime("DetectThreats", watch.ElapsedMilliseconds - before);

                before = watch.ElapsedMilliseconds;
                Insert(planClone);
                LogTime("InsertPlan", watch.ElapsedMilliseconds - before);
            }
        }
예제 #12
0
        public new void Reuse(IPlan plan, OpenCondition oc)
        {
            // if repaired by initial state
            if (plan.Initial.InState(oc.precondition))
            {
                var planClone = plan.Clone() as IPlan;
                planClone.Repair(oc, planClone.InitialStep);
                planClone.ID += "ri";
                Insert(planClone);
            }

            foreach (var step in plan.Steps)
            {
                if (oc.step.ID == step.ID)
                {
                    continue;
                }

                if (step.Height > 0)
                {
                    if (CacheMaps.IsCndt(oc.precondition, step))
                    {
                        var stepAsComposite = step as CompositeSchedulePlanStep;

                        if (stepAsComposite.SubSteps.Contains(oc.step))
                        {
                            continue;
                        }
                        // before adding a repair, check if there is a path.
                        if (plan.Orderings.IsPath(oc.step, stepAsComposite.GoalStep))
                        {
                            continue;
                        }

                        if (plan.Orderings.IsPath(oc.step, stepAsComposite.InitialStep))
                        {
                            continue;
                        }

                        var planClone = plan.Clone() as IPlan;
                        //if (planClone.ID.Equals("1335a"))
                        //{
                        //    Console.WriteLine("Here");
                        //}
                        // need to modify stepAsComposite, so going to rereference on cloned plan.
                        var stepAsCompositeClone = planClone.Steps.First(s => s.ID == stepAsComposite.ID) as CompositeSchedulePlanStep;
                        planClone.Repair(oc, stepAsCompositeClone);
                        planClone.ID += "r";
                        Insert(planClone);
                    }
                    continue;
                }
                else
                {
                    if (step == oc.step.InitCndt && oc.hasDummyInit)
                    {
                        var planClone = plan.Clone() as IPlan;
                        planClone.Repair(oc, step);
                        planClone.ID += "r_";
                        Insert(planClone);
                        continue;
                    }

                    if (CacheMaps.IsCndt(oc.precondition, step))
                    {
                        // before adding a repair, check if there is a path.
                        if (plan.Orderings.IsPath(oc.step, step))
                        {
                            continue;
                        }

                        var planClone = plan.Clone() as IPlan;
                        planClone.Repair(oc, step);
                        planClone.ID += "r";
                        Insert(planClone);
                    }
                }
            }
        }
예제 #13
0
        public void Reuse(IPlan plan, OpenCondition oc)
        {
            // If repaired by initial state


            var  index = plan.Steps.IndexOf(oc.step);
            bool found = false;

            for (int ind = index; ind >= 0; ind--)
            {
                if (plan.Steps[ind].Effects.Contains(oc.precondition))
                {
                    // Create child plan-space node
                    var planClone = plan.Clone() as IPlan;

                    // Make repair, check if new causal link is threatened
                    planClone.Repair(oc, plan.Steps[ind]);

                    // Insert plan as child on search frontier
                    Insert(planClone);
                    found = true;
                    break;
                }
            }
            if (!found)
            {
                var planClone = plan.Clone() as IPlan;
                planClone.Repair(oc, planClone.InitialStep);
                Insert(planClone);
                //if (plan.Initial.InState(oc.precondition))
                //{
                //    var planClone = plan.Clone() as IPlan;
                //    planClone.Repair(oc, planClone.InitialStep);
                //    Insert(planClone);

                //}
                //else
                //{
                //    throw new System.Exception();
                //}
            }

            //// For each existing step, check if it is a candidate for repair
            //foreach (var step in plan.Steps)
            //{
            //    if (oc.step.ID == step.ID)
            //    {
            //        continue;
            //    }

            //    if (step.Effects.Contains(oc.precondition)){

            //        // Before adding a repair, check if there is a path.
            //        if (plan.Orderings.IsPath(oc.step, step))
            //            continue;

            //        // Create child plan-space node
            //        var planClone = plan.Clone() as IPlan;

            //        // Make repair, check if new causal link is threatened
            //        planClone.Repair(oc, step);

            //        // Insert plan as child on search frontier
            //        Insert(planClone);
            //    }
            //}
        }
예제 #14
0
        public void RepairWithComposite(OpenCondition oc, CompositeSchedulePlanStep repairStep)
        {
            var needStep = Find(oc.step);

            if (!needStep.Name.Equals("DummyGoal") && !needStep.Name.Equals("DummyInit"))
            {
                needStep.Fulfill(oc.precondition);
            }


            // need to merge all steps that are being connected by this predicate:
            if (oc.precondition.Name.Equals("obs-starts"))
            //if (oc.precondition is ContextPredicate cxtp)
            {
                this.ID += "s";
                //var repairEff = repairStep.Effects.Where(e => cxtp.Equals(oc.precondition)).First() ;
                RepairWithMerge(oc.precondition, needStep, repairStep);
                var otherflawsFromSameNeedStep = this.flaws.OpenConditions.Where(openC => openC.step.ID == oc.step.ID).ToList();
                foreach (var otherFlaw in otherflawsFromSameNeedStep)
                {
                    if (CacheMaps.IsCndt(otherFlaw.precondition, repairStep))
                    {
                        // Remove this flaw, because it would have been satisfied by this repair step. SHOULD produce new plan for each decision.
                        this.flaws.OpenConditions.Remove(otherFlaw);
                    }
                }
                return;
            }
            //if (oc.precondition.Name.Equals("obs-starts"))
            //{
            //    Console.WriteLine("obs-starts");

            //}

            orderings.Insert(repairStep.GoalStep as IPlanStep, needStep);
            //this.ID += string.Format("(^Orl[{0},{1}])", repairStep.GoalStep.ID, needStep.ID);

            var clink = new CausalLink <IPlanStep>(oc.precondition as Predicate, repairStep.GoalStep as IPlanStep, needStep);

            causalLinks.Add(clink);


            foreach (var step in Steps)
            {
                if (step.ID == repairStep.ID || step.ID == needStep.ID)
                {
                    continue;
                }
                if (!CacheMaps.IsThreat(oc.precondition, step))
                {
                    continue;
                }

                if (step.Height > 0)
                {
                    // we need to check that this step's goal step
                    var stepAsComp = step as CompositeSchedulePlanStep;


                    if (DeLinks.OnDecompPath(clink.Head, step.ID))
                    {
                        // must be ordered within
                        if (Orderings.IsPath(clink.Tail, stepAsComp.GoalStep))
                        {
                            // already tucked into Q's borders
                            continue;
                        }

                        if (!DeLinks.OnDecompPath(clink.Tail, step.ID))
                        {
                            // Special Case is when clink.Tail is goal step. Then we cannot tuck clink.Tail into borders.
                            if (clink.Tail.Equals(goalStep))
                            {
                                // We want to end this plan's existence, so we add a threat that cannot be resolved.
                                Flaws.Add(new ThreatenedLinkFlaw(clink, step));
                                continue;
                            }
                            // Q --> s -p-> t, not p in eff(Q), not Q --> t
                            // then, need to tuck t into Q's borders.

                            var tailRoot = GetStepByID(DeLinks.GetRoot(clink.Tail)) as CompositePlanStep;
                            Orderings.Insert(tailRoot.GoalStep, stepAsComp.InitialStep);
                            //this.ID += string.Format("(^Od[{0},{1}])", tailRoot.GoalStep.ID, stepAsComp.InitialStep.ID);
                        }

                        continue;
                    }

                    if (DeLinks.OnDecompPath(clink.Tail, step.ID))
                    {
                        // step cannot threaten
                        continue;
                    }


                    // step is a threat to need precondition
                    if (Orderings.IsPath(clink.Tail, stepAsComp.InitialStep))
                    {
                        continue;
                    }
                    if (Orderings.IsPath(stepAsComp.GoalStep, repairStep.InitialStep as IPlanStep))
                    {
                        continue;
                    }


                    Flaws.Add(new ThreatenedLinkFlaw(clink, stepAsComp));
                    // Flaws.Add(new ThreatenedLinkFlaw(clink, compInit));
                }

                else
                {
                    // is it possible that step is a sub-step of repair step? Yes it is.
                    if (DeLinks.OnDecompPath(step, repairStep.ID))
                    {
                        // but, there's nothing we can do about it; and all links to repairStep.GoalStep are there to be threatened
                        continue;
                    }

                    // step is a threat to need precondition
                    if (Orderings.IsPath(needStep, step))
                    {
                        continue;
                    }
                    if (Orderings.IsPath(step, repairStep.InitialStep as IPlanStep))
                    {
                        continue;
                    }

                    Flaws.Add(new ThreatenedLinkFlaw(clink, step));
                }
            }
        }
        public void Reuse(IPlan plan, OpenCondition oc)
        {
            // if repaired by initial state
            if (plan.Initial.InState(oc.precondition))
            {
                var planClone = plan.Clone() as IPlan;
                planClone.Repair(oc, planClone.InitialStep);
                planClone.ID += "ri";
                Insert(planClone);
            }

            foreach (var step in plan.Steps)
            {
                if (oc.step.ID == step.ID)
                {
                    continue;
                }

                if (step.Height > 0)
                {
                    if (CacheMaps.IsCndt(oc.precondition, step))
                    {
                        var stepAsComposite = step as CompositePlanStep;



                        if (stepAsComposite.SubSteps.Contains(oc.step) || stepAsComposite.GoalStep.ID == oc.step.ID)
                        {
                            continue;
                        }
                        // before adding a repair, check if there is a path.
                        if (plan.Orderings.IsPath(oc.step, stepAsComposite.GoalStep))
                        {
                            continue;
                        }

                        if (plan.Orderings.IsPath(oc.step, stepAsComposite.InitialStep))
                        {
                            continue;
                        }


                        var planClone            = plan.Clone() as IPlan;
                        var stepAsCompositeClone = planClone.Steps.First(s => s.ID == stepAsComposite.ID) as CompositePlanStep;

                        planClone.Repair(oc, stepAsCompositeClone);
                        planClone.ID += "rc";
                        Insert(planClone);
                    }
                    continue;
                }
                else
                {
                    if (step == oc.step.InitCndt && oc.hasDummyInit)
                    {
                        var planClone = plan.Clone() as IPlan;
                        planClone.Repair(oc, step);
                        planClone.ID += "r_";
                        Insert(planClone);
                        continue;
                    }

                    if (CacheMaps.IsCndt(oc.precondition, step))
                    {
                        // before adding a repair, check if there is a path.
                        if (plan.Orderings.IsPath(oc.step, step))
                        {
                            continue;
                        }

                        var planClone = plan.Clone() as IPlan;
                        planClone.Repair(oc, step);
                        planClone.ID += "rp";
                        Insert(planClone);
                    }
                }
            }
        }