Esempio n. 1
0
 def test2_find_optimum_list(self):
     tracks = [{
         "length": 1.0,
         "height": 2
     }, {
         "length": 0.9,
         "height": 1.6
     }, {
         "length": 0.1,
         "height": 2.9
     }, {
         "length": 1.0,
         "height": 2.2
     }, {
         "length": 2.0,
         "height": 3.2
     }]
     path = {"length": 1.5, "height": 3}
     threshold = 3
     opt_list = combining_routes.find_optimum_list([], threshold, tracks,
                                                   path)
     print(opt_list)
     expected_opt_list = [{
         "length": 1.5,
         "height": 3
     }, {
         "length": 1.0,
         "height": 2
     }, {
         "length": 0.5,
         "height": 1.6
     }]
     for count, track in enumerate(expected_opt_list):
         self.assertAlmostEqual(track["length"], opt_list[count]["length"])
         self.assertAlmostEqual(track["height"], opt_list[count]["height"])
Esempio n. 2
0
 def test12_find_optimum_list(self):
     tracks = [{
         'length': 0.0015818624519766198,
         'height': 0.26080389330262954
     }, {
         'length': 0.0023895863196095133,
         'height': 0.26350772901313507
     }, {
         'length': 0.001919040275049572,
         'height': 0.26721284616747887
     }, {
         'length': 0.00063398722027372106,
         'height': 0.27249704751316284
     }, {
         'length': 0.00090645013618520249,
         'height': 0.26845843688159043
     }, {
         'length': 0.001713917479763888,
         'height': 0.26945861543539862
     }, {
         'length': 0.00034247804054427997,
         'height': 0.27422459923821024
     }]
     path = {'length': 0.0029284872016562035, 'height': 0.26906053606224278}
     threshold = 0.0094873219234
     opt_route = combining_routes.find_optimum_list([], threshold, tracks,
                                                    path)
Esempio n. 3
0
 def test5_find_optimum_list(self):
     tracks = []
     path = {"length": 1.5, "height": 1}
     threshold = 1
     old_opt_list = [{"length": 2, "height": 0.5}]
     opt_list = combining_routes.find_optimum_list(old_opt_list, threshold,
                                                   tracks, path)
     print(opt_list)
     expected_opt_list = [{
         "length": 2,
         "height": 0.5
     }, {
         "length": 1,
         "height": 1
     }]
     for count, track in enumerate(expected_opt_list):
         self.assertAlmostEqual(track["length"], opt_list[count]["length"])
         self.assertAlmostEqual(track["height"], opt_list[count]["height"])
Esempio n. 4
0
 def test10_find_optimum_list(self):
     threshold = 0.01
     tracks = [{
         'length': 0.00084789403180791879,
         'height': 0.23448309516230831
     }, {
         'length': 0.0012285759186611484,
         'height': 0.23324036207975657
     }, {
         'length': 0.0019266030665390258,
         'height': 0.2330327242277965
     }, {
         'length': 9.4296078588858301e-05,
         'height': 0.23492283715174436
     }, {
         'length': 0.00031277006708566989,
         'height': 0.22411516857094832
     }, {
         'length': 4.1058012621537562e-06,
         'height': 0.22339328159307462
     }, {
         'length': 0.0013797741130892873,
         'height': 0.22788296716113143
     }, {
         'length': 0.0028259705331712612,
         'height': 0.22378119371125113
     }, {
         'length': 0.00052765220697655046,
         'height': 0.22003631481562122
     }, {
         'length': 0.00077062538463392935,
         'height': 0.21754966007241372
     }, {
         'length': 8.1732798184196848e-05,
         'height': 0.21573718945302311
     }]
     path = {
         'length': 0.00084789403180791879,
         'height': 0.23448309516230831
     }
     opt_route = combining_routes.find_optimum_list([], threshold, tracks,
                                                    path)
Esempio n. 5
0
 def test11_find_optimum_list(self):
     tracks = [{
         'length': 0.00025062494574424579,
         'height': 0.5298658136278781
     }, {
         'length': 0.0014941893570154375,
         'height': 0.53781981860961281
     }, {
         'length': 0.00061166176929072107,
         'height': 0.50414035305944505
     }, {
         'length': 0.002477240484939346,
         'height': 0.51011589430167237
     }, {
         'length': 0.0028098073709598445,
         'height': 0.5250412056705448
     }]
     path = {'length': 0.002477240484939346, 'height': 0.51011589430167237}
     threshold = 0.00764352392795
     opt_route = combining_routes.find_optimum_list([], threshold, tracks,
                                                    path)
Esempio n. 6
0
 def test6_find_optimum_list(self):
     tracks = [{
         "length": 1.0,
         "height": 3
     }, {
         "length": 0.9,
         "height": 2.6
     }, {
         "length": 0.1,
         "height": 1.0
     }, {
         "length": 0.5,
         "height": 2.2
     }, {
         "length": 2.0,
         "height": 3.2
     }]
     path = {"length": 1.5, "height": 2.5}
     threshold = 4.0
     old_opt_list = []
     opt_list = combining_routes.find_optimum_list(old_opt_list, threshold,
                                                   tracks, path)
     print(opt_list)
     expected_opt_list = [{
         "length": 1,
         "height": 3
     }, {
         "length": 0.9,
         "height": 2.6
     }, {
         "length": 0.6 + 0.3 / 0.7,
         "height": 2.5
     }, {
         "length": 1.07142857,
         "height": 3.2
     }]
     for count, track in enumerate(expected_opt_list):
         self.assertAlmostEqual(track["length"], opt_list[count]["length"])
         self.assertAlmostEqual(track["height"], opt_list[count]["height"])
Esempio n. 7
0
 def test9_find_optimum_list(self):
     tracks = [{
         'length': 0.0019061394364962218,
         'height': -0.22304613608628371
     }, {
         'length': 0.0012805974611376069,
         'height': -0.17942790734837177
     }, {
         'length': 0.0035474194392551869,
         'height': -0.16684866975505908
     }, {
         'length': 0.0026727699269563964,
         'height': -0.15141268570475561
     }, {
         'length': 0.00059307373615458819,
         'height': -0.16761378492166606
     }]
     path = {
         'length': 0.0045014719163532944,
         'height': -0.19081592394007982
     }
     threshold = 0.01
     opt_route = combining_routes.find_optimum_list([], threshold, tracks,
                                                    path)