opennars / OpenNARS-for-Applications

General reasoning component for applications based on NARS theory.
https://cis.temple.edu/~pwang/NARS-Intro.html
MIT License
91 stars 40 forks source link

(WIP) Attempt to eliminate cyclic dependency `NAR→Cycle→Decision` #280

Open ARCJ137442 opened 2 months ago

ARCJ137442 commented 2 months ago

Maybe reducing cyclic dependency can make the module dependency of ONA better?

The only problem is here:

https://github.com/opennars/OpenNARS-for-Applications/blob/9954416ca1316bdb42ffe6c8e65b339c0c54ca95/src/Decision.c#L230

Are there any good alternatives to "input beliefs"? Pass a function pointer such like void (*InputBelief) (Term) as a parameter on Decision_Execute, Cycle_ProcessAndInferGoalEvents and Cycle_Perform?

patham9 commented 2 months ago

Awesome that you found this, thank you! And I will think about a solution to replacing NAR_AddInputBelief(feedbackTerm) there.

ARCJ137442 commented 2 months ago

Awesome that you found this, thank you! And I will think about a solution to replacing NAR_AddInputBelief(feedbackTerm) there.

Thanks for your watching too!

I also have some extra information that I hope will help us.

That's my dependancy analyze of ONA using Graphviz dot:

ONA include graph

(generated on 2024-09-21, .svg vectorgraph)

And its Graphviz code can be seen and previewed here. (2 cyclic dependencies: Narsese.hVariable.h, Decision.hNAR.hCycle.h)

Perhaps it can give us a macro overview of module dependencies in ONA :)