Skip to content

Commit

Permalink
eliminate reference cycle in IndexVar
Browse files Browse the repository at this point in the history
  • Loading branch information
maxeeem committed May 11, 2024
1 parent 23339c9 commit 74b2a3f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Tests/utils_for_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
nars = Reasoner(100, 100)
engine: GeneralEngine = nars.inference

NUM_CYCLES_MULTIPLIER = 10
NUM_CYCLES_MULTIPLIER = 20
def process_two_premises(premise1: str, premise2: str, n_cycle: int = 0) -> List[Task]:
''''''
time_before = Global.time
Expand Down
4 changes: 2 additions & 2 deletions pynars/Narsese/_py/Term.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,8 @@ def _build_vars(self):


def clone(self):
clone = deepcopy(self)
return clone
# clone = copy(self)
return self

def _normalize_variables(self):
''''''
Expand Down
4 changes: 2 additions & 2 deletions pynars/utils/IndexVar.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def __init__(self) -> None:
self.positions = [] # the positions of each dependent variable
self.indices = [] # the dependent variable in each position.

self.predecessor: IndexVar = None
# self.predecessor: IndexVar = None
self.successors: List[IndexVar] = []

self._is_built = False
Expand Down Expand Up @@ -165,7 +165,7 @@ def clone(self):
def connect(self, successor: 'IndexVar', generate_pos=False):
''''''
self.successors.append(successor)
successor.predecessor = self
# successor.predecessor = self

if not generate_pos: return

Expand Down

0 comments on commit 74b2a3f

Please sign in to comment.