You don't need to do anything to the arguments tab unless you want it to be
specifically
to run some program all the time. I was speculating that you might have done
this
since I didn't see any commands that you typed to load the program, reset, and
run, etc.
So what you are doing is fine.
As for the other example, the code you have appears to be bad. Below is the
correct code.
When I run this example I get the following output:
*********************************************************************
Jess, the Rule Engine for the Java Platform
Copyright (C) 2006 Sandia Corporation
Jess Version 7.1a3 10/3/2007
Jess> (batch f:/FuzzyJ.Paper/Demo1.clp)
TRUE
Jess> (reset)
TRUE
Jess> (run)
For temp = 0.0 Fan speed set to 166.66666666666666 RPM
For temp = 2.0 Fan speed set to 210.15981735159815 RPM
For temp = 4.0 Fan speed set to 249.43502824858754 RPM
For temp = 6.0 Fan speed set to 284.89375830013284 RPM
For temp = 8.0 Fan speed set to 316.6102650874225 RPM
For temp = 10.0 Fan speed set to 345.4861111111111 RPM
For temp = 12.0 Fan speed set to 373.463056965595 RPM
For temp = 14.0 Fan speed set to 402.29083665338646 RPM
For temp = 16.0 Fan speed set to 432.4858757062147 RPM
For temp = 18.0 Fan speed set to 464.6499238964992 RPM
For temp = 20.0 Fan speed set to 500.0 RPM
For temp = 22.0 Fan speed set to 546.354852876592 RPM
For temp = 24.0 Fan speed set to 587.8058563979142 RPM
For temp = 26.0 Fan speed set to 626.5369430344049 RPM
For temp = 28.0 Fan speed set to 663.9491745501762 RPM
For temp = 30.0 Fan speed set to 704.1062801932367 RPM
For temp = 32.0 Fan speed set to 750.5649717514124 RPM
For temp = 34.0 Fan speed set to 803.8390164694965 RPM
For temp = 36.0 Fan speed set to 833.3333333333333 RPM
For temp = 38.0 Fan speed set to 833.3333333333333 RPM
For temp = 40.0 Fan speed set to 833.3333333333333 RPM
For temp = 42.0 Fan speed set to 833.3333333333333 RPM
For temp = 44.0 Fan speed set to 833.3333333333333 RPM
For temp = 46.0 Fan speed set to 833.3333333333333 RPM
For temp = 48.0 Fan speed set to 833.3333333333333 RPM
For temp = 50.0 Fan speed set to 833.3333333333333 RPM
69
Jess>
***********************************************************************
******************** The program code ********************************
;; A simple example of a FuzzyJess application
(import nrc.fuzzy.*)
;; Two globals to hold our FuzzyVariables for air temperature and fan speed
(defglobal ?*airTempFvar* = (new FuzzyVariable "airTemperature" 0.0 100.0
"Degrees C"))
(defglobal ?*fanSpeedFvar* = (new FuzzyVariable "fanSpeed" 0.0 1000.0 "RPM"))
;; An initialization rule that adds the terms to the FuzzyVariables
(defrule init
=>
;; the nrc FuzzyJess functions are loaded
(load-package nrc.fuzzy.jess.FuzzyFunctions)
(bind ?rlf (new RightLinearFunction))
(bind ?llf (new LeftLinearFunction))
;; terms for the air temperature Fuzzy Variable
(?*airTempFvar* addTerm "cold" (new RFuzzySet 0.0 20.0 ?rlf))
(?*airTempFvar* addTerm "OK" (new TriangleFuzzySet 0.0 20.0 35.0))
(?*airTempFvar* addTerm "hot" (new LFuzzySet 20.0 35.0 ?llf))
;; terms for the fan speed Fuzzy Variable
(?*fanSpeedFvar* addTerm "low" (new RFuzzySet 0.0 500.0 ?rlf))
(?*fanSpeedFvar* addTerm "medium" (new TriangleFuzzySet 250.0 500.0 750.0))
(?*fanSpeedFvar* addTerm "high" (new LFuzzySet 500.0 1000.0 ?llf))
;; assert the first the fuzzy input -- temperature at 0.0
(bind ?t 0.0)
(assert (crispAirTemp ?t))
(assert (airTemp (new FuzzyValue ?*airTempFvar* (new TriangleFuzzySet ?t ?t
?t))))
)
;; the rule 'if air temperature cold then set fan speed low'
(defrule temp-cold-fanSpeed-low
(airTemp ?t&:(fuzzy-match ?t "cold"))
=>
(assert (fanSpeed (new FuzzyValue ?*fanSpeedFvar* "low")))
)
;; the rule 'if air temperature OK then set fan speed medium'
(defrule temp-OK-fanSpeed-medium
(airTemp ?t&:(fuzzy-match ?t "OK"))
=>
(assert (fanSpeed (new FuzzyValue ?*fanSpeedFvar* "medium")))
)
;; the rule 'if air temperature hot then set fan speed high'
(defrule temp-hot-fanSpeed-high
(airTemp ?t&:(fuzzy-match ?t "hot"))
=>
(assert (fanSpeed (new FuzzyValue ?*fanSpeedFvar* "high")))
)
;; the rule to control the printing of results and initiating next iteration
(defrule control
;; in order for the effect on fan speed that results from all of
;; 3 rules to be combined globally we must wait until the 3 rules
;; have all fired ... low salience for this rule achieves this
(declare (salience -100))
?catf <- (crispAirTemp ?t)
?fatf <- (airTemp ?)
?fsf <- (fanSpeed ?fuzzyFanSpeed)
=>
;; defuzzify the fan speed fuzzy value and print out the result
(bind ?crispFanSpeed (?fuzzyFanSpeed momentDefuzzify))
(printout t "For temp = " ?t " Fan speed set to "
?crispFanSpeed " RPM" crlf
)
;; move on to the next iteration if we need to
(bind ?t (+ ?t 2.0))
(if (<= ?t 50.0) then
(retract ?catf ?fatf ?fsf)
(assert (crispAirTemp ?t))
(assert (airTemp (new FuzzyValue ?*airTempFvar* (new TriangleFuzzySet
?t ?t ?t))))
)
)
Bob Orchard
National Research Council Canada Conseil national de recherches Canada
Institute for Information Technology Institut de technologie de l'information
1200 Montreal Road, Building M-50 M50, 1200 chemin Montréal
Ottawa, ON, Canada K1A 0R6 Ottawa (Ontario) Canada K1A 0R6
(613) 993-8557
(613) 952-0215 Fax / télécopieur
[EMAIL PROTECTED]
Government of Canada | Gouvernement du Canada
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of seyed hossein
> Sent: Friday, July 25, 2008 12:30 PM
> To: [email protected]
> Subject: Re: JESS: Installing Fuzzy on Jess
>
> Thanks alot Mr. Orchard for your time,
> To run your example (in "How to use the Fuzzy Extensions with
> Jess") I simply set the "Jess main class" under the "Jess
> Application" tab in Run Configurations to
> nrc.fuzzy.jess.FuzzyMain, but didn't know what to do with the
> "Arguments" tab so I left it blank and runned the example.
> Should we set the "Program arguments" or "VM arguments" under
> the arguments tab to something??
> Also, regarding the other example I found in
> FuzzyJessNRC-44882.pdf (attached to this email), once I run
> it (from run configurations...), it gives a whole lot of
> errors which some are following the example code here;
>
> (import nrc.fuzzy.*)
> ;; Two globals to hold our FuzzyVariables for air temperature
> and fan speed (defglobal ?*airTempFvar* = new FuzzyVariable
> "airTemperature" 0.0 100.0 "Deg C")) (defglobal
> ?*fanSpeedFvar* = (new FuzzyVariable "fanSpeed" 0.0 1000.0
> "RPM"))
> (defrule init "An initialization rule that adds the terms to
> the FuzzyVariables"
> =>
> ;; the nrc FuzzyJess functions are loaded (load-package
> nrc.fuzzy.jess.FuzzyFunctions) (bind ?rlf (new
> RightLinearFunction)) (bind ?llf (new LeftLinearFunction)) ;;
> terms for the air temperature Fuzzy Variable and fan speed
> Fuzzy Variable
> (?*airTempFvar* addTerm "cold" (new RFuzzySet 0.0 20.0 ?rlf))
> (?*airTempFvar* addTerm "OK" (new TriangleFuzzySet 0.0 20.0 35.0))
> (?*airTempFvar* addTerm "hot" (new LFuzzySet 20.0 35.0 ?llf))
> (?*fanSpeedFvar* addTerm "low" (new RFuzzySet 0.0 500.0 ?rlf))
> (?*fanSpeedFvar* addTerm "medium" (new TriangleFuzzySet 250.0
> 500.0 750.0))
> (?*fanSpeedFvar* addTerm "high" (new LFuzzySet 500.0 1000.0
> ?llf)) ;; assert the first the fuzzy input -- temperature at
> 0.0 (assert (crispAirTemp 0.0)) (assert (airTemp (new
> FuzzyValue ?*airTempFvar* (new TriangleFuzzySet 0.0 0.0
> 0.0))))) (defrule temp-cold-fanSpeed-low "if air temperature
> cold then set fan speed low"
> (airTemp ?t&:(fuzzy-match ?t "cold"))
> =>
> (assert (fanSpeed (new FuzzyValue ?*fanSpeedFvar* "low"))))
> (defrule temp-OK-fanSpeed-medium "if air temperature OK then
> set fan speed medium"
> (airTemp ?t&:(fuzzy-match ?t "OK"))
> =>
> (assert (fanSpeed (new FuzzyValue ?*fanSpeedFvar*
> "medium")))) (defrule temp-hot-fanSpeed-high "if air
> temperature hot then set fan speed high"
> (airTemp ?t&:(fuzzy-match ?t "hot"))
> =>
> (assert (fanSpeed (new FuzzyValue ?*fanSpeedFvar* "high"))))
> (defrule control "printing of results and initiating next iteration"
> ;; to combine output of all 3 rules we must wait until the 3
> rules ;; have all fired ... low salience for this rule
> achieves this (declare (salience -100)) ?catf <-
> (crispAirTemp ?t) ?fsf <- (fanSpeed ?fuzzyFanSpeed) => ;;
> defuzzify the fan speed fuzzy value and print out the result
> (bind ?crispFanSpeed (?fuzzyFanSpeed momentDefuzzify)) (bind
> ?t (+ ?t 2.0)) (printout t "For temp = " ?t " Fan speed set
> to "?crispFanSpeed " RPM" crlf) (if (<= ?t 50.0) then
> (retract ?catf ?fsf) (assert (crispAirTemp ?t)) (assert
> (airTemp (new FuzzyValue ?*airTempFvar* (new TriangleFuzzySet ?t ?t
> ?t))))))
> ;;Some of the output of this FuzzyJess system is shown below
> (identical to the output from the Java ;;version).
> ;;For temp = 18.0 Fan speed set to 464.6499238964992 RPM
> ;;For temp = 20.0 Fan speed set to 500.0 RPM ;;For temp =
> 22.0 Fan speed set to 546.354852876592 RPM
>
> Some errors it produced are:
>
> Jess, the Rule Engine for the Java Platform Copyright (C)
> 2008 Sandia Corporation Jess Version 7.1b3 4/2/2008
>
> Jess reported an error in routine Jesp.parseDefglobal.
> Message: Expected a variable name at token 'FuzzyVariable'.
> Program text: ( defglobal ?*airTempFvar* = new
> FuzzyVariable at line 4=
>
--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the list
(use your own address!) List problems? Notify [EMAIL PROTECTED]
--------------------------------------------------------------------