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); }
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); }
protected OneBitflipMove(OneBitflipMove original, Cloner cloner) : base(original, cloner) { }