public static void Apply(AlbaEncoding solution, AlbaLambdaInterchangeMove move) { AlbaLambdaInterchangeManipulator.Apply( solution, move.Tour1, move.Position1, move.Length1, move.Tour2, move.Position2, move.Length2); }
public static void Apply(AlbaEncoding solution, int maxIterations, int lambda, int samples, IRandom random, IVRPProblemInstance problemInstance, ref double quality, out int evaluatedSolutions) { evaluatedSolutions = 0; for (int i = 0; i < maxIterations; i++) { AlbaLambdaInterchangeMove bestMove = null; foreach (AlbaLambdaInterchangeMove move in AlbaStochasticLambdaInterchangeMultiMoveGenerator.GenerateAllMoves(solution, problemInstance, lambda, samples, random)) { AlbaEncoding newSolution = solution.Clone() as AlbaEncoding; AlbaLambdaInterchangeMoveMaker.Apply(newSolution, move); double moveQuality = problemInstance.Evaluate(newSolution).Quality; evaluatedSolutions++; if (moveQuality < quality || quality == -1) { quality = moveQuality; bestMove = move; } } if (bestMove != null) { AlbaLambdaInterchangeMoveMaker.Apply(solution, bestMove); } } }
protected override void PerformMove() { AlbaLambdaInterchangeMove move = LambdaInterchangeMoveParameter.ActualValue; Apply(move.Individual as AlbaEncoding, move); VRPToursParameter.ActualValue = move.Individual; }
public static AlbaLambdaInterchangeMove[] GenerateAllMoves(AlbaEncoding individual, IVRPProblemInstance problemInstance, int lambda, int sampleSize, IRandom rand) { AlbaLambdaInterchangeMove[] moves = new AlbaLambdaInterchangeMove[sampleSize]; for (int i = 0; i < sampleSize; i++) { moves[i] = AlbaStochasticLambdaInterchangeSingleMoveGenerator.Apply( individual, problemInstance.Cities.Value, lambda, rand); } return moves; }
public static AlbaLambdaInterchangeMove[] GenerateAllMoves(AlbaEncoding individual, IVRPProblemInstance problemInstance, int lambda, int sampleSize, IRandom rand) { AlbaLambdaInterchangeMove[] moves = new AlbaLambdaInterchangeMove[sampleSize]; for (int i = 0; i < sampleSize; i++) { moves[i] = AlbaStochasticLambdaInterchangeSingleMoveGenerator.Apply( individual, problemInstance.Cities.Value, lambda, rand); } return(moves); }
protected override AlbaLambdaInterchangeMove[] GenerateMoves(AlbaEncoding individual, IVRPProblemInstance problemInstance, int lambda) { List <AlbaLambdaInterchangeMove> moves = new List <AlbaLambdaInterchangeMove>(); AlbaLambdaInterchangeMove move = Apply(individual, problemInstance.Cities.Value, lambda, RandomParameter.ActualValue); if (move != null) { moves.Add(move); } return(moves.ToArray()); }
protected AlbaLambdaInterchangeMove(AlbaLambdaInterchangeMove original, Cloner cloner) : base(original, cloner) { this.Tour1 = original.Tour1; this.Position1 = original.Position1; this.Length1 = original.Length1; this.Tour2 = original.Tour2; this.Position2 = original.Position2; this.Length2 = original.Length2; this.Individual = cloner.Clone(Individual) as AlbaEncoding; }