How to use the problog.get_evaluatable function in problog

To help you get started, we’ve selected a few problog examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github thiagopbueno / mdp-problog / mdp-problog.py View on Github external
self._build_value_function_rules()
		self._utilities = dict(self._eng.query(self._db, Term('utility', None, None)))
		end = time.clock()
		uptime = end-start
		print("Done in {0:.3f}sec.".format(uptime))

		print("  >> Relevant grounding ...", end=" ")
		start = time.clock()
		self._gp = self._eng.ground_all(self._db, target=None, queries=self._utilities.keys())
		end = time.clock()
		uptime = end-start
		print("Done in {0:.3f}sec.".format(uptime))

		print("  >> Compilation ...", end=" ")
		start = time.clock()
		self._knowledge = get_evaluatable(None).create_from(self._gp)
		end = time.clock()
		uptime = end-start
		print("Done in {0:.3f}sec.".format(uptime))

		self._queries = dict(self._knowledge.queries())
		self._get_decision_facts()
github thiagopbueno / mdp-problog / mdpproblog / engine.py View on Github external
def compile(self, terms=[]):
        """
        Create compiled knowledge database from ground program.
        Return mapping of `terms` to nodes in the compiled knowledge database.

        :param terms: list of predicates
        :type terms: list of problog.logic.Term
        :rtype: dict of (problog.logic.Term, int)
        """
        self._knowledge = get_evaluatable(None).create_from(self._gp)
        term2node = {}
        for term in terms:
            term2node[term] = self._knowledge.get_node_by_name(term)
        return term2node