Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] Inproper occurrence time indexed concepts after forgetting concept #292

Open
ARCJ137442 opened this issue Oct 24, 2024 · 0 comments
Open

Comments

@ARCJ137442
Copy link
Contributor

ARCJ137442 commented Oct 24, 2024

Using this feature in PR #291,
it can be seen by changing the config of ONA with #define CONCEPTS_MAX 3 on this NAL inputs:

a. :|:
b. :|:
c. :|:
*occurrence_time_index

Before Changing: #define CONCEPTS_MAX 16384

0ba39a7400b97f132665565169d7ba3

After Changing: #define CONCEPTS_MAX 3

74af512683fd147e364e2b3e8d303e4

Possible Cause

This may be because concepts are actually stored in PriorityQueue, and the occurrence time index simply stores Pointers to the corresponding address.

If a Concept is forgotten in the priority queue, ONA's mechanism is to "ignore the address of the forgotten concept", i.e. make this part of the "forgotten concept" invalid (not to use);
But in the function Memory_Conceptualize, concepts are forgotten and the corresponding HT_concepts and InvertedAtomIndex (essentially a HashTable<Key=Term, Value=LinkedList<Concept>>) are cleared, but OccurrenceTimeIndex is not processed. Therefore, it will store forgotten concepts (actually invalid) in OccurrenceTimeIndex.

Perhaps it is a question of how to manage the value lifetime of *Concepts, where they are used and where they are removed.

Potential Problem

The technical aspect of this problem is that forgotten concepts may appear at OccurrenceTimeIndex,
and when forgotten, the OccurrenceTimeIndex may stores outdated concepts (or, dangling Pointers).
If a new Concept is added to PriorityQueue, and PriorityQueue reuses memory space (in my opinion, this is enough for the entire ONA reasoner to be stored on the stack),
the concepts pointed to by the "pointers of outdated concepts" in OccurrenceTimeIndex will be overwritten.

Thus, the direct manifestation of the problem is: The "historical events (concepts)" stored at OccurrenceTimeIndex may undergo unexpected changes when forgetting concepts, causing its own "index of historical events" to become chaotic - a forgotten "archaic concept" suddenly becoming a more recent one. This will be directly reflected through OccurrenceTimeIndex_GetKthNewestElement;

This logic may continue to affect ONA's reasoning at the NAL-7 level during subsequent traverses of OccurrenceTimeIndex, which may produce unexpected reasoning results.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant