Пример #1
0
  @Test
  public void testGetMoveDeltaWhenN_0_1() throws Exception {
    setUp();
    when(problem.getDistance(0, 1)).thenReturn(10.0);
    when(problem.getDistance(1, 0)).thenReturn(10.0);
    when(problem.getDistance(0, dim - 1)).thenReturn(50.0);
    when(problem.getDistance(1, dim - 1)).thenReturn(22.0);
    when(problem.getDistance(1, 2)).thenReturn(15.0);
    when(problem.getDistance(0, 2)).thenReturn(393.0);

    assertEquals(-50.0 - 15.0 + 22.0 + 393.0, mover.getMoveDelta(0, 1, solution), Environment.eps);
  }
Пример #2
0
  @Test
  public void testGetMoveDeltaWhenN_1_4() throws Exception {
    setUp();
    when(problem.getDistance(1, 0)).thenReturn(10.0);
    when(problem.getDistance(1, 2)).thenReturn(121.0);
    when(problem.getDistance(4, 5)).thenReturn(50.0);
    when(problem.getDistance(4, 3)).thenReturn(23.0);
    when(problem.getDistance(4, 0)).thenReturn(76.0);
    when(problem.getDistance(4, 2)).thenReturn(8.0);
    when(problem.getDistance(1, 3)).thenReturn(89.0);
    when(problem.getDistance(1, 5)).thenReturn(142.0);

    assertEquals(
        -10.0 - 121.0 - 50.0 - 23.0 + 76.0 + 8.0 + 89.0 + 142.0,
        mover.getMoveDelta(1, 4, solution),
        Environment.eps);
  }