Esempio n. 1
0
  @Test
  public void backwards() {
    FastQueue<TupleDesc_F64> a = createData(1, 2, 3, 8);
    FastQueue<TupleDesc_F64> b = createData(3, 4, 1, 10);

    AssociateGreedy<TupleDesc_F64> alg = new AssociateGreedy<TupleDesc_F64>(score, true);
    alg.setMaxFitError(10);

    alg.associate(a, b);

    int pairs[] = alg.getPairs();

    assertEquals(2, pairs[0]);
    assertEquals(-1, pairs[1]);
    assertEquals(0, pairs[2]);
    assertEquals(3, pairs[3]);

    double fitScore[] = alg.getFitQuality();

    assertEquals(0, fitScore[0], 1e-5);
    assertEquals(0, fitScore[2], 1e-5);
    assertEquals(2, fitScore[3], 1e-5);
  }
Esempio n. 2
0
  @Test
  public void maxError() {
    FastQueue<TupleDesc_F64> a = createData(1, 2, 3, 4);
    FastQueue<TupleDesc_F64> b = createData(3, 4, 1.1, 40);

    // large margin for error
    AssociateGreedy<TupleDesc_F64> alg = new AssociateGreedy<TupleDesc_F64>(score, false);
    alg.setMaxFitError(10);

    alg.associate(a, b);
    assertEquals(2, alg.getPairs()[1]);

    // small margin for error, no association
    alg = new AssociateGreedy<TupleDesc_F64>(score, false);
    alg.setMaxFitError(0.1);
    alg.associate(a, b);
    assertEquals(-1, alg.getPairs()[1]);
  }