How to create a production

5 views
Skip to first unread message

DaReaper5

unread,
May 20, 2010, 9:36:56 AM5/20/10
to jsoar-user
Hi, I was wondering if anyone could tell me how to specifically create
a production JUST from the api or point me in the right direction. I
am looking to build a system with jsoar using JUST java code and never
programing soar code.

I am looking for a conversion of this soar code to just java code:

sp {apply*hello-world
(state <s> ^operator <o>)
(<o> ^name hello-world)
-->
(write |Hello World|)
(halt)}

I understand that there are javadocs but I am looking for an example.

If someone can provide me with a full program source code that does
what I am looking to do (possibly with a mirrored soar implementation)
that would be more than perfect.

If you could also give me some resource on how I can create more
complex productions it would be greatly appreciated. Thanks in
advance.

Sincerely,
John Finnson

--
You received this message because you are subscribed to the Google Groups "jsoar-user" group.
To post to this group, send email to jsoar...@googlegroups.com.
To unsubscribe from this group, send email to jsoar-user+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/jsoar-user?hl=en.

Dave Ray

unread,
May 20, 2010, 11:36:31 AM5/20/10
to jsoar...@googlegroups.com
John,

The code that converts textual Soar code to internal Java
representations can be found in
org.jsoar.kernel.parser.original.OriginalParserImpl, in particular the
parse_lhs() and parse_rhs() methods. These create Condition and Action
objects which can then be fed into the rete network for processing.
Conditions consist of Test objects (there are several subclasses) and
Actions can either create a WME or execute a RHS function (halt in
your example).

So, by understanding those parser methods (maybe step through with a
debugger), you could figure out which objects need to be constructed
to build your rule in Java. That said, none of these classes has been
designed for the use you describe and with their C heritage, they're
extra painful to work with. The point of the Soar language is to make
building rules as straightforward as possible, just like writing Java
code is much easier than writing machine code.

Is there a particular reason you don't want to use the Soar language
for your rules? If I know that, maybe there's a better way I can help
you find a solution. For what it's worth, the JSoar rule parser is an
interface (org.jsoar.kernel.parser.Parser) so you could in theory
replace it with your own alternative syntax.

Cheers and thanks for trying out JSoar,

Dave

John Finnson

unread,
May 20, 2010, 2:54:22 PM5/20/10
to jsoar...@googlegroups.com
Thank you for your response and I will look at those parsers.

My intentions is to asses the capability of jSoar for use in my project. I wanted to know if there is any time I would NEED to program in Soar or if i can avoid it by just programming in Java. One of my interests in this is the possible automation of creating productions through java. For example, if I have a database of non-".soar" productions, I want to create a java file to go through them and create each one for Soar. I can see through the javadoc that there are ways of creating productions (ProductionManager), I am merely looking for an example of their use.

On a side note, if you have any academic publications of jSoar, i would appreciate it if you could send me them or provide me with a link. I am a graduate student at the University of Ontario Institute of Technology. I am working with my professor in creating a large agent based system in a video game engine for criminal research.These publications would greatly help me in my decision in using jSoar.

Sincerely,
John Finnson
--

Dave Ray

unread,
May 20, 2010, 3:25:33 PM5/20/10
to jsoar...@googlegroups.com
John,

I would say you'll have a much easier time by programming agent
behavior in Soar rather than trying to encode rules in Java. My guess
is that you'll have at least a 20x expansion in lines of code
converting a typical Soar rule to the equivalent Java code to
construct the same structures.

However, automatically generating Soar rules from some data source
using Java is fairly straightforward. Just generate a string of Soar
code and pass it to the JSoar interpreter. It's not uncommon to take
this approach when generating rules from a database or something.

JSoar isn't an academic or research project. It's a pure-Java port of
the Soar cognitive architecture, which is implemented in C++. So,
there aren't any academic publications to speak of. Numerous papers
have been published about Soar itself though:
http://code.google.com/p/soar/wiki/Publications.

Dave
Reply all
Reply to author
Forward
0 new messages