// // Problems are equal only if the givens and goals are the same // public override bool Equals(object obj) { MultiGoalProblem <A> thatProblem = obj as MultiGoalProblem <A>; if (thatProblem == null) { return(false); } if (this.givens.Count != thatProblem.givens.Count) { return(false); } if (this.goals.Count != thatProblem.goals.Count) { return(false); } // Union the sets; if the union is the same size as the original, they are the same List <int> union = new List <int>(this.givens); Utilities.AddUniqueList <int>(union, thatProblem.givens); if (union.Count != this.givens.Count) { return(false); } union = new List <int>(this.goals); Utilities.AddUniqueList <int>(union, thatProblem.goals); if (union.Count != this.goals.Count) { return(false); } return(true); }
// // Problems are equal only if the givens and goals are the same // public bool HasSameGivensGoals(MultiGoalProblem <A> thatProblem) { if (this.givens.Count != thatProblem.givens.Count) { return(false); } if (this.goals.Count != thatProblem.goals.Count) { return(false); } if (!Utilities.EqualSets <int>(this.givens, thatProblem.givens)) { return(false); } if (!Utilities.EqualSets <int>(this.goals, thatProblem.goals)) { return(false); } return(true); }
public MultiGoalProblem(MultiGoalProblem <A> thatProblem) { givens = new List <int>(thatProblem.givens); goals = new List <int>(thatProblem.goals); problems = new List <Problem <A> >(thatProblem.problems); }