<div dir="ltr"><div>Hi Dan,</div><div><br></div><div>Thank you very much for the reply.</div><div>Now I understand that the evaluate method serves the purpose.</div><div>Can you please give me a simple example invoking add chunk using evaluate if it is not taking too much of your time?</div><div>The examples you are referring is ACT-R\examples\connections\python I assume, but this one gives a reference for invoking act-r-version <br></div><div>"send(sock,'{"method":"evaluate","params":["act-r-version"],"id":1}')"</div><div><br></div><div>Thanks & Regards,</div><div>Arun<br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Jul 10, 2020 at 4:39 PM Dan Bothell <<a href="mailto:db30@andrew.cmu.edu">db30@andrew.cmu.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div bgcolor="#FFFFFF">
<p><br>
</p>
<div>On 7/10/20 7:25 AM, Arun Krishna wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">
<div>Hi,</div>
<div>My java application needs to communicate to ACT-R cognition
models via RPC.</div>
<div>In a big picture level</div>
<div>Java application -> Sent the current context information
-> ACT-R run the cognition models ->Get back the result
from ACT-R .</div>
<div>I had gone through <a href="http://act-r.psy.cmu.edu/actr7.x/remote.pdf" target="_blank">http://act-r.psy.cmu.edu/actr7.x/remote.pdf</a>
as well as some examples given in <br>
</div>
<div>\ACT-R\examples\connections\lisp . But I didn't understand
enough to use the RPC.</div>
<div>The current examples contain only two method invocations</div>
<div>
<pre style="background-color:rgb(255,255,255);color:rgb(0,0,0);font-family:"Courier New";font-size:7.2pt"><span style="font-style:italic">print</span>(<span style="color:rgb(0,128,0);font-weight:bold">"{</span><span style="color:rgb(0,0,128);font-weight:bold">\"</span><span style="color:rgb(0,128,0);font-weight:bold">method</span><span style="color:rgb(0,0,128);font-weight:bold">\"</span><span style="color:rgb(0,128,0);font-weight:bold">:</span><span style="color:rgb(0,0,128);font-weight:bold">\"</span><span style="color:rgb(0,128,0);font-weight:bold">set-name</span><span style="color:rgb(0,0,128);font-weight:bold">\"</span><span style="color:rgb(0,128,0);font-weight:bold">,</span><span style="color:rgb(0,0,128);font-weight:bold">\"</span><span style="color:rgb(0,128,0);font-weight:bold">params</span><span style="color:rgb(0,0,128);font-weight:bold">\"</span><span style="color:rgb(0,128,0);font-weight:bold">:[</span><span style="color:rgb(0,0,128);font-weight:bold">\"</span><span style="color:rgb(0,128,0);font-weight:bold">Simple Java Example</span><span style="color:rgb(0,0,128);font-weight:bold">\"</span><span style="color:rgb(0,128,0);font-weight:bold">],</span><span style="color:rgb(0,0,128);font-weight:bold">\"</span><span style="color:rgb(0,128,0);font-weight:bold">id</span><span style="color:rgb(0,0,128);font-weight:bold">\"</span><span style="color:rgb(0,128,0);font-weight:bold">:null}"</span>);
<span style="color:rgb(128,128,128);font-style:italic">// Evaluate the ACT-R "act-r-version" command.
</span><span style="color:rgb(128,128,128);font-style:italic">
</span><span style="font-style:italic">print</span>(<span style="color:rgb(0,128,0);font-weight:bold">"{</span><span style="color:rgb(0,0,128);font-weight:bold">\"</span><span style="color:rgb(0,128,0);font-weight:bold">method</span><span style="color:rgb(0,0,128);font-weight:bold">\"</span><span style="color:rgb(0,128,0);font-weight:bold">:</span><span style="color:rgb(0,0,128);font-weight:bold">\"</span><span style="color:rgb(0,128,0);font-weight:bold">evaluate</span><span style="color:rgb(0,0,128);font-weight:bold">\"</span><span style="color:rgb(0,128,0);font-weight:bold">,</span><span style="color:rgb(0,0,128);font-weight:bold">\"</span><span style="color:rgb(0,128,0);font-weight:bold">params</span><span style="color:rgb(0,0,128);font-weight:bold">\"</span><span style="color:rgb(0,128,0);font-weight:bold">:[</span><span style="color:rgb(0,0,128);font-weight:bold">\"</span><span style="color:rgb(0,128,0);font-weight:bold">act-r-version</span><span style="color:rgb(0,0,128);font-weight:bold">\"</span><span style="color:rgb(0,128,0);font-weight:bold">],</span><span style="color:rgb(0,0,128);font-weight:bold">\"</span><span style="color:rgb(0,128,0);font-weight:bold">id</span><span style="color:rgb(0,0,128);font-weight:bold">\"</span><span style="color:rgb(0,128,0);font-weight:bold">:1}"</span>);
</pre>
<pre style="background-color:rgb(255,255,255);color:rgb(0,0,0);font-family:"Courier New";font-size:7.2pt">Is there an example which does more han this with RPC, i.e communication to a count model etc?
</pre>
<pre style="background-color:rgb(255,255,255);color:rgb(0,0,0);font-family:"Courier New";font-size:7.2pt">Thanks & Regards,
</pre>
<pre style="background-color:rgb(255,255,255);color:rgb(0,0,0);font-family:"Courier New";font-size:7.2pt">Arun
</pre>
</div>
</div>
</blockquote>
<p><br>
</p>
<p>Given what you describe, it would seem the evaluate method and
the corresponding result message sent back may be all you need.
The evaluate method is used to call commands that are available
through the RPC system, and the return value(s) are sent back
using result.</p>
<p>Thus, you could evaluate ACT-R commands to set the context (add
chunks, set buffer contents, create visual features, etc),
evaluate one of the running commands to run the model, and then
evaluate commands to get information from the model, like the the
contents of buffers or the current model time.</p>
<p>The ACT-R reference manual contains details of all the commands
available remotely. Also, if you haven't done so, I would
recommend working through the ACT-R tutorial to see practical
examples of how many of the commands are used to setup and run
models. Included with the tutorial is also an implementation of
the ACT-R RPC protocol in Python which provides Python functions
to call specific ACT-R commands, which may be helpful in
understanding how to use it.<br>
</p>
<p>Hope that helps, and let me know if you have further questions,</p>
Dan
</div>
_______________________________________________<br>
ACT-R-users mailing list<br>
<a href="mailto:ACT-R-users@act-r.psy.cmu.edu" target="_blank">ACT-R-users@act-r.psy.cmu.edu</a><br>
<a href="https://mailman.srv.cs.cmu.edu/mailman/listinfo/act-r-users" rel="noreferrer" target="_blank">https://mailman.srv.cs.cmu.edu/mailman/listinfo/act-r-users</a><br>
</blockquote></div>