Exemple #1
0
 def test_simple(self):
     runnable = RandomSubproblemDecomposer(size=1)
     state = self.state
     for _ in range(10):
         state = runnable.next(state)
         self.assertEqual(len(state.subproblem.variables), 1)
         self.assertIn(next(iter(state.subproblem.variables)), self.bqm.variables)
Exemple #2
0
 def test_look_and_feel(self):
     self.assertEqual(repr(RandomSubproblemDecomposer(7)),
                      'RandomSubproblemDecomposer(size=7)')
Exemple #3
0
 def test_validation(self):
     with self.assertRaises(ValueError):
         RandomSubproblemDecomposer(len(self.bqm)+1).run(self.state).result()