コード例 #1
0
    def test_nbest(self):
        criterion = jit.LongestTimeRouteCriterion()

        self.assertEqual(
            [self.routes[1], self.routes[0]],
            criterion.nbest(2, self.routes),
        )
コード例 #2
0
    def test_best(self):
        criterion = jit.LongestTimeRouteCriterion()

        self.assertEqual(
            self.routes[1],
            criterion.best(*self.routes),
        )
コード例 #3
0
    def test_sorting(self):
        criterion = jit.LongestTimeRouteCriterion()

        self.assertEqual(
            [self.routes[1], self.routes[0], self.routes[2]],
            criterion.sorted(self.routes),
        )
コード例 #4
0
    def test_scoring(self):
        criterion = jit.LongestTimeRouteCriterion()

        self.assertEqual(
            4.0,
            criterion.scoring(self.routes[0]),
        )

        self.assertEqual(
            41.0,
            criterion.scoring(self.routes[1]),
        )

        self.assertEqual(
            -jit.MAX_FLOAT,
            criterion.scoring(self.routes[2]),
        )
コード例 #5
0
 def test_creation(self):
     criterion = jit.LongestTimeRouteCriterion()
     self.assertEqual(jit.OptimizationDirection.MAXIMIZATION,
                      criterion.direction)
     self.assertEqual('Longest-Time', criterion.name)