Skip to content

Commit

Permalink
Add simple time calculation for 1 working cycle
Browse files Browse the repository at this point in the history
  • Loading branch information
ccrock4t committed Jan 11, 2024
1 parent 0632551 commit 2276950
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pynars/NARS/Control/Reasoner.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from typing import Callable, List, Tuple, Union
import pynars.NARS.Operation as Operation
from pynars import Global
from time import time
import time
from pynars.NAL.Functions.Tools import project_truth, project
from ..GlobalEval import GlobalEval

Expand Down Expand Up @@ -76,6 +76,7 @@ def input_narsese(self, text, go_cycle: bool = False) -> Tuple[bool, Union[Task,
return success, task, task_overflow

def cycle(self):
start_cycle_time_in_seconds = time.time()
"""Everything to do by NARS in a single working cycle"""
Global.States.reset()
tasks_derived: List[Task] = []
Expand Down Expand Up @@ -107,6 +108,12 @@ def cycle(self):
thresh_complexity = 20
tasks_derived = [
task for task in tasks_derived if task.term.complexity <= thresh_complexity]


# done with cycle
total_cycle_time_in_seconds = time.time() - start_cycle_time_in_seconds
print("cycle took: " + str(total_cycle_time_in_seconds))

return tasks_derived, judgement_revised, goal_revised, answers_question, answers_quest, (
task_operation_return, task_executed)

Expand Down

0 comments on commit 2276950

Please sign in to comment.