protected void OnSolutionUpdated(BaseSolution <T> solution, int step) { if (SolutionUpdated != null) { SolutionUpdated(solution, step); } }
public override double GetDistanceSq2(BaseSolution <double> rhs) { if (this.mValues == null) { return(double.MaxValue); } if (rhs.Values == null) { return(double.MaxValue); } if (rhs.Values.Length != this.mValues.Length) { return(double.MaxValue); } double distanceSq = 0; for (int i = 0; i < this.Length; ++i) { distanceSq += System.Math.Pow((mValues[i] - rhs[i]), 2); } return(distanceSq); }
protected void OnStepped(BaseSolution <T> solution, int step) { if (Stepped != null) { Stepped(solution, step); } }
public override bool Equals(object obj) { if (obj is BaseSolution <double> ) { BaseSolution <double> cast_obj = obj as BaseSolution <double>; int length1 = this.Length; int length2 = cast_obj.Length; if (length1 == length2) { for (int i = 0; i < length1; ++i) { if (this[i] != cast_obj[i]) { return(false); } } return(true); } } return(false); }
public virtual double GetDistanceSq2(BaseSolution <T> rhs) { throw new NotImplementedException(); }
public bool IsBetterThan(BaseSolution <T> rhs) { return(mCost < rhs.Cost); }
public virtual double GetDistance2(BaseSolution <T> rhs) { return(System.Math.Sqrt(GetDistanceSq2(rhs))); }