예제 #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());
        }
 public static OneBitflipMove[] Apply(BinaryVector binaryVector, IRandom random, int sampleSize) {
   OneBitflipMove[] moves = new OneBitflipMove[sampleSize];
   for (int i = 0; i < sampleSize; i++) {
     moves[i] = StochasticOneBitflipSingleMoveGenerator.Apply(binaryVector, random);
   }
   return moves;
 }
    public static OneBitflipMove[] Apply(BinaryVector binaryVector) {
      int length = binaryVector.Length;
      int totalMoves = length;
      OneBitflipMove[] moves = new OneBitflipMove[totalMoves];
      for (int i = 0; i < length; i++)
        moves[i] = new OneBitflipMove(i);

      return moves;
    }
 public static OneBitflipMove[] Apply(BinaryVector binaryVector, IRandom random, int sampleSize)
 {
     OneBitflipMove[] moves = new OneBitflipMove[sampleSize];
     for (int i = 0; i < sampleSize; i++)
     {
         moves[i] = StochasticOneBitflipSingleMoveGenerator.Apply(binaryVector, random);
     }
     return(moves);
 }
예제 #5
0
        public override IOperation Apply()
        {
            OneBitflipMove move         = OneBitflipMoveParameter.ActualValue;
            BinaryVector   binaryVector = BinaryVectorParameter.ActualValue;
            DoubleValue    moveQuality  = MoveQualityParameter.ActualValue;
            DoubleValue    quality      = QualityParameter.ActualValue;

            binaryVector[move.Index] = !binaryVector[move.Index];

            quality.Value = moveQuality.Value;

            return(base.Apply());
        }
        public static OneBitflipMove[] Apply(BinaryVector binaryVector)
        {
            int length     = binaryVector.Length;
            int totalMoves = length;

            OneBitflipMove[] moves = new OneBitflipMove[totalMoves];
            for (int i = 0; i < length; i++)
            {
                moves[i] = new OneBitflipMove(i);
            }

            return(moves);
        }
예제 #7
0
 protected OneBitflipMove(OneBitflipMove original, Cloner cloner) : base(original, cloner)
 {
 }
예제 #8
0
 protected OneBitflipMove(OneBitflipMove original, Cloner cloner) : base(original, cloner) { }