Package ai.domain.boxes

Examples of ai.domain.boxes.IntegerBoxes


  }

  @Test
  public void leqTwoDimensionsWithoutVarRemoval02() {
    // 1 dimension
    IntegerBoxes first = IntegerBoxesHelper.join(
        getSingleBoxAndVerify(new IntervalValue(0,2), new IntervalValue(0, 2)),
        getSingleBoxAndVerify(new IntervalValue(5,6), new IntervalValue(5, 6)));
    IntegerBoxes second = IntegerBoxesHelper.join(
        getSingleBoxAndVerify(new IntervalValue(0, 1), new IntervalValue(1,3)),
        getSingleBoxAndVerify(new IntervalValue(6, 6), new IntervalValue(5,5)));
    org.junit.Assert.assertFalse(first.leq(second));
    org.junit.Assert.assertFalse(second.leq(first));
  }
View Full Code Here


    org.junit.Assert.assertFalse(second.leq(first));
  }

  @Test
  public void leqThreeDimensionsWithVarRemoval01() {
    IntegerBoxes first = IntegerBoxesHelper.join(
        getSingleBoxAndVerify(new IntervalValue(0,2), new IntervalValue(0, 2), new IntervalValue(0,0)),
        getSingleBoxAndVerify(new IntervalValue(5,6), new IntervalValue(5, 6), new IntervalValue(3, 3)));
    IntegerBoxes second = IntegerBoxesHelper.join(
        getSingleBoxAndVerify(new IntervalValue(0, 1), new IntervalValue(1,2)),
        getSingleBoxAndVerify(new IntervalValue(6, 6), new IntervalValue(5,5)));
    org.junit.Assert.assertFalse(first.leq(second));
    org.junit.Assert.assertTrue(second.leq(first));
  }
View Full Code Here

    org.junit.Assert.assertTrue(second.leq(first));
  }

  @Test
  public void testIsTop() {
    IntegerBoxes b = IntegerBoxes.BOTTOM;
    org.junit.Assert.assertFalse(b.isTop());
    b = getSingleBoxAndVerify(new IntervalValue(Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY));
    org.junit.Assert.assertTrue(b.isTop());
    b = getSingleBoxAndVerify(new IntervalValue(Double.NEGATIVE_INFINITY, 3));
    org.junit.Assert.assertFalse(b.isTop());
   
    b = IntegerBoxesHelper.join(
        getSingleBoxAndVerify(new IntervalValue(0,2), new IntervalValue(0, 2), new IntervalValue(0,0)),
        getSingleBoxAndVerify(new IntervalValue(5,6), new IntervalValue(5, 6), new IntervalValue(3, 3)));
    org.junit.Assert.assertFalse(b.isTop());
    b = IntegerBoxesHelper.join(
        getSingleBoxAndVerify(new IntervalValue(Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY),
            new IntervalValue(Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY),
            new IntervalValue(Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY)));
    org.junit.Assert.assertTrue(b.isTop());
  }
View Full Code Here

  }
 
  @Test
  public void leqTest01() {
    // 1 dimension
    IntegerBoxes first = IntegerBoxesHelper.join(
        getSingleBoxAndVerify(
            new IntervalValue(1, Double.POSITIVE_INFINITY),
            new IntervalValue(Double.NEGATIVE_INFINITY, 0),
            new IntervalValue(0, 0), new IntervalValue(0, 0)),
        getSingleBoxAndVerify(
            new IntervalValue(1, Double.POSITIVE_INFINITY),
            new IntervalValue(1, Double.POSITIVE_INFINITY),
            new IntervalValue(1, Double.POSITIVE_INFINITY),
            new IntervalValue(0, 0)),
        getSingleBoxAndVerify(
            new IntervalValue(2, Double.POSITIVE_INFINITY),
            new IntervalValue(Double.NEGATIVE_INFINITY, 0),
            new IntervalValue(1,1),
            new IntervalValue(1, Double.POSITIVE_INFINITY)));
    IntegerBoxes second = IntegerBoxesHelper.join(
        getSingleBoxAndVerify(
            new IntervalValue(1, Double.POSITIVE_INFINITY),
            new IntervalValue(Double.NEGATIVE_INFINITY, 0),
            new IntervalValue(0, 0), new IntervalValue(0, 0)),
        getSingleBoxAndVerify(
            new IntervalValue(1, Double.POSITIVE_INFINITY),
            new IntervalValue(1, Double.POSITIVE_INFINITY),
            new IntervalValue(1, Double.POSITIVE_INFINITY),
            new IntervalValue(0, 0)),
        getSingleBoxAndVerify(
            new IntervalValue(2, Double.POSITIVE_INFINITY),
            new IntervalValue(Double.NEGATIVE_INFINITY, 0),
            new IntervalValue(1,1),
            new IntervalValue(1, Double.POSITIVE_INFINITY)));
    System.out.println(first.leq(second));
    System.out.println(second.leq(first));
  }
View Full Code Here

  }
 
  @Test
  public void leqTest02() {
    // 1 dimension
    IntegerBoxes first = IntegerBoxesHelper.join(
        getSingleBoxAndVerify(
            new IntervalValue(Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY),
            new IntervalValue(Double.NEGATIVE_INFINITY, 0),
            new IntervalValue(0, 0),
            new IntervalValue(0, 0)),
View Full Code Here

    return IntegerBoxesHelper.fromIntervalBox(input);
  }
 
  private IntegerBoxes getSingleBoxAndVerify(IntervalValue... data) {
    NonRelationalDomain<Interval> input = prepareBox(data);
    IntegerBoxes i = IntegerBoxesHelper.fromIntervalBox(input);

    List<NonRelationalDomain<Interval>> output = IntegerBoxesHelper.split(i);
    org.junit.Assert.assertEquals(output.size(), 1);
    org.junit.Assert.assertEquals(output.get(0), input);
    return i;
View Full Code Here

    org.junit.Assert.assertEquals(output.get(0), input);
    return i;
  }
 
  private IntegerBoxes oneDimensionalBox(IntervalValue... data) {
    IntegerBoxes result = IntegerBoxes.BOTTOM;
    for(IntervalValue val: data)
      result = result.join(IntegerBoxesHelper.fromIntervalBox(prepareBox(val)));
    return result;
  }
View Full Code Here

    return result;
  }
 
  @Test
  public void testOneDimensionNoThresholds01() {
    IntegerBoxes left = oneDimensionalBox(new IntervalValue(1, 2), new IntervalValue(4, 5));
    IntegerBoxes right = oneDimensionalBox(new IntervalValue(4, 6));
    IntegerBoxes wid = BoxesWideningOperator.computeWidening(left, right);
    org.junit.Assert.assertEquals(oneDimensionalBox(new IntervalValue(1, 2), new IntervalValue(4, Double.POSITIVE_INFINITY)), wid);
  }
View Full Code Here

    org.junit.Assert.assertEquals(oneDimensionalBox(new IntervalValue(1, 2), new IntervalValue(4, Double.POSITIVE_INFINITY)), wid);
  }

  @Test
  public void testOneDimensionNoThresholds02() {
    IntegerBoxes left = oneDimensionalBox(new IntervalValue(1, 2), new IntervalValue(4, 5));
    IntegerBoxes right = oneDimensionalBox(new IntervalValue(4, 6), new IntervalValue(-2, -1));
    IntegerBoxes wid = BoxesWideningOperator.computeWidening(left, right);
    org.junit.Assert.assertEquals(oneDimensionalBox(new IntervalValue(Double.NEGATIVE_INFINITY, 2), new IntervalValue(4, Double.POSITIVE_INFINITY)), wid);
  }
View Full Code Here

    org.junit.Assert.assertEquals(oneDimensionalBox(new IntervalValue(Double.NEGATIVE_INFINITY, 2), new IntervalValue(4, Double.POSITIVE_INFINITY)), wid);
  }

  @Test
  public void testOneDimensionWithThresholds01() {
    IntegerBoxes left = oneDimensionalBox(new IntervalValue(1, 2));
    IntegerBoxes right = oneDimensionalBox(new IntervalValue(4, 6));
    IntegerBoxes wid = BoxesWideningOperator.computeWidening(left, right, Arrays.asList(new Double(-2), new Double(8), new Double(120)));
    org.junit.Assert.assertEquals(oneDimensionalBox(new IntervalValue(1, 7)), wid);
  }
View Full Code Here

TOP

Related Classes of ai.domain.boxes.IntegerBoxes

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.