From eb069c4a9643883230dbd41741791a624366fab1 Mon Sep 17 00:00:00 2001 From: Hayodea Hakol Date: Tue, 2 Sep 2025 17:02:50 -0400 Subject: [PATCH] LRU-LIFO: Add Lufos, add LUFOs to Director This represents our realization that we can represent qualia inputs using LRU LIFOs --- smocore/include/director/director.h | 24 +++++++++++++++++++++- smocore/include/lruLifo.h | 32 +++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 smocore/include/lruLifo.h diff --git a/smocore/include/director/director.h b/smocore/include/director/director.h index 45cdb0c..ea05287 100644 --- a/smocore/include/director/director.h +++ b/smocore/include/director/director.h @@ -3,6 +3,7 @@ #include #include +#include namespace smo { namespace director { @@ -12,7 +13,28 @@ public: Director() = default; ~Director() = default; - Goal purpose; + /** EXPLANATION: + * We allow SMO to prioritize negtrins over injected goals, so that it can + * prioritize pain mitigation. We may decide to change this in the future. + * + * NB: Prioritizing negtrins is not the same as priortizing + * self-preservation...at least we don't think so at the moment of writing. + * It is definitely not desirable for SMO to prioritize self-preservation + * over our injected goals. + */ + LruLifo negtrins; + /** EXPLANATION: + * These are goals injected by Mrntt. This is how Mrntt is able to inject + * goals into the director. + */ + LruLifo injectedGoals; + /** EXPLANATION: + * These are goals chosen by the running mind. Director will always + * prioritize injected goals over chosen goals. + */ + LruLifo chosenGoals; + LruLifo postrins; + LruLifo nontrins; }; } // namespace director diff --git a/smocore/include/lruLifo.h b/smocore/include/lruLifo.h new file mode 100644 index 0000000..3a8ad77 --- /dev/null +++ b/smocore/include/lruLifo.h @@ -0,0 +1,32 @@ +#ifndef _LRU_LIFO_H +#define _LRU_LIFO_H + +#include +#include +#include + +namespace smo { + +/** EXPLANATION: + * LruLifo is a Last In First Out (LIFO) buffer with Least Recently Used (LRU) + * eviction. It is used to store a limited number of items, and the oldest item + * is removed when the buffer is full. + * + * This is used to store the most recent qualia to be processed by drctr. + * Drctr pops objects off the LruLifos in its main loop. + * + * Naturally since a mind is operating in dynamic world, we may very well be + * flooded with with too many qualia to process. Some qualia may just have to be + * dropped. So we may very well literally forget those qualia that get dropped + * from the LruLifos. (Because LruLifos have a fixed size.) + */ + +class LruLifo { +public: + LruLifo() = default; + ~LruLifo() = default; +}; + +} // namespace smo + +#endif