//! From <ComputationData> public override int comapareTo(ComputationData other, Func <ComputationData, int> criteria) { if (other.Tag == Tag) // TAGNEIGHBORHOOD { int ranking_this = Size; int ranking_other = ((Neighborhood)other).Size; int difference = ranking_this - ranking_other; return((difference == 0) ? 0 : difference / Math.Abs(difference)); } else { throw new Exception("(POSL Exception) Not compearing allowed (Neighborhood::comapareTo)"); } }
//std::shared_ptr<FactoryPacker> DecisionPair::BuildPacker(){ return std::make_shared<FactoryDecisionPairPacker>(shared_from_this()); } //! From <ComputationData> public override int comapareTo(ComputationData other, Func <ComputationData, int> criteria) { if (other.Tag == this.Tag) { int ranking_this = criteria(found); int ranking_other = criteria(((DecisionPair)other).GetFound); int difference = ranking_this - ranking_other; return((difference == 0) ? 0 : difference / Math.Abs(difference)); } else { throw new Exception("(POSL Exception) Not compearing allowed (DecisionPair::comapareTo)"); } }
//shared_ptr<FactoryPacker> Solution::BuildPacker(){ return make_shared<FactorySolutionPacker>(shared_from_this()); } //! From <ComputationData> public override int comapareTo(ComputationData other, Func <ComputationData, int> criteria) { if (other.Tag == Tag) // TAGSOLUTION { int ranking_this = criteria(this); int ranking_other = criteria((Solution)other); int difference = ranking_this - ranking_other; return((difference == 0) ? 0 : difference / Math.Abs(difference)); } else { throw new Exception("(POSL Exception) Not compearing allowed (Solution::comapareTo)"); } }
//! Compare this object with other, given a function (criteria) /*! * \param other The ComputationData to compare with. * \param criteria A function (criteria). * \return -1 if THIS is lower, 1 if THIS is bigger, 0 if equals */ public abstract int comapareTo(ComputationData other, Func <ComputationData, int> criteria);