This repository has been archived by the owner on May 10, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Included tests for "InsertionAlgorithm". #41
* Improved tests for all "Algorithm" heirs. * Fixed bug related with the criterion settings.
- Loading branch information
1 parent
d8b83c9
commit 8ed70fa
Showing
6 changed files
with
77 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
tests/test_algorithms/test_metaheuristics/test_iterative.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import unittest | ||
|
||
import jinete as jit | ||
|
||
from tests.utils import ( | ||
generate_vehicles, | ||
generate_trips, | ||
) | ||
|
||
|
||
class TestIterativeAlgorithm(unittest.TestCase): | ||
job: jit.Job | ||
fleet: jit.Fleet | ||
|
||
@classmethod | ||
def setUpClass(cls) -> None: | ||
cls.job = jit.Job(generate_trips(10), objective_cls=jit.DialARideObjective) | ||
cls.fleet = jit.Fleet(generate_vehicles(10)) | ||
|
||
def test_creation(self): | ||
algorithm = jit.IterativeAlgorithm( | ||
job=self.job, | ||
fleet=self.fleet, | ||
) | ||
self.assertEqual(algorithm.job, self.job) | ||
self.assertEqual(algorithm.fleet, self.fleet) | ||
|
||
def test_optimize(self): | ||
algorithm = jit.IterativeAlgorithm( | ||
job=self.job, | ||
fleet=self.fleet, | ||
) | ||
result = algorithm.optimize() | ||
|
||
# TODO: Properly validate behaviour of the provided "Result" object. | ||
self.assertIsNotNone(result) | ||
self.assertIsInstance(result, jit.Result) | ||
|
||
|
||
if __name__ == '__main__': | ||
unittest.main() |