Skip to content

Commit

Permalink
asp encoding: more predictable fresh identifiers
Browse files Browse the repository at this point in the history
  • Loading branch information
pauleve committed Mar 26, 2024
1 parent 6fb47aa commit c9e30e3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions bonesis/asp_encoding.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def __init__(self, domain, data, manager, **constants):
self.constants.update(constants)
self.ba = boolean.BooleanAlgebra()
self._silenced = {}
self.__fresh_id = -1
self.__fresh_id = {}

def solver(self, *args, ground=True, settings={}, **kwargs):
arguments = []
Expand Down Expand Up @@ -140,8 +140,8 @@ def push_file(self, filename):
self.prefix += fp.read()

def fresh_atom(self, qualifier=""):
self.__fresh_id += 1
return clingo.Function(f"__bo{qualifier}{self.__fresh_id}")
i = self.__fresh_id[qualifier] = self.__fresh_id.get(qualifier,-1) + 1
return clingo.Function(f"__bo{qualifier}{i}")

def encode_domain(self, domain):
if hasattr(domain, "bonesis_encoder"):
Expand Down

0 comments on commit c9e30e3

Please sign in to comment.