private void DownPropagate(Goal parent, GoalRefinement refinement) { IList<AlternativeSystem> alternatives_to_add; if (refinement.SystemReference() != null) { var alternatives_to_filter_on = GetAllSubsystems(new HashSet<AlternativeSystem> (), refinement.SystemReference()); alternatives_to_add = new List<AlternativeSystem> (parent.InSystems.Where(r => alternatives_to_filter_on.Contains(r))); } else { alternatives_to_add = new List<AlternativeSystem> (parent.InSystems); } if (refinement.InSystems == null) refinement.InSystems = new HashSet<AlternativeSystem> (); foreach (var a in alternatives_to_add) { refinement.InSystems.Add (a); } foreach (var child in refinement.SubGoals()) { if (child.InSystems == null) child.InSystems = new HashSet<AlternativeSystem> (); foreach (var a in alternatives_to_add) { child.InSystems.Add (a); } DownPropagate (child); } }
public void ExportRefinement(Goal parent, GoalRefinement refinement) { var tempGUID = Guid.NewGuid().ToString(); writer.WriteLine (@"""{0}""[shape=circle,width=.1,fixedsize=true,label=""""];", tempGUID); writer.WriteLine (@"""{0}"" -> ""{1}"" [arrowtail=onormal,label="" {2}""];", parent.Identifier, tempGUID, refinement.SystemReference() != null ? refinement.SystemReference().FriendlyName : string.Empty); foreach (var child in refinement.SubGoals()) { writer.WriteLine (@"""{0}"" -> ""{1}"" [arrowtail=none];", tempGUID, child.Identifier); } foreach (var domprop in refinement.DomainProperties()) { writer.WriteLine (@"""{0}"" -> ""{1}"" [arrowtail=none];", tempGUID, domprop.Identifier); } foreach (var domhyp in refinement.DomainHypotheses()) { writer.WriteLine (@"""{0}"" -> ""{1}"" [arrowtail=none];", tempGUID, domhyp.Identifier); } }
static Node ORPropagate(GoalRefinement r) { return new Or { Nodes = r.SubGoals().Select (GetNonSatisfactionFormula).Union (r.DomainProperties().Select (GetNonSatisfactionFormula)).ToList () }; }
static Node ANDPropagate(GoalRefinement r) { return new And { Nodes = r.SubGoals().Select (GetNonSatisfactionFormula).ToList () }; }
public void Add(GoalRefinement refinement) { Refinements.Add (refinement); }
protected void Render(GoalRefinement refinement) { var circle = GetCircle (); if (refinement.IsComplete) SetFillColor (circle, 0, 0, 0); Add (refinement.Identifier, circle); if (shapes.ContainsKey(refinement.ParentGoalIdentifier)) { var parentGraphic = shapes[refinement.ParentGoalIdentifier].First (); var topArrow = GetFilledArrow (circle, parentGraphic); if (refinement.SystemReferenceIdentifier != null) AddText (topArrow, refinement.SystemReference().FriendlyName); sheet.GraphicsList.Add (topArrow); } foreach (var child in refinement.SubGoalIdentifiers) { if (!shapes.ContainsKey(child)) continue; var childGraphic = shapes [child].First (); var line = GetLine (childGraphic, circle); sheet.GraphicsList.Add (line); } foreach (var child in refinement.DomainPropertyIdentifiers) { if (!shapes.ContainsKey(child)) continue; var childGraphic = shapes [child].First (); var line = GetLine (childGraphic, circle); sheet.GraphicsList.Add (line); } foreach (var child in refinement.PositiveSoftGoalsIdentifiers) { if (!shapes.ContainsKey(child)) continue; var childGraphic = shapes [child].First (); var line = GetFilledArrow (circle, childGraphic, true); AddText (line, @"Positive\par contribution"); sheet.GraphicsList.Add (line); } foreach (var child in refinement.NegativeSoftGoalsIdentifiers) { if (!shapes.ContainsKey(child)) continue; var childGraphic = shapes [child].First (); var line = GetFilledArrow (circle, childGraphic, true); AddText (line, @"Negative\par contribution"); sheet.GraphicsList.Add (line); } }