Real-Time Optimization Of Working Memory In Autonomous Reasoning For High-Level Control Of Cognitive Robots Deployed In Dynamic Environments