Skip to content

Commit

Permalink
Add methods to update Budget of Concept
Browse files Browse the repository at this point in the history
  • Loading branch information
ccrock4t committed Jan 16, 2024
1 parent 0632551 commit 04c16e0
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pynars/Config.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,13 @@ class Config:
rate_discount_p_internal_exp = 0.1
rate_discount_d_internal_exp = 0.1

# parameters for updating the Budget of Concept.
# Lower values means it is harder to change the budget, higher values means it is easier to change the budget
concept_update_priority_weight = 0.1
concept_update_durability_weight = 0.1
concept_update_quality_weight = 0.1

#
temporal_duration = 5
n_sequence_attempts = 10
n_op_condition_attempts = 10
Expand Down
13 changes: 13 additions & 0 deletions pynars/NARS/DataStructures/_py/Concept.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,19 @@ def accept(self, task: Task, concepts: Bag=None, conceptualize: bool=True):
if concept is None: return # The memroy is full, and the concept fails to get into the memory.
self._build_task_links(concepts, task)
self._build_term_links(concepts, task, budget)


def update_priority(self, p):
self.budget.priority = (Config.concept_update_priority_weight * p
+ (1-Config.concept_update_priority_weight)*self.budget.priority)

def update_durability(self, d):
self.budget.durability = (Config.concept_update_durability_weight * d
+ (1-Config.concept_update_durability_weight)*self.budget.durability)

def update_quality(self, q):
self.budget.quality = (Config.concept_update_quality_weight * q
+ (1-Config.concept_update_quality_weight)*self.budget.quality)

def _build_task_links(self, concepts: Bag, task: Task):
''''''
Expand Down

0 comments on commit 04c16e0

Please sign in to comment.