diff --git a/pynars/Config.py b/pynars/Config.py index 93ac5a4..b5fd104 100644 --- a/pynars/Config.py +++ b/pynars/Config.py @@ -81,7 +81,6 @@ class Config: n_sequence_attempts = 10 n_op_condition_attempts = 10 - projection_decay = 0.99 Td_decision_threshold = 0.51 # what this value represents was originally equal to the termlink record length (10), but we may want to adjust it or make it scaled according to duration since it has more to do with time than # of records. it can probably be increased several times larger since each item should remain in the recording queue for longer than 1 cycle diff --git a/pynars/NAL/Functions/TemporalFunctions.py b/pynars/NAL/Functions/TemporalFunctions.py index 1ce7229..d31b94f 100644 --- a/pynars/NAL/Functions/TemporalFunctions.py +++ b/pynars/NAL/Functions/TemporalFunctions.py @@ -6,22 +6,23 @@ def project(truth: Truth, t_source: int, t_current: int, t_target: int): ''' Reference: - [1] OpenNARS 3.1.0 TruthFunctions.java line 492~495: - ``` - public static final float temporalProjection(final long sourceTime, final long targetTime, final long currentTime, Parameters param) { - final double a = 100000.0 * param.PROJECTION_DECAY; //projection less strict as we changed in v2.0.0 10000.0 slower decay than 100000.0 - return 1.0f - abs(sourceTime - targetTime) / (float) (abs(sourceTime - currentTime) + abs(targetTime - currentTime) + a); - } - ``` - [2] Hammer, Patrick, Tony Lofthouse, and Pei Wang. "The OpenNARS implementation of the non-axiomatic reasoning system." International conference on artificial general intelligence. Springer, Cham, 2016. + p.172 Non-Axiomatic Logic + — A Model of Intelligent Reasoning + (Second Edition) + ''' + v = abs(t_source - t_target) - Section 5. Projection and Eternalization + t_current_is_in_interval = False + if t_source < t_target: + if t_current >= t_source and t_current <= t_target: t_current_is_in_interval = True + else: + if t_current <= t_source and t_current >= t_target: t_current_is_in_interval = True - $$k_c = \frac{|tB - tT|}{|tB - tC| + |tT - tC|}$$ + if t_current_is_in_interval: s = 0.5 + else: s = min(abs(t_source - t_current),abs(t_target-t_current)) - $$c_{new} = (1 - k_c) * c_{old}$$ - ''' - c_new = truth.c * (Config.projection_decay ** (t_current - t_source)) + confidence_discount = 1 - v/(2*s + v) + c_new = truth.c * confidence_discount return Truth(truth.f, c_new, truth.k)