Package jsprit.core.algorithm.selector

Examples of jsprit.core.algorithm.selector.SelectBest


      SelectRandomly selector = SelectRandomly.getInstance();
      definedSelectors.put(selectorKey, selector);
      return selector;
    }
    if(selectorName.equals("selectBest")){
      SelectBest selector = SelectBest.getInstance();
      definedSelectors.put(selectorKey, selector);
      return selector;
    }
    throw new IllegalStateException("solutionSelector is not know. Currently, it only knows \"selectRandomly\" and \"selectBest\"");
  }
View Full Code Here


    Collection<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();

    /*
     * Retrieve best solution.
     */
    VehicleRoutingProblemSolution solution = new SelectBest().selectSolution(solutions);

    /*
     * print solution
     */
    SolutionPrinter.print(vrp,solution, SolutionPrinter.Print.VERBOSE);
View Full Code Here

    Collection<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();
   
    /*
     * Retrieve best solution.
     */
    VehicleRoutingProblemSolution solution = new SelectBest().selectSolution(solutions);
   
    /*
     * print solution
     */
    SolutionPrinter.print(solution);
 
View Full Code Here

    Collection<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();
   
    /*
     * Retrieve best solution.
     */
    VehicleRoutingProblemSolution solution = new SelectBest().selectSolution(solutions);


    /*
     * print solution
     */
 
View Full Code Here

    Collection<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();
   
    /*
     * Retrieve best solution.
     */
    VehicleRoutingProblemSolution solution = new SelectBest().selectSolution(solutions);
   
    /*
     * print solution
     */
    SolutionPrinter.print(solution);
 
View Full Code Here

    Collection<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();
   
    /*
     * Retrieve best solution.
     */
    VehicleRoutingProblemSolution solution = new SelectBest().selectSolution(solutions);
   
    /*
     * print solution
     */
    SolutionPrinter.print(solution);
 
View Full Code Here

     * but before define how a generated solution is evaluated
     * here: the VariablePlusFixed.... comes out of the box and it does what its name suggests
     */
    SolutionCostCalculator solutionCostCalculator = new VariablePlusFixedSolutionCostCalculatorFactory(stateManager).createCalculator();
   
    SearchStrategy firstStrategy = new SearchStrategy(new SelectBest(), new GreedyAcceptance(1), solutionCostCalculator);
    firstStrategy.addModule(new RuinAndRecreateModule("randomRuinAndBestInsertion", iStrategy, randomRuin));
   
    SearchStrategy secondStrategy = new SearchStrategy(new SelectBest(), new GreedyAcceptance(1), solutionCostCalculator);
    secondStrategy.addModule(new RuinAndRecreateModule("radialRuinAndBestInsertion", iStrategy, radialRuin));
   
    /*
     * put both strategies together, each with the prob of 0.5 to be selected
     */
 
View Full Code Here

    Collection<VehicleRoutingProblemSolution> solutions = vra.searchSolutions();
   
    /*
     * Retrieve best solution.
     */
    VehicleRoutingProblemSolution solution = new SelectBest().selectSolution(solutions);
   
    /*
     * print solution
     */
    SolutionPrinter.print(solution);
 
View Full Code Here

  public void whenHaving2Solutions_selectBest(){
    VehicleRoutingProblemSolution sol1 = mock(VehicleRoutingProblemSolution.class);
    VehicleRoutingProblemSolution sol2 = mock(VehicleRoutingProblemSolution.class);
    when(sol1.getCost()).thenReturn(1.0);
    when(sol2.getCost()).thenReturn(2.0);
    assertThat(new SelectBest().selectSolution(Arrays.asList(sol1,sol2)), is(sol1));
  }
View Full Code Here

 
  @Test
  public void whenHavingOnly1Solutions_selectThisOne(){
    VehicleRoutingProblemSolution sol1 = mock(VehicleRoutingProblemSolution.class);
    when(sol1.getCost()).thenReturn(1.0);
    assertThat(new SelectBest().selectSolution(Arrays.asList(sol1)), is(sol1));
  }
View Full Code Here

TOP

Related Classes of jsprit.core.algorithm.selector.SelectBest

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.