Skip to content

Commit

Permalink
Updated pytamer and fixed problems adding conversion to DNF
Browse files Browse the repository at this point in the history
  • Loading branch information
alvalentini committed Nov 5, 2024
1 parent fba59b9 commit 6e6f764
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
author_email='[email protected]',
url='https://tamer.fbk.eu',
packages=['up_tamer'],
install_requires=['pytamer==0.1.19', 'ConfigSpace'],
install_requires=['pytamer==0.1.20', 'ConfigSpace'],
python_requires='>=3.7',
license='APACHE'
)
2 changes: 1 addition & 1 deletion up_tamer/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import re


VERSION = (1, 1, 3)
VERSION = (1, 1, 4)
__version__ = ".".join(str(x) for x in VERSION)

try:
Expand Down
5 changes: 3 additions & 2 deletions up_tamer/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

import unified_planning as up
from unified_planning.model import FNode
from unified_planning.model.walkers import DagWalker
from unified_planning.model.walkers import DagWalker, Dnf
import pytamer # type: ignore
from fractions import Fraction
from typing import Dict, List
Expand All @@ -30,6 +30,7 @@ def __init__(self, env: pytamer.tamer_env,
parameters: Dict['up.model.Parameter', pytamer.tamer_param]={}):
DagWalker.__init__(self)
self._env = env
self._to_dnf = Dnf(problem.environment)
self._fluents = fluents
self._constants = constants
self._instances = instances
Expand All @@ -42,7 +43,7 @@ def __init__(self, env: pytamer.tamer_env,

def convert(self, expression: 'FNode') -> pytamer.tamer_expr:
"""Converts the given expression."""
return self.walk(expression)
return self.walk(self._to_dnf.get_dnf_expression(expression))

def convert_back(self, expression: pytamer.tamer_expr) -> 'FNode':
if pytamer.tamer_expr_is_boolean_constant(self._env, expression) == 1:
Expand Down

0 comments on commit 6e6f764

Please sign in to comment.