def choose(s): indices = [] assert not s.empty() nav = s.navigation() while not nav.constant(): e = nav.else_branch() t = nav.then_branch() if e.constant() and not e.terminal_one(): indices.append(nav.value()) nav = t else: if self.random_generator.randint(0,1): indices.append(nav.value()) nav = t else: nav = e assert nav.terminal_one() res = self.one_set for i in reversed(indices): res = ite(i, res, self.empty_set) return next(iter(res))
def choose(s): indices = [] assert not s.empty() nav = s.navigation() while not nav.constant(): e = nav.else_branch() t = nav.then_branch() if e.constant() and not e.terminal_one(): indices.append(nav.value()) nav = t else: if self.random_generator.randint(0, 1): indices.append(nav.value()) nav = t else: nav = e assert nav.terminal_one() res = self.one_set for i in reversed(indices): res = ite(i, res, self.empty_set) return next(iter(res))