Skip to content

Commit

Permalink
Merge branch 'master' of github.com:torressa/cspy
Browse files Browse the repository at this point in the history
  • Loading branch information
torressa committed Jan 15, 2021
2 parents 0af871f + fba830c commit 672fc9b
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 15 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ print(bidirec.consumed_resources)

namespace bidirectional {

int main(int argc, char** argv) {
void wrap() {
// Init
const std::vector<double> max_res = {4.0, 20.0};
const std::vector<double> min_res = {1.0, 0.0};
Expand All @@ -145,7 +145,6 @@ int main(int argc, char** argv) {
}

} // namespace bidirectional

```
### Examples
Expand Down
3 changes: 2 additions & 1 deletion test/python/tests_greedy_elimination.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import unittest
from time import time

from numpy import array
from networkx import DiGraph
from numpy import array
from parameterized import parameterized

from cspy import GreedyElim

Expand Down
30 changes: 18 additions & 12 deletions test/python/tests_issue41.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from numpy import array
from networkx import DiGraph
from parameterized import parameterized

from cspy import BiDirectional

Expand All @@ -28,16 +29,21 @@ def setUp(self):
self.total_cost = 20
self.consumed_resources = [3, 3]

def test_bidirectional(self):
"""
Test BiDirectional with randomly chosen sequence of directions
for a range of seeds.
"""
alg = BiDirectional(self.G, self.max_res, self.min_res)
alg.run()
self.assertEqual(alg.path, self.result_path)
self.assertEqual(alg.total_cost, self.total_cost)
self.assertEqual(alg.consumed_resources, self.consumed_resources)
# @parameterized.expand(zip(range(100), range(100)))
# def test_bidirectional_random(self, _, seed):
# """
# Test BiDirectional with randomly chosen sequence of directions
# for a range of seeds.
# """
# alg = BiDirectional(self.G,
# self.max_res,
# self.min_res,
# method="random",
# seed=seed)
# alg.run()
# self.assertEqual(alg.path, self.result_path)
# self.assertEqual(alg.total_cost, self.total_cost)
# self.assertTrue(all(alg.consumed_resources == self.consumed_resources))

def test_bidirectional_forward(self):
alg = BiDirectional(self.G,
Expand All @@ -47,7 +53,7 @@ def test_bidirectional_forward(self):
alg.run()
self.assertEqual(alg.path, self.result_path)
self.assertEqual(alg.total_cost, self.total_cost)
self.assertTrue(alg.consumed_resources == self.consumed_resources)
self.assertTrue(all(alg.consumed_resources == self.consumed_resources))

def test_bidirectional_backward(self):
alg = BiDirectional(self.G,
Expand All @@ -57,4 +63,4 @@ def test_bidirectional_backward(self):
alg.run()
self.assertEqual(alg.path, self.result_path)
self.assertEqual(alg.total_cost, self.total_cost)
self.assertTrue(alg.consumed_resources == self.consumed_resources)
self.assertTrue(all(alg.consumed_resources == self.consumed_resources))

0 comments on commit 672fc9b

Please sign in to comment.