Package jsprit.core.algorithm.selector

Examples of jsprit.core.algorithm.selector.SelectRandomly


    SolutionSelector definedSelector = definedSelectors.get(selectorKey);
    if(definedSelector != null) {
      return definedSelector;
    }
    if(selectorName.equals("selectRandomly")){
      SelectRandomly selector = SelectRandomly.getInstance();
      definedSelectors.put(selectorKey, selector);
      return selector;
    }
    if(selectorName.equals("selectBest")){
      SelectBest selector = SelectBest.getInstance();
View Full Code Here


    when(sol2.getCost()).thenReturn(2.0);
   
    Random random = mock(Random.class);
    when(random.nextInt(2)).thenReturn(1);

    SelectRandomly selectRandomly = new SelectRandomly();
    selectRandomly.setRandom(random);
   
    assertThat(selectRandomly.selectSolution(Arrays.asList(sol1,sol2)), is(sol2));
  }
View Full Code Here

    when(sol2.getCost()).thenReturn(2.0);
   
    Random random = mock(Random.class);
    when(random.nextInt(2)).thenReturn(0);

    SelectRandomly selectRandomly = new SelectRandomly();
    selectRandomly.setRandom(random);
   
    assertThat(selectRandomly.selectSolution(Arrays.asList(sol1,sol2)), is(sol1));
  }
View Full Code Here

  @Test
  public void whenHavingNoSolutions_returnNull(){ 
    Random random = mock(Random.class);
    when(random.nextInt(2)).thenReturn(0);

    SelectRandomly selectRandomly = new SelectRandomly();
    selectRandomly.setRandom(random);
   
    assertNull(selectRandomly.selectSolution(Collections.<VehicleRoutingProblemSolution> emptyList()));
  }
View Full Code Here

TOP

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

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.