Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __init__(self, program):
self._engine = DefaultEngine()
self._db = self._engine.prepare(PrologString(program))
self._gp = None
self._knowledge = None
#! /usr/bin/env python3
from problog.program import PrologString
from problog.engine import DefaultEngine
from problog.logic import Constant,Term,And,Clause
from problog import get_evaluatable
import time
import math
import inspect
class MDPProbLog():
_eng = DefaultEngine(label_all=True)
def __init__(self, model, gamma, epsilon):
self._model = model
self._gamma = gamma
self._epsilon = epsilon
print(" >> Preprocessing program ...", end=" ")
start = time.clock()
self._db = self._eng.prepare(PrologString(model))
self._build_state_atoms()
self._get_action_atoms()
self._build_action_rules()
self._build_value_function_rules()
self._utilities = dict(self._eng.query(self._db, Term('utility', None, None)))
end = time.clock()
uptime = end-start