Пример #1
0
  @Test
  public void optimizeRand() throws IOException {
    Optimizer optimizer = new Optimizer();
    long start;
    List<Vol> optimize;

    for (int i = 0; i < 1; i++) {
      List<Vol> list = randList(100000);

      start = System.currentTimeMillis();
      //            optimize = optimizer.optimize3(null, list);
      //            System.out.println(optimizer.formatString(optimize));
      //            System.out.println(System.currentTimeMillis() - start);
      //            System.out.println(Vol.toString(optimize));

      start = System.currentTimeMillis();
      List<Vol> optimize2 = optimizer.optimize4(list);
      long duration = System.currentTimeMillis() - start;
      System.out.println(optimizer.formatString(optimize2));
      System.out.println(duration);
      //            System.out.println(Vol.toString(optimize2));

      //
      // assertThat(Optimizer.price(optimize)).isLessThanOrEqualTo(Optimizer.price(optimize2));
      Iterator<Vol> iterator = optimize2.iterator();

      Vol vol = iterator.next();
      while (iterator.hasNext()) {
        Vol next = iterator.next();
        assertThat(vol.isNext(next)).isTrue();
        vol = next;
      }
    }
  }
Пример #2
0
 @Test
 public void optimizeTest() throws IOException {
   List<Map> maps = mapper.readValue(json, new TypeReference<List<Map>>() {});
   Optimizer optimizer = new Optimizer();
   List<Vol> optimize = optimizer.optimize4(Vol.fromMaps(maps));
   System.out.println(optimizer.formatString(optimize));
 }