RE: JESS: Using JESS for representing game states

2011-10-10 Thread John Everett
In this situation, you might want to investigate the use of the logical
conditional element to link dependent  objects in your game state. Taking
the example from the Jess manual on page 42, you assert that (water-flowing)
is dependent on (faucet-open). Then if you assert or retract (faucet-open)
Jess will automatically update the state to reflect the ramifications for
that (i.e., whether or not water is flowing). I think you could use this
mechanism to create and then incrementally modify your game state rather
than reasserting from scratch all the time.

 

From: Friedman-Hill, Ernest [mailto:ejfr...@sandia.gov] 
Sent: Monday, October 10, 2011 10:15 AM
To: jess-users
Subject: RE: JESS: Using JESS for representing game states

 

It is true that the Rete algorithm (on which Jess is based) is built on the
assumption that only a small fraction (usually quoted as 5-10%) of the
knowledge base will change on each evaluation cycle. Populating the network
from scratch is expensive and constantly resetting it does degrade
performance quite seriously.

 

On the other hand, if the whole knowledge base must be constantly
reevaluated, than no other algorithm will necessarily be any better. Rather
than searching for other tools, you might put some work into figuring out
how to preserve those parts of the KB that don't change as frequently,
rather than constantly resetting. Presumably there are stationary objects
and information about ownership and properties that don't change often.

 

  _  

From: owner-jess-us...@sandia.gov [mailto:owner-jess-us...@sandia.gov] On
Behalf Of Sam Sarjant
Sent: Sunday, October 09, 2011 5:49 PM
To: jess-users
Subject: JESS: Using JESS for representing game states

Hello, 

  I have been using JESS for some time as a rule-system for representing
states in a game (relational reinforcement learning), such that the state of
the game can be represented in terms of objects. An agent uses these states
and a decision making process (in this case defqueries to resolve rules in
conditions -> action form). Because games are very dynamic environments, the
state is constantly changing. I am currently handling this by resetting the
state and reasserting the facts of the state (then running to generate any
further facts that rules generate).

 

My question is: is JESS the best rule-system to use for this task? I know
JESS has the property of only generating facts once, but if the state is
constantly being reset, perhaps some other system would be more effective.
JESS certainly gets the job done, and I haven't really tested anything else,
but I am concerned with the speed of execution, but perhaps this is simply
due to the fact that I am using this relational representation.

 

-- 
- Thanks, Sam Sarjant 

www.samsarjant.com

 



RE: JESS: On the Performance of Logical Retractions

2011-06-12 Thread John Everett
If truth maintenance is a central part of your architecture, I recommend
Building Problem Solvers, by Kenneth Forbus and Johan de Kleer.  It's on
Amazon:

http://www.amazon.com/Building-Problem-Solvers-Artificial-Intelligence/dp/02
62061570/ref=sr_1_1?ie=UTF8&qid=1307815663&sr=8-1

and you can find the source code for the truth maintenance systems described
in the book here:

http://www.qrg.northwestern.edu/BPS/readme.html

As part of my PhD work, I developed a reasoning system based on the LTRE, a
forward-chaining rule engine on top of a logic-based TMS that is described
in Building Problem Solvers. Coming from this background, I continually find
Jess to be a Swiss Army knife of capabilities. However, if the logical
conditional in Jess is not sufficient for your architecture, you'll probably
need to implement a separate TMS layer. The logic-based TMS, which does fast
(but incomplete) Boolean constraint propagation, provides a good balance
between expressivity and efficiency. 

The problem solver architectures presented in Building Problem Solvers use
the rule engine's rules to construct a problem-specific dependency network,
through which the TMS propagates truth values.  For example, the CyclePad
system

http://www.qrg.northwestern.edu/projects/NSF/Cyclepad/aboutcp.html

enables the user to assemble and analyze thermodynamic cycles from a palette
of devices (turbines, pumps, heaters, throttles, coolers, etc). Once the
user has completed the cycle design, CyclePad runs its knowledge base of
rules to generate a dependency network that captures the relationships among
the thermodynamic properties at the inlet and outlet of each device. The
user can choose the working fluid for the system, and this imposes further
logical dependencies. For example, water will condense at certain
combinations of pressure and temperature. The user analyzes the system by
making assumptions about thermodynamic properties that the system then
propagates through the dependency network.



-John



-Original Message-
From: Ernest Friedman-Hill [mailto:ejfr...@sandia.gov] 
Sent: Saturday, June 11, 2011 8:20 AM
To: jess-users@sandia.gov
Subject: Re: JESS: On the Performance of Logical Retractions


On Jun 11, 2011, at 6:11 AM, Oliya wrote:

>
> But still I have a question: what type of truth maintenance is 
> supported in Jess? Can you provide links to more information please.


The "logical" conditional element is the only form of truth  
maintenance in Jess. I thought you said you were already using it?


> 

Ernest Friedman-Hill
Informatics & Decision Sciences, Sandia National Laboratories
PO Box 969, MS 9012, Livermore, CA 94550
http://www.jessrules.com








To unsubscribe, send the words 'unsubscribe jess-users y...@address.com'
in the BODY of a message to majord...@sandia.gov, NOT to the list
(use your own address!) List problems? Notify owner-jess-us...@sandia.gov.






To unsubscribe, send the words 'unsubscribe jess-users y...@address.com'
in the BODY of a message to majord...@sandia.gov, NOT to the list
(use your own address!) List problems? Notify owner-jess-us...@sandia.gov.




RE: JESS: Is Jess still alive, and Jess In Action

2011-05-31 Thread John Everett
I’m using Jess on a large DARPA project, and I find it to be a mature and 
stable platform. The mailing list goes quiet but responds quickly when people 
ask questions. The Jess language is a subset of LISP, which is an obvious 
touchpoint for religious debates, so if you’re looking for a “reason” to 
disprefer Jess, it’s right there. On the other hand, the integration with Java 
is robust, to the point where you can interact entirely with the rule engine 
via Java if you wish. The rule engine itself has a rich feature set and appears 
to implement the Rete algorithm efficiently. The original developer and author 
of Jess in Action, Ernest Friedman-Hill, responds promptly and thoughtfully to 
technical questions posted to the mailing list.

 

-John

 

From: Jason Morris [mailto:jason.c.mor...@gmail.com] 
Sent: Tuesday, May 31, 2011 7:13 PM
To: jess-users@sandia.gov
Subject: Re: JESS: Is Jess still alive, and Jess In Action

 

I have been waiting a LONG time for someone besides me to ask this question.
Can't wait to hear the answer ;-)

On Tue, May 31, 2011 at 5:35 PM, Paul Gifford  wrote:

Hi,

 

  We're looking at a couple of Java rules engines, Jess among them.  It's been 
a couple of years since the site has been updated - is Jess still under active 
development?  

 

  I've started reading through Jess In Action.  The book was published in 2003 
- is it still applicable to the 2008 version of Jess?

 

Thanks,

 

Paul

 

 




-- 
Cheers,
Jason
--
Morris Technical Solutions LLC
consult...@morris-technical-solutions.com
(517) 304-5883



RE: JESS: Jess Rule Question - need help!

2011-01-06 Thread John Everett
Derek,



The year is young, but this may be a contender for Most Open Ended Question
of 2011. As a first step, you'll need to define your Jess data structures.
Assuming that you'll be pulling employee data from an RDBMS, you'll probably
want to start with the relevant schema from there. Then you'll need to
decide how to flow data between Jess and the schema. The online Jess manual
has an extensive discussion of the alternatives available. For example, Jess
supports shadow facts, which can provide a bridge between Java objects and
Jess facts.



With the caveat that I haven't run or debugged this code, here's a simple
example, using Jess templates (and ignoring where the data comes from):



(deftemplate employee

  (slot uid) ;unique identifier, possibly SSN (or not
depending on applicable HIPAA regulations)

  (slot last-name)

  (slot first-name)

  (slot DOB)  ;date of birth

  (slot spouse-uid))



(deftemplate spouse

  (slot uid) ;unique identifier, possibly SSN (or not
depending on applicable HIPAA regulations)

  (slot last-name)

  (slot first-name)

  (slot DOB)  ;date of birth

  (slot spouse-uid)) ;this is the identifier of the employee married to the
spouse



(defrule benefit-cost-calculation

(employee (UID ?emp-uid) (DOB ?emp-DOB) (spouse-UID ?spouse-UID))

(spouse (UID ?spouse-UID) (DOB ?spouse-DOB))

=>

;; Here you write the logic for computing the benefits cost

   ;; Refer to http://www.jessrules.com/doc/70/index.html

   (bind ?benefits-cost (+ (emp-benefit-cost ?emp-DOB) (spouse-benefit-cost
?spouse-DOB))

   (assert (benefits-cost ?emp-uid ?benefits-cost)))





;; This is one approach, illustrating the use of a Jess deffunction

;; However, you might want to make the benefits computation more
declarative, rather than embedding the table in a function

;; that you would have to edit each time the costs change, so another
approach  would be to assert each person's age as a Jess fact

;; and use that as the trigger for a set of rules that assert the
appropriate benefits  cost.



(deffunction emp-benefit-cost (?DOB)

   (bind ?age (calc-age ?DOB))

   (if (< ?age 29) then

   (return 11.55)

elif (< 29 ?age 39) then

  ;;etc.

   ))





(defrule benefit-age-calculation

(employee (UID ?emp-uid) (DOB ?emp-DOB) (spouse-UID ?spouse-UID))

(spouse (UID ?spouse-UID) (DOB ?spouse-DOB))

=>

   (bind ?emp-age (calc-age ?emp-DOB))

   (bind ?spouse-age (calc-age ?spouse-DOB))

  (bind ?today (get-current-date)) ;;so that you don't trigger on old
employee-age statements left in Jess memory

   (assert (employee-age-as-of (today ?today) (age ?emp-age) (UID ?emp-UID))

  (assert (spouse-age-as-of (today ?today) (age ?spouse-age)  (UID
?spouse-UID)))



(defrule benefit-cost-calculation

 (today ?date)

 (employee-age-as-of (today ?date) {age < 29} (UID ?emp-UID))

 =>

 (employee-benefits-cost (UID ?emp-UID) 11.55))



I leave it as an exercise for the reader to write the rest of the rules of
older employees, the equivalent rule set for the spouse, the rule that would
combine the two costs to provide a total cost, and the logic to handle
single employees.



Finally, to completely separate the benefits data, which is likely to change
from year to year, from the code, which should not, you might consider the
use of defglobal variables:



(defglobal *emp-benefit-cost-18-to-29* 11.55)



(defrule benefit-cost-calculation

 (today ?date)

 (employee-age-as-of (today ?date) {age < 29} (UID ?emp-UID))

 =>

 (employee-benefits-cost (UID ?emp-UID) *emp-benefit-cost-18-to-29*))



This suggests yet another exercise for the reader, in that the age range
bands may also be subject to change, so you might want to abstract those as
well, rather than leaving that constant 29 in the body of the rule.







Hopefully this will be enough to get you started. The Jess documentation on
the web is comprehensive, so I suggest that you start with a toy example
like this and gradually increase the complexity, referring to the
documentation as necessary, until you have what you need. For example, check
out Chapter 9, Jess Application Design, to understand the different ways you
can use Jess. Also, you'll need at least some knowledge of LISP,
particularly for writing functions. Refer to
http://www.lisp.org/alu/res-lisp as a starting point.



-John





From: Derek Adams [mailto:dad...@arahant.com]
Sent: Wednesday, January 05, 2011 12:50 PM
To: jess-users@sandia.gov
Subject: JESS: Jess Rule Question - need help!



Hey Jess Users!  This is my first post, so I apologize for anything "noob"
that I say/do...

I'm very new to Jess.  I understand the basics but applying my knowledge for
the first time is proving more difficult than I anticipated.  Here is the
problem:

I need to set up a rule in Jess that calculates the cost of a benefit based
on age and enrollees.

Example:
T

RE: JESS: Get fact's slot value

2010-11-22 Thread John Everett
Jess is a rule language whose basic mechanism is pattern matching, which
binds pattern variables to constants. If you have a fact of the form

(person (name Fred) (age 22))

then you can issue a query of the form

(person (name ?name) (age ?age))

and it will bind ?name to Fred and ?age to 22 (if Fred is the only person in
your database).

You can do this with a defQuery or a rule. As you're new to Jess, you really
ought to work your way through some of the tutorial material available, as
Jess (and rule engines in general) operate quite differently from
conventional programming languages.  You can learn quite a lot from the Jess
manual in a few hours of poking around.

-John

-Original Message-
From: alvin0618 [mailto:alvin_ng0...@live.com] 
Sent: Monday, November 22, 2010 9:47 AM
To: jess-users@sandia.gov
Subject: JESS: Get fact's slot value


(deftemplate person (slot name (type STRING)) (slot age (type INTEGER)))

(bind ?new (assert (person (name Fred) (age 22

=
The question is how do i get the binded fact's slot value, name and age???
Could any provide help to me~
I'm new in JESS language
-- 
View this message in context:
http://old.nabble.com/Get-fact%27s-slot-value-tp30279338p30279338.html
Sent from the Jess mailing list archive at Nabble.com.




To unsubscribe, send the words 'unsubscribe jess-users y...@address.com'
in the BODY of a message to majord...@sandia.gov, NOT to the list
(use your own address!) List problems? Notify owner-jess-us...@sandia.gov.






To unsubscribe, send the words 'unsubscribe jess-users y...@address.com'
in the BODY of a message to majord...@sandia.gov, NOT to the list
(use your own address!) List problems? Notify owner-jess-us...@sandia.gov.




RE: JESS: representation of deftemplate from deffacts

2010-11-22 Thread John Everett
Debasish,



If you want to create an explicit template, it should look like this:



(deftemplate MAIN::opposite-of

(slot entity-A)

   (slot entity-B))



Then the facts would be declared as:



(opposite-of (entity-A shore-1) (entity-B shore-2))



However, you'd also have to assert



(opposite-of (entity-A shore-2) (entity-B shore-1))



This will lead to problems with rules firing twice, once on each opposite-of
assertion. To handle that, you can adopt a convention that all commutative
relations, such as opposite-of, are expressed with arguments in canonical
order (e.g., sorted alphabetically):



(deftemplate MAIN::canonical-opposite-of

  (multislot entities))



This will result in facts of the form



  (canonical-opposite-of (entities shore-1 shore-2))



you will have to make sure that facts of the form



  (canonical-opposite-of (entities shore-2 shore-1)) ;;NOT CANONICAL



are never asserted. Also, when you assert a fact you'll to make sure that
the arguments are sorted in the right order (e.g., by applying a
deffunction).



Hope this helps.



-John







From: debasish.da...@cognizant.com [mailto:debasish.da...@cognizant.com]
Sent: Monday, November 22, 2010 3:38 AM
To: jess-users@sandia.gov
Subject: JESS: representation of deftemplate from deffacts



Hi Jess-users,



Just trying to understand, how the following deffacts can represent in
deftemplate?



(deffacts MAIN::opposites

  (opposite-of shore-1 shore-2)

  (opposite-of shore-2 shore-1))



Jess is creating a *implied* template for this as below.

(deftemplate MAIN::opposite-of

   "(Implied)"

   (multislot __data))



Here the term *__data* is not very much clear, since if I keep this as
template explicitly as follows -

(deftemplate MAIN::opposite-of

   (multislot __data))



The ruleset is running fine as expected, and JESS is not creating again the
*implied* template in this case. But, if I change it to some other name, say
*data* instead of *__data*, JESS engine throwing a exception (Jess reported
an error in routine Jesp.parseFact.)while parsing the above fact.



Also, if I create the template as follows using *slot*.

(deftemplate MAIN::opposite-of

(slot shore-1)

   (slot shore-2))



But in this case, the deffacts needs to be defined as follows, which seems
not same as mentioned above, and the rule is not working as expected.



(deffacts MAIN::opposites

  (opposite-of (shore-1 shore-2))

  (opposite-of (shore-2 shore-1)))



OR



(deffacts MAIN::initial-opposite-of

  (opposite-of (shore-1 shore-2)

  (shore-2 shore-1)))



So, if anyone can clarify this.



Regards



DEBASISH DALUI (122816)
---

BFS - Technology Solutions Group,

Cognizant Technology Solutions,


Cell: +91 9674069478

Office: +91-33-44306060; VNet: 336063




This e-mail and any files transmitted with it are for the sole use of the
intended recipient(s) and may contain confidential and privileged
information.
If you are not the intended recipient, please contact the sender by reply
e-mail and destroy all copies of the original message.
Any unauthorised review, use, disclosure, dissemination, forwarding,
printing or copying of this email or any action taken in reliance on this
e-mail is strictly
prohibited and may be unlawful.





JESS: Eclipse Jess editor crash

2010-10-05 Thread John Everett
I'm finding that opening a Jess .clp file that has errors (e.g., it doesn't
find a (requires*.) file, or there is no template defined for a rule
trigger) causes Eclipse to freeze. This only happens if I use the Jess
editor-I can open the .clp file in Eclipse by right clicking on it and
choosing to open with a text editor. I'm running Eclipse Helios on 64-bit
Windows 7 with the current version of Jess, so this may well be the result
of having an unusual environment, but if anyone happens to know of a
solution, please let me know.

 

regards,

 

-John



smime.p7s
Description: S/MIME cryptographic signature