예제 #1
0
        public override IOperation Apply()
        {
            ItemList <IItem> tabuList      = TabuListParameter.ActualValue;
            OneBitflipMove   move          = OneBitflipMoveParameter.ActualValue;
            double           moveQuality   = MoveQualityParameter.ActualValue.Value;
            bool             maximization  = MaximizationParameter.ActualValue.Value;
            bool             useAspiration = UseAspirationCriterion.Value;
            bool             isTabu        = false;

            foreach (IItem tabuMove in tabuList)
            {
                OneBitflipMoveAttribute attribute = (tabuMove as OneBitflipMoveAttribute);
                if (attribute != null)
                {
                    if (!useAspiration ||
                        maximization && moveQuality <= attribute.MoveQuality ||
                        !maximization && moveQuality >= attribute.MoveQuality)
                    {
                        if (attribute.Index == move.Index)
                        {
                            isTabu = true;
                            break;
                        }
                    }
                }
            }
            MoveTabuParameter.ActualValue = new BoolValue(isTabu);
            return(base.Apply());
        }
 protected OneBitflipMoveAttribute(OneBitflipMoveAttribute original, Cloner cloner)
     : base(original, cloner)
 {
     this.MoveQuality = original.MoveQuality;
     this.Index       = original.Index;
 }
 protected OneBitflipMoveAttribute(OneBitflipMoveAttribute original, Cloner cloner)
   : base(original, cloner) {
   this.MoveQuality = original.MoveQuality;
   this.Index = original.Index;
 }