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); } }
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); } }
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 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); } }
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); } }