Archana Gurimitkala
Archana Gurimitkala

Reputation: 3

I am new to clips software, when i loaded my .clp file and run my program at last it is showing false

This is the expert system solving the car starting problem. Did i make any mistake in creating the rules. I want the output in 5 different.

(defrule r1
        (Key-fob-turns-to-run-and-hear-crank yes)
    =>
        (printout t "Hear engine sound (Yes/No)?" crlf)
        (assert (engine sound(read))))

(defrule r2
    (engine sound yes)
=>
    (printout t "If engine runs and stop after a while (Yes/No)?" crlf)
    (assert (engine runs and stop(read))))

(defrule r3
    (engine runs and stop no)
=>
    (printout t "There is no fuel, low battery or other issues." crlf))

(defrule r4
    (engine runs and stop yes)
=>
    (printout t "Check if engine light is on (Yes/No)?" crlf)
    (assert (engine light(read))))

(defrule r5
    (engine light no)
=>
    (printout t " Check for any other warning signs and take it to mechanic" crlf))

(defrule r6
    (engine light yes)
=>
    (printout t "Any service code (yes/no)?" crlf)
    (assert (service code(read))))

(defrule r7
    (service code yes)
=>
    (printout t "Read code and fix the problem" crlf))

(defrule r8
    (service code no)
=>
    (printout t "Check if it stalls in rain (Yes/No)?" crlf)
    (assert (stalls in rain(read))))

(defrule r9
    (stalls in rain yes)
=>
    (printout t "Check for cracked coil distributor" crlf))

(defrule r10
    (stalls in rain no)
=>
    (printout t "check if it stalls in warm (Yes/No)?" crlf)
    (assert (stalls in warm(read))))

(defrule r11
    (stalls in warm yes)
=>
    (printout t "Adjust idle, blow out fuel filter." crlf)
    (printout t "Check fuel pump output and check vaccum leak." crlf))

(defrule r12
    (stalls in warm no)
=>
    (printout t "ON cold stalling, check for stuck choke, EGR and check vaccum leak." crlf))

(defrule r13
    (engine sound no)
=>
    (printout t "check the belt is ok (Yes/No)?" crlf)
    (assert (belt ok(read))))

(defrule r14
    (belt ok yes)
=>
    (printout t "Fuel in tank (Yes/No)?" crlf)
    (assert (fuel in tank(read))))

(defrule r15
    (fuel in tank no)
=>
    (printout t "Add fuel." crlf))

(defrule r16
    (fuel in tank yes)
=>
    (printout t " Fuel leak (Yes/No)?" crlf)
    (assert (fuel leak(read))))

(defrule r17
    (fuel leak yes)
=>
    (printout t "Need diagnostic test." crlf))

(defrule r18
    (fuel leak no)
=>
    (printout t "Check for any other leaks and try again." crlf))

(defrule r19
    (belt ok no)
=>
    (printout t "check if there is cracked belt (Yes/No)?" crlf)
    (assert (cracked belt(read))))

(defrule r20
    (cracked belt yes)
=>
    (printout t "Mechanical distributor (Yes/No)?" crlf)
    (assert (mechanical distributor(read))))

(defrule r21
    (mechanical distributor yes)
=>
    (printout t "Check condenser, magnetic pickup and rotor." crlf))

(defrule r22
    (mechanical distributor no)
=>
    (printout t "For electronic distribution, see model manual for diagnostic checks." crlf))

(defrule r23
    (racked belt no)
=>
    (printout t "Check it is 12V at coil primary (Yes/No)?" crlf)
    (assert (coil primary(read))))

(defrule r24
    (coil primary yes)
=>
    (printout t "Check secondary output wire resistance." crlf))

(defrule r25
    (coil primary no)
=>
    (printout t "Check ignition system wiring and voltage regulator." crlf))

(defrule r26
    (Key-fob-turns-to-run-and-hear-crank no)
=>
    (printout t "starter runs (Yes/No)?" crlf)
    (assert (starter runs(read))))

(defrule r27
    (starter runs yes)
=>
    (printout t "Not enough power to turn engine." crlf))

(defrule r28
    (starter runs no)
=>
    (printout t "Battery reads ok (Yes/No)?" crlf)
    (assert (battery reads(read))))

(defrule r29
    (battery reads yes)
=>
    (printout t "Check if there is any corrosive terminals (yes/no)?" crlf)
    (assert (corrosive terminals(read))))

(defrule r30
    (corrosive terminals yes)
=>
    (printout t "Clean terminals and retry." crlf))

(defrule r31
    (corrosive terminals no)
=>
    (printout t "Check terminals are connected properly and retry." crlf))

(defrule r32
    (battery reads no)
=>
    (printout t "Change battery." crlf))

After loading this rules from assignment1.clp file from my system it is showing this. What is the solution for this? This is my first assignment and i am unable to find what are the posibility to solve this problem. What is the mistake i made please help me with this

             CLIPS (6.30 3/17/15)
    CLIPS> (load "C:/Users/Archana/Desktop/AI/AI assignment 1.CLP")
    Defining defrule: r1 +j+j
    Defining defrule: r2 +j+j
    Defining defrule: r3 +j+j
    Defining defrule: r4 +j+j
    Defining defrule: r5 +j+j
    Defining defrule: r6 +j+j
    Defining defrule: r7 +j+j
    Defining defrule: r8 +j+j
    Defining defrule: r9 +j+j
    Defining defrule: r10 +j+j
    Defining defrule: r11 +j+j
    Defining defrule: r12 +j+j
    Defining defrule: r13 +j+j
    Defining defrule: r14 +j+j
    Defining defrule: r15 +j+j
    Defining defrule: r16 +j+j
    Defining defrule: r17 +j+j
    Defining defrule: r18 +j+j
    Defining defrule: r19 +j+j
    Defining defrule: r20 +j+j
    Defining defrule: r21 +j+j
    Defining defrule: r22 +j+j
    Defining defrule: r23 +j+j
    Defining defrule: r24 +j+j
    Defining defrule: r25 +j+j
    Defining defrule: r26 +j+j
    Defining defrule: r27 +j+j
    Defining defrule: r28 +j+j
    Defining defrule: r29 +j+j
    Defining defrule: r30 +j+j
    Defining defrule: r31 +j+j
    Defining defrule: r32 +j+j

    [CSTRCPSR1] Expected the beginning of a construct.
    FALSE
    CLIPS> 

Upvotes: 0

Views: 849

Answers (1)

Gary Riley
Gary Riley

Reputation: 10757

Since the last rule in your file, r32, loads without error there is probably something after that rule causing the issue. It might be an invisible character so you might try deleting any extra lines at the bottom of your file. See also CLIPS "Expected the beginning of a construct", CLIPS Expected beginning of construct, and expected the beginning of a construct error.

Upvotes: 1

Related Questions