コード例 #1
0
 protected Swap2MoveAbsoluteAttribute(Swap2MoveAbsoluteAttribute original, Cloner cloner)
   : base(original, cloner) {
   this.Index1 = original.Index1;
   this.Number1 = original.Number1;
   this.Index2 = original.Index2;
   this.Number2 = original.Number2;
 }
コード例 #2
0
        private bool EvaluateAbsoluteTabuState(ItemList <IItem> tabuList, Swap2Move move, Permutation permutation, double moveQuality, bool maximization, bool useAspiration)
        {
            bool isTabu = false;

            foreach (IItem tabuMove in tabuList)
            {
                Swap2MoveAbsoluteAttribute attrib = (tabuMove as Swap2MoveAbsoluteAttribute);
                if (attrib != null &&
                    (!useAspiration ||
                     maximization && moveQuality <= attrib.MoveQuality ||
                     !maximization && moveQuality >= attrib.MoveQuality))
                {
                    int i1 = move.Index1;
                    int n1 = permutation[move.Index1];
                    int i2 = move.Index2;
                    int n2 = permutation[move.Index2];
                    if ((attrib.Index1 == i1 || attrib.Index1 == i2) && (attrib.Number1 == n1 || attrib.Number1 == n2) ||
                        (attrib.Index2 == i2 || attrib.Index2 == i1) && (attrib.Number2 == n2 || attrib.Number2 == n1))
                    {
                        isTabu = true;
                    }
                }
                if (isTabu)
                {
                    break;
                }
            }
            return(isTabu);
        }
コード例 #3
0
 protected Swap2MoveAbsoluteAttribute(Swap2MoveAbsoluteAttribute original, Cloner cloner)
     : base(original, cloner)
 {
     this.Index1  = original.Index1;
     this.Number1 = original.Number1;
     this.Index2  = original.Index2;
     this.Number2 = original.Number2;
 }