Requirement for using PyClips and NWS to create a crowd of intelligent Actors
1. Registering with Remote-Assert-Agent (on same node as NWSServer)
NetWorkSpaces (NWS) is one way to write parallel programs. It allows you to take advantage of a multi-core machine; multiple virtual machines, as well as cloud-based clusters, using languages such as Python, R, Java, and Matlab. With NetWorkSpaces for Python, you can execute Python functions and programs in parallel using methods very much like the standard Python map function. In some cases, you may be able to parallelize your program in minutes, rather than months.
Once we have a work space, we can write data into a variable using the
store method:
>>>'Agent', 'Agent1')
2. Each PyClips Instance is a Named Actor and can request Roles
Once we have a work space, we can write data into a variable using the
store method:
>>>'Role', 'Worker')
3. PyClips blocks (Fetch) when there are no rules to fire; does FetchTry polling between rule executions.
>>> new work = ws.find('Agent1')

4. Python Functions available in the Right Hand Side of Rules
PyCLIPS gives the ability to users to call Python code from within the CLIPS subsystem. Virtually every function defined in Python can be called from CLIPS code using the special CLIPS function python-call. However, since CLIPS has different basic types than Python, in most cases it would be useful for modules that implement function to be called in the CLIPS engine to import the PyCLIPS module themselves, in order to be aware of the structures that CLIPS uses.
Functions have to be registered in PyCLIPS in order to be available to the underlying engine, and the registration process can dynamically occur at any moment.
A simple example follows:
>>> import clips
>>> def py_square(x):
return x * x
>>> clips.RegisterPythonFunction(py_square)
>>> print clips.Eval("(python-call py_square 7)")
>>> print clips.Eval("(python-call py_square 0.7)")