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);
                }
            }
        }
Exemplo n.º 2
0
 private AlbaStochasticLambdaInterchangeMultiMoveGenerator(AlbaStochasticLambdaInterchangeMultiMoveGenerator original, Cloner cloner)
     : base(original, cloner)
 {
 }
 private AlbaStochasticLambdaInterchangeMultiMoveGenerator(AlbaStochasticLambdaInterchangeMultiMoveGenerator original, Cloner cloner)
   : base(original, cloner) {
 }