예제 #1
0
파일: test.py 프로젝트: nebw/CS373
  def test_dataset2(self):
    # ARRANGE
    measurements = [[1., 4.], [6., 0.], [11., -4.], [16., -8.]]
    initial_xy = [-4., 8.]
    expected_x = matrix([[15.993335554815062], [-7.9946684438520501], [49.983338887037647], [-39.986671109630123]])

    # ACT
    x, P = task.calculate(measurements, initial_xy)

    # ASSERT
    self.assertArrayAlmostEquals(expected_x.value, x.value)
예제 #2
0
파일: test.py 프로젝트: Cutezjz/CS8803
    def test_dataset2(self):
        # ARRANGE
        measurements = [[1., 4.], [6., 0.], [11., -4.], [16., -8.]]
        initial_xy = [-4., 8.]
        expected_x = matrix([[15.993335554815062], [-7.9946684438520501],
                             [49.983338887037647], [-39.986671109630123]])

        # ACT
        x, P = task.calculate(measurements, initial_xy)

        # ASSERT
        self.assertArrayAlmostEquals(expected_x.value, x.value)
예제 #3
0
파일: test.py 프로젝트: nebw/CS373
  def test_dataset4(self):
    # ARRANGE
    measurements = [[2., 17.], [0., 15.], [2., 13.], [0., 11.]]
    initial_xy = [1., 19.]
    expected_x = matrix([[0.73342219260246477], [11.002665778073975], [-0.66644451849384057], [-19.993335554815054]])
    expected_P = matrix([[0.053315561479506911, 0.0, 0.13328890369876803, 0.0], [0.0, 0.053315561479506911, 0.0, 0.13328890369876803], [0.13328890369876789, 0.0, 0.33322225924692717, 0.0], [0.0, 0.13328890369876789, 0.0, 0.333222259246027171]])

    # ACT
    x, P = task.calculate(measurements, initial_xy)

    # ASSERT
    self.assertArrayAlmostEquals(expected_x.value, x.value)
    self.assertArrayAlmostEquals(expected_P.value, P.value)
예제 #4
0
파일: test.py 프로젝트: nebw/CS373
  def test_dataset1(self):
    # ARRANGE
    measurements = [[5., 10.], [6., 8.], [7., 6.], [8., 4.], [9., 2.], [10., 0.]]
    initial_xy = [4., 12.]
    expected_x = matrix([[9.9993407317877168],[0.001318536424568617],[9.9989012196461928],[-19.997802439292386]])
    expected_P = matrix([[0.039556092737061982, 0.0, 0.06592682122843721, 0.0], [0.0, 0.039556092737061982, 0.0, 0.06592682122843721], [0.065926821228437182, 0.0, 0.10987803538073201, 0.0], [0.0, 0.065926821228437182, 0.0, 0.10987803538073201]])

    # ACT
    x, P = task.calculate(measurements, initial_xy)

    # ASSERT
    self.assertArrayAlmostEquals(expected_x.value, x.value)
    self.assertArrayAlmostEquals(expected_P.value, P.value)
예제 #5
0
    def test_dataset2(self):
        # ARRANGE
        expected_result = [[0, 0, 0], [0, 0.5, 0.5], [0, 0, 0]]

        task.colors = [['green', 'green', 'green'], ['green', 'red', 'red'],
                       ['green', 'green', 'green']]
        task.measurements = ['red']
        task.motions = [[0, 0]]
        task.sensor_right = 1.0
        task.p_move = 1.0

        # ACT
        actual_result = task.calculate()

        # ASSERT
        self.assertArrayAlmostEquals(expected_result, actual_result)
예제 #6
0
파일: test.py 프로젝트: nebw/CS373
  def test_dataset3(self):
    # ARRANGE
    expected_result=[[0.06666,0.06666, 0.06666],[0.06666,0.26666,0.26666],[0.06666,0.06666,0.06666]]

    task.colors = [['green','green','green'],
                   ['green','red','red'],
                   ['green','green','green']]
    task.measurements=['red']
    task.motions=[[0,0]]
    task.sensor_right=0.8
    task.p_move=1.0

    # ACT
    p = task.calculate()

    # ASSERT
    self.assertArrayAlmostEquals(expected_result, p, 4)
예제 #7
0
    def test_dataset6(self):
        # ARRANGE
        expected_result = [[0.02898, 0.02898, 0.02898],
                           [0.07246, 0.28985, 0.46376],
                           [0.02898, 0.02898, 0.02898]]

        task.colors = [['green', 'green', 'green'], ['green', 'red', 'red'],
                       ['green', 'green', 'green']]
        task.measurements = ['red', 'red']
        task.motions = [[0, 0], [0, 1]]
        task.sensor_right = 0.8
        task.p_move = 0.5

        # ACT
        actual_result = task.calculate()

        # ASSERT
        self.assertArrayAlmostEquals(expected_result, actual_result, 4)
예제 #8
0
파일: test.py 프로젝트: Cutezjz/CS8803
    def test_dataset4(self):
        # ARRANGE
        measurements = [[2., 17.], [0., 15.], [2., 13.], [0., 11.]]
        initial_xy = [1., 19.]
        expected_x = matrix([[0.73342219260246477], [11.002665778073975],
                             [-0.66644451849384057], [-19.993335554815054]])
        expected_P = matrix(
            [[0.053315561479506911, 0.0, 0.13328890369876803, 0.0],
             [0.0, 0.053315561479506911, 0.0, 0.13328890369876803],
             [0.13328890369876789, 0.0, 0.33322225924692717, 0.0],
             [0.0, 0.13328890369876789, 0.0, 0.333222259246027171]])

        # ACT
        x, P = task.calculate(measurements, initial_xy)

        # ASSERT
        self.assertArrayAlmostEquals(expected_x.value, x.value)
        self.assertArrayAlmostEquals(expected_P.value, P.value)
예제 #9
0
파일: test.py 프로젝트: Cutezjz/CS8803
    def test_dataset1(self):
        # ARRANGE
        measurements = [[5., 10.], [6., 8.], [7., 6.], [8., 4.], [9., 2.],
                        [10., 0.]]
        initial_xy = [4., 12.]
        expected_x = matrix([[9.9993407317877168], [0.001318536424568617],
                             [9.9989012196461928], [-19.997802439292386]])
        expected_P = matrix(
            [[0.039556092737061982, 0.0, 0.06592682122843721, 0.0],
             [0.0, 0.039556092737061982, 0.0, 0.06592682122843721],
             [0.065926821228437182, 0.0, 0.10987803538073201, 0.0],
             [0.0, 0.065926821228437182, 0.0, 0.10987803538073201]])

        # ACT
        x, P = task.calculate(measurements, initial_xy)

        # ASSERT
        self.assertArrayAlmostEquals(expected_x.value, x.value)
        self.assertArrayAlmostEquals(expected_P.value, P.value)
예제 #10
0
    def test_dataset4(self):
        # ARRANGE
        expected_result = [[0.03333, 0.03333, 0.03333],
                           [0.13333, 0.13333, 0.53333],
                           [0.03333, 0.03333, 0.03333]]

        task.colors = [['green', 'green', 'green'],
                       ['green', 'red', 'red'],
                       ['green', 'green', 'green']]
        task.measurements = ['red', 'red']
        task.motions = [[0, 0], [0, 1]]
        task.sensor_right = 0.8
        task.p_move = 1.0

        # ACT
        actual_result = task.calculate()

        # ASSERT
        self.assertArrayAlmostEquals(expected_result, actual_result, 4)
예제 #11
0
    def test_dataset6(self):
        # ARRANGE
        expected_result = [[0.02898, 0.02898, 0.02898],
                           [0.07246, 0.28985, 0.46376],
                           [0.02898, 0.02898, 0.02898]]

        task.colors = [['green', 'green', 'green'],
                       ['green', 'red', 'red'],
                       ['green', 'green', 'green']]
        task.measurements = ['red', 'red']
        task.motions = [[0, 0], [0, 1]]
        task.sensor_right = 0.8
        task.p_move = 0.5

        # ACT
        actual_result = task.calculate()

        # ASSERT
        self.assertArrayAlmostEquals(expected_result, actual_result, 4)
예제 #12
0
    def test_dataset8(self):
        # ARRANGE
        expected_result = [[0.01105, 0.02464, 0.06799, 0.04472, 0.024651],
                           [0.00715, 0.01017, 0.08696, 0.07988, 0.00935],
                           [0.00739, 0.00894, 0.11272, 0.35350, 0.04065],
                           [0.00910, 0.00715, 0.01434, 0.04313, 0.03642]]

        task.colors = [['red', 'green', 'green', 'red', 'red'],
                       ['red', 'red', 'green', 'red', 'red'],
                       ['red', 'red', 'green', 'green', 'red'],
                       ['red', 'red', 'red', 'red', 'red']]
        task.measurements = ['green', 'green', 'green', 'green', 'green']
        task.motions = [[0, 0], [0, 1], [1, 0], [1, 0], [0, 1]]
        task.sensor_right = 0.7
        task.p_move = 0.8

        # ACT
        actual_result = task.calculate()

        # ASSERT
        self.assertArrayAlmostEquals(expected_result, actual_result, 4)
예제 #13
0
    def test_dataset8(self):
        # ARRANGE
        expected_result = [[0.01105, 0.02464, 0.06799, 0.04472, 0.024651],
                           [0.00715, 0.01017, 0.08696, 0.07988, 0.00935],
                           [0.00739, 0.00894, 0.11272, 0.35350, 0.04065],
                           [0.00910, 0.00715, 0.01434, 0.04313, 0.03642]]

        task.colors = [['red', 'green', 'green', 'red','red'],
                       ['red', 'red', 'green', 'red', 'red'],
                       ['red', 'red', 'green', 'green', 'red'],
                       ['red', 'red', 'red', 'red', 'red']]
        task.measurements = ['green', 'green', 'green', 'green', 'green']
        task.motions = [[0, 0], [0, 1], [1, 0], [1, 0], [0, 1]]
        task.sensor_right = 0.7
        task.p_move = 0.8

        # ACT
        actual_result = task.calculate()

        # ASSERT
        self.assertArrayAlmostEquals(expected_result, actual_result, 4)