Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion layers/AgentModelLayer.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from .CognitiveLayer import CognitiveLayer
from resource_manager import CurrencyResource
import time

class AgentModelLayer(CognitiveLayer):
"""
Expand Down Expand Up @@ -75,4 +76,15 @@ def update_capabilities(self):

def learn(self):
"""This method could be used to incorporate new knowledge into the agent's belief system."""
pass
pass

def main_loop(self):
"""Basic execution loop for the layer."""
while True:
try:
self.process_input("loop")
self.execute()
except Exception as e:
self.logger.error(f"Main loop error: {e}")
break
time.sleep(0.1)
14 changes: 13 additions & 1 deletion layers/AspirationalLayer.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from .CognitiveLayer import CognitiveLayer
from resource_manager import CurrencyResource
from capability_manager import EthicalDecisionMakingCapability
import time

class AspirationalLayer(CognitiveLayer):
"""
Expand Down Expand Up @@ -75,4 +76,15 @@ def align_with_values(self):

def assess_ethics(self):
"""This method could be used to evaluate the ethical implications of a proposed action or decision."""
pass
pass

def main_loop(self):
"""Basic execution loop for the layer."""
while True:
try:
self.process_input("loop")
self.execute()
except Exception as e:
self.logger.error(f"Main loop error: {e}")
break
time.sleep(0.1)
13 changes: 13 additions & 0 deletions layers/CognitiveControlLayer.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from .CognitiveLayer import CognitiveLayer
from resource_manager import CurrencyResource
import time


class CognitiveControlLayer(CognitiveLayer):
Expand Down Expand Up @@ -76,3 +77,15 @@ def handle_frustration(self):
"""This method could be used to implement strategies for managing frustration, such as switching tasks or
seeking help."""
pass

def main_loop(self):
"""Basic execution loop for the layer."""
while True:
try:
self.process_input("loop")
self.execute()
except Exception as e:
self.logger.error(f"Main loop error: {e}")
break
time.sleep(0.1)

14 changes: 13 additions & 1 deletion layers/ExecutiveFunctionLayer.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from .CognitiveLayer import CognitiveLayer
from resource_manager import CurrencyResource
import capability_manager
import time

class ExecutiveFunctionLayer(CognitiveLayer):
"""
Expand Down Expand Up @@ -78,4 +79,15 @@ def allocate_resources(self):
def forecast(self):
"""This method could be used to make predictions about future events or states, which can then be used in
planning."""
pass
pass

def main_loop(self):
"""Basic execution loop for the layer."""
while True:
try:
self.process_input("loop")
self.execute()
except Exception as e:
self.logger.error(f"Main loop error: {e}")
break
time.sleep(0.1)
14 changes: 13 additions & 1 deletion layers/GlobalStrategyLayer.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from .CognitiveLayer import CognitiveLayer
from resource_manager import CurrencyResource
import time

class GlobalStrategyLayer(CognitiveLayer):
"""
Expand Down Expand Up @@ -73,4 +74,15 @@ def update_goals(self):

def assess_global_context(self):
"""This method could be used to evaluate the current global context and modify the strategy accordingly."""
pass
pass

def main_loop(self):
"""Basic execution loop for the layer."""
while True:
try:
self.process_input("loop")
self.execute()
except Exception as e:
self.logger.error(f"Main loop error: {e}")
break
time.sleep(0.1)
13 changes: 13 additions & 0 deletions layers/TaskProsecutionLayer.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from .CognitiveLayer import CognitiveLayer
from resource_manager.built_in_resources import CurrencyResource
import time


class TaskProsecutionLayer(CognitiveLayer):
Expand Down Expand Up @@ -71,3 +72,15 @@ def handle_failure(self):

def handle_success(self):
pass

def main_loop(self):
"""Basic execution loop for the layer."""
while True:
try:
self.process_input("loop")
self.execute()
except Exception as e:
self.logger.error(f"Main loop error: {e}")
break
time.sleep(0.1)

4 changes: 2 additions & 2 deletions orchestration/CognitiveArchitecture.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ def _check_thread_status(self):
Check the status of all threads.
"""
# Method to aid debug by checking on status of all threads
for key, thread in self.threads:
print(f'{key}: running={thread.running()}, done={thread.done()}')
for key, thread in self.threads.items():
print(f"{key}: alive={thread.is_alive()}")

def start_execution(self):
"""
Expand Down
7 changes: 6 additions & 1 deletion orchestration/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
from .CognitiveArchitecture import CognitiveArchitecture
from .LayerHierarchy import LayerHierarchy
from .LayerHierarchy import LayerHierarchy

__all__ = [
"CognitiveArchitecture",
"LayerHierarchy",
]