;;;====================================================== ;;; loan approval - Fuzzy logic ;;; ;;; ;;; CLIPS Version 6.0 Example ;;; ;;; To execute, merely load this and relatives.clp, reset and run. ;;;====================================================== (defrule startup => (printout t "we are approving loans" crlf ) ;(assert (rainfall light) ; establish facts about the borrower ; (temp cold) ; (set-fact-duplication TRUE) ; ) (plot-fuzzy-value t "+.*-@" nil nil (create-fuzzy-value pay low) (create-fuzzy-value pay medium) (create-fuzzy-value pay high) (create-fuzzy-value pay rich) ) (plot-fuzzy-value t "+.*-@" nil nil (create-fuzzy-value savings low) (create-fuzzy-value savings medium) (create-fuzzy-value savings high) (create-fuzzy-value savings rich)) (plot-fuzzy-value t "+.*-@^" nil nil (create-fuzzy-value age young) (create-fuzzy-value age middle) (create-fuzzy-value age old) (create-fuzzy-value age elderly)) (plot-fuzzy-value t "+.*-@^" nil nil (create-fuzzy-value monthsloan short) (create-fuzzy-value monthsloan medium) (create-fuzzy-value monthsloan long) (create-fuzzy-value monthsloan verylong)) (plot-fuzzy-value t "+.*-@^" nil nil (create-fuzzy-value monthsemployer short) (create-fuzzy-value monthsemployer medium) (create-fuzzy-value monthsemployer long) (create-fuzzy-value monthsemployer verylong)) (plot-fuzzy-value t "+.*-@^" nil nil (create-fuzzy-value approvedamount none) (create-fuzzy-value approvedamount small) (create-fuzzy-value approvedamount medium) (create-fuzzy-value approvedamount large) (create-fuzzy-value approvedamount verylarge)) (assert ; establish facts about the borrower (pay ( 3499 0) (3500 1) (3501 0) ) (savings (49000 0) (50000 1) (51000 0) ) (age (30.9 0) (31 1) (31.1 0) ) (monthsloan (8.9 0) (9 1) (9.1 0) ) (monthsemployer (57.9 0) (58 1) (58.1 0) ) ) )