Skip to content
This repository has been archived by the owner on May 10, 2023. It is now read-only.

Commit

Permalink
* Added naive test for the "GraspAlgorithm". #41
Browse files Browse the repository at this point in the history
  • Loading branch information
garciparedes committed Aug 31, 2019
1 parent 39b8f85 commit ca12ff9
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 6 deletions.
1 change: 0 additions & 1 deletion jinete/models/objectives.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@

if TYPE_CHECKING:
from typing import (
Union,
Optional
)

Expand Down
10 changes: 5 additions & 5 deletions tests/test_algorithms/test_heuristics/test_insertion.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ class TestInsertionAlgorithm(unittest.TestCase):
def test_creation(self):
job = jit.Job(generate_trips(10), objective_cls=jit.DialARideObjective)
fleet = jit.Fleet(generate_vehicles(10))
dispatcher = jit.InsertionAlgorithm(
jit.Crosser,
algorithm = jit.InsertionAlgorithm(
crosser_cls=jit.Crosser,
job=job,
fleet=fleet,
)
self.assertEqual(dispatcher.crosser_cls, jit.Crosser)
self.assertEqual(dispatcher.job, job)
self.assertEqual(dispatcher.fleet, fleet)
self.assertEqual(algorithm.crosser_cls, jit.Crosser)
self.assertEqual(algorithm.job, job)
self.assertEqual(algorithm.fleet, fleet)


if __name__ == '__main__':
Expand Down
Empty file.
27 changes: 27 additions & 0 deletions tests/test_algorithms/test_metaheuristics/test_grasp.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import unittest

import jinete as jit

from tests.utils import (
generate_vehicles,
generate_trips,
)


class TestGraspAlgorithm(unittest.TestCase):

def test_creation(self):
job = jit.Job(generate_trips(10), objective_cls=jit.DialARideObjective)
fleet = jit.Fleet(generate_vehicles(10))
algorithm = jit.GraspAlgorithm(
algorithm_cls=jit.InsertionAlgorithm,
job=job,
fleet=fleet,
)
self.assertEqual(algorithm.algorithm_cls, jit.InsertionAlgorithm)
self.assertEqual(algorithm.job, job)
self.assertEqual(algorithm.fleet, fleet)


if __name__ == '__main__':
unittest.main()

0 comments on commit ca12ff9

Please sign in to comment.