Examples of SelectRandomly


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

Examples of jsprit.core.algorithm.selector.SelectRandomly

    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

Examples of jsprit.core.algorithm.selector.SelectRandomly

    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

Examples of jsprit.core.algorithm.selector.SelectRandomly

  @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
Copyright © 2018 www.massapi.com. 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.