Class AcceptNewRemoveFirst

java.lang.Object
com.graphhopper.jsprit.core.algorithm.acceptor.AcceptNewRemoveFirst
All Implemented Interfaces:
SolutionAcceptor

public class AcceptNewRemoveFirst extends Object implements SolutionAcceptor
Created by schroeder on 09/02/16.
  • Constructor Details

    • AcceptNewRemoveFirst

      public AcceptNewRemoveFirst(int solutionMemory)
  • Method Details

    • acceptSolution

      public boolean acceptSolution(Collection<VehicleRoutingProblemSolution> solutions, VehicleRoutingProblemSolution newSolution)
      Accepts every solution if solution memory allows. If memory occupied, than accepts new solution only if better than the worst in memory. Consequently, the worst solution is removed from solutions, and the new solution added.

      Note that this modifies Collection solutions.

      Specified by:
      acceptSolution in interface SolutionAcceptor
      Parameters:
      solutions - collection of existing solutions
      newSolution - new solution to be evaluated
      Returns:
      true if solution accepted
    • toString

      public String toString()
      Overrides:
      toString in class Object