Скачать презентацию g SKI Tg DI and the Updated Soar Скачать презентацию g SKI Tg DI and the Updated Soar

32ac9312b2d38f6d59b8bec8b0477534.ppt

  • Количество слайдов: 23

g. SKI, Tg. DI and the Updated Soar Kernel Vini Vidi Coivi g. SKI, Tg. DI and the Updated Soar Kernel Vini Vidi Coivi

The Big Picture n n n Soar Technology spent about a man-year developing a The Big Picture n n n Soar Technology spent about a man-year developing a new interface for Soar After over a year of in-house testing with g. SKI, Tg. DI and a modified Soar Kernel, and further evaluation by the University of Michigan, It was decided that Soar Technology would release all of this work back to the Soar Community under an Open Source License We are currently working with the University to integrate in all of the recent changes to the Soar Kernel and release it as Soar 8. 6 when it is ready.

Why Any Of This Matters n These tools dramatically improve the efficiency with which Why Any Of This Matters n These tools dramatically improve the efficiency with which you can integrate with new systems. * n n n My ad hoc evaluation has shown a 5 x to 10 x improvement in development productivity Additional support libraries have added an additional 2 x to 3 x improvement It makes maintaining Soar systems easier * This is specifically with respect to the Soar side of integration, not the end system integration

Some of the Systems We Have Integrated With One. SAF Testbed (OTB) n Co. Some of the Systems We Have Integrated With One. SAF Testbed (OTB) n Co. ABS Grid n JSAF n VR-Forces n VISTA 2 n Joint Battlespace Infosphere (JBI) n

Soar System Architecture Soar System Architecture

(g. SKI Related) Soar Kernel Changes n n The Kernel is now in C++ (g. SKI Related) Soar Kernel Changes n n The Kernel is now in C++ The Kernel is thread-safe on a per-agent basis n n The Kernel provides callbacks at a variety of location throughout the kernel Refactored the kernel in to smaller more manageable pieces n n No mutable global data No global agent pointers/data Soarkernel. h went from ≈4000 lines to 172 lines Most macros eliminated in favor of inline CPP functions

What Next for the new Soar Kernel? Improved Test Suite n Evaluation of Memory What Next for the new Soar Kernel? Improved Test Suite n Evaluation of Memory Issues n Initialization/Re-initialization n More Cleanup n New Interrupt Mechanism n Definition of Soar n Release n

What is g. SKI? generic Soar Kernel Interface n An interface between agents and What is g. SKI? generic Soar Kernel Interface n An interface between agents and applications n A system that works on both Windows and Linux n A Much Easier interface between agents and applications n The thing that makes me look good n

g. SKI Interfaces g. SKI Interfaces

g. SKI Status---Where are we? There is sufficient functionality to accomplish all of our g. SKI Status---Where are we? There is sufficient functionality to accomplish all of our system integration tasks n There is insufficient functionality to provide all of the debugging tasks we would like to accomplish n New perspective on system integration n

What next for g. SKI Improved reference counting n Finish up remaining functionality n What next for g. SKI Improved reference counting n Finish up remaining functionality n Primary Working Memory n Matches n Etc. n n Test Suite

What is the Tg. DI TCL/g. SKI Debugger Interface n Integrates (most of ) What is the Tg. DI TCL/g. SKI Debugger Interface n Integrates (most of ) the TSI functionality through g. SKI n Maintains backward compatibility with earlier system developed with the TSI n

Tg. DI Status---Where are we? n Implemented n n n n n echo excise Tg. DI Status---Where are we? n Implemented n n n n n echo excise firing-counts gds_print init-soar learn matches new-agent output-strings-destination preferences print production-find rete-net run set-default-depth sp stop-soar waitsnc watch stats n Unimplemented n add-wme n n n ask n attention-lapse attribute-preferences-mode n n capture-input n chunk-name-format n default-wme-depth n explain-backtraces n format-watch n indifferent-selection n n input-period internal-symbols io log max-chunks max-elaborations max-nil-output-cycles memories monitor multi-attributes o-support-mode pwatch remove-wme n replay-input n soar 8 n start-attention-lapse n verbose n n wake-from-attention-lapse warnings

What’s Next for the Tg. DI? Completed TSI interface will all relevant functionality n What’s Next for the Tg. DI? Completed TSI interface will all relevant functionality n Upgrade to the latest version of the TSI n Peaceful death (although it will probably slow and painful) n

Examples Simple Example: Create one agent and run in TSI. int main() { IKernel. Examples Simple Example: Create one agent and run in TSI. int main() { IKernel. Factory* k. F = g. SKI_Create. Kernel. Factory(); IKernel* k = k. F->Create(); IAgent. Manager* IAM = k->Get. Agent. Manager(); IAgent* agent = IAM->Add. Agent("Production. Test. Agent"); Tg. D: : Tg. D* debugger = Create. Tg. D(agent, k, Tg. D: : TSI 25); debugger->Init(); while(1) { Tg. D: : Update(false, debugger); TGD_SLEEP(50); } return 0; }

Examples (continued) Example: Create one agent and run in TSI with cyclecount on input Examples (continued) Example: Create one agent and run in TSI with cyclecount on input link. class Input. Producer: public IInput. Producer { private: int m_count; IWme* m_wme; public: // Simple constructor Input. Producer(): m_count(0), m_wme(0) {} // Virtual destructor for the usual reasons virtual ~Input. Producer() { // Letting go of reference to the cycle-count wme if ( m_wme ) { m_wme->Release(); } } // Update function required by IInput. Producer interface // (Responsible for updating state of working memory) virtual void Update(IWorking. Memory* wmemory, IWMObject* obj) { // Getting the decision cycle count int ccount; ccount = wmemory->Get. Agent()-> Get. Num. Decision. Cycles. Executed(); if ( m_wme == 0 ) { // Possibly move this to the constructor m_wme = wmemory->Add. Wme. Int(obj, "cycle-count", ccount); } else { m_wme = wmemory->Replace. Int. Wme(m_wme, ccount); } } }; -----------------------------Input. Producer* piprod = new Input. Producer(); IInput. Link* ilink = agent->Get. Input. Link(); IWMObject* wmobj; ilink->Get. Root. Object(&wmobj); ilink->Add. Input. Producer(wmobj, piprod); wmobj->Release();

Examples (continued) Example: Add the ability to write output-link commands to an XML file. Examples (continued) Example: Add the ability to write output-link commands to an XML file. class Output. Processor: public IOutput. Processor { public: Output. Processor() {} virtual ~Output. Processor() {} virtual void Process. Output(IWorking. Memory* working. Memory, IWMObject* obj){ // Iterating over children std: : set written. Objects; std: : cout << "" << std: : endl; Recursively. Write. XMLFrom. Object(obj, std: : cout, written. Objects, 1); std: : cout << "" << std: : endl; // Marking the top-level object as processed working. Memory->Add. Wme. String(obj, "processed", "*yes*"); } void Write. Tabs(std: : ostream& ostr, unsigned int tab. Count) { for (unsigned int i = 0; i < tab. Count; ++i) { ostr << "t"; } } }; void Recursively. Write. XMLFrom. Object( IWMObject* obj, std: : ostream& ostr, std: : set& written. Objects, unsigned int tab. Count = 0){ if ( obj == 0 ) return; // If I've already written this object then don't write it again // if not then Add the object to the set of written objects if ( written. Objects. find(obj) != written. Objects. end()) return; written. Objects. insert(obj); // Getting all the child wmes t. IWme. Iterator* it = obj->Get. WMEs(); // Iterating over the wmes associated with this object for (; it->Is. Valid(); it->Next() ) { IWme* wme = it->Get. Val(); const ISymbol* attr = wme->Get. Attribute(); const ISymbol* val = wme->Get. Value(); IWMObject* obj = 0;

Examples (continued) Example: Add the ability to write output-link commands to a file. switch Examples (continued) Example: Add the ability to write output-link commands to a file. switch (val->Get. Type()) { case g. SKI_OBJECT: // Handling these in the next iteration loop // Write the opening tag contents and then closing tag obj = val->Get. Object(); Write. Tabs(ostr, tab. Count); ostr << "<" << attr->Get. String() << ">" << std: : endl; Recursively. Write. XMLFrom. Object( val->Get. Object(), ostr, written. Objects, tab. Count+1); Write. Tabs(ostr, tab. Count); ostr << "Get. String() << ">" << std: : endl; break; case g. SKI_STRING: case g. SKI_VARIABLE: // Write out a simple value tag Write. Tabs(ostr, tab. Count); ostr << "<" << attr->Get. String() << " value="" << val->Get. String() << ""/>" << std: : endl; break; case g. SKI_DOUBLE: // Write out a simple value tag Write. Tabs(ostr, tab. Count); ostr << "<" << attr->Get. String() << " value="" << val->Get. Double() << ""/>" << std: : endl; break; case g. SKI_INT: // Write out a simple value tag Write. Tabs(ostr, tab. Count); ostr << "<" << attr->Get. String() << " value="" << val->Get. Int() << ""/>" << std: : endl; break; default: Mega. Assert(false, "Unknown symbol type in Output. Producer!"); break; } } it->Release(); } -----------------------------Output. Processor oproc; agent->Get. Output. Link()->Add. Output. Processor("takeoff", &oproc);

Noteworthy Interfaces n n n n IWMObject IWorking. Memory IWme. Iterator IWme ISymbol Tg. Noteworthy Interfaces n n n n IWMObject IWorking. Memory IWme. Iterator IWme ISymbol Tg. D IInput. Producer IOutput. Processor

Other Interesting Interfaces IKernel. Factory n IKernel n IAgent. Manager n IAgent n IInput. Other Interesting Interfaces IKernel. Factory n IKernel n IAgent. Manager n IAgent n IInput. Link n IOutput. Link n IError n

Not So Interesting Interfaces IProduction n IProduction. Manager n IProduction. Match n IAgent. Thread. Not So Interesting Interfaces IProduction n IProduction. Manager n IProduction. Match n IAgent. Thread. Group n ICondition. Set n IPerformance. Manager n IAgent. Performance. Manager n

Nuggets and Coal n Nuggets n n n Much improved interface Used on many Nuggets and Coal n Nuggets n n n Much improved interface Used on many projects Integrated with the University n Coal n n Not Done Release Version note ready yet

Q&A Jens Wessling Soar Technology wessling@soartech. com 6/8/2004 Q&A Jens Wessling Soar Technology [email protected] com 6/8/2004