(destroyctx 'domain_theory) context domain_theory nil ;;;; The following 4 predicates constitute theory T1 whereas all the theory is ;;;; theory T2 in the results shown (seg1 $x1 $x2) <- (adj $x1 $x3)(follow $x2 $x3); (seg2 $x1 $x2) <- (seg1 $x3 $x2)(follow $x1 $x3); (seg3 $x1 $x2) <- (seg2 $x3 $x2)(follow $x1 $x3); (closed_region $x1 $x2) <- (seg2 $x1 $x2)(connected $x1 $x2); (closed_region $x1 $x2) <- (seg1 $x1 $x2)(connected $x1 $x2); (closed_region $x1 $x2) <- (seg3 $x1 $x2)(connected $x1 $x2); ;;;; End of theory T1 (three_segs $x1 $x2) <- (follow $x1 $x3)(follow $x3 $x2); (four_segs $x1 $x2) <- (follow $x1 $x3)(three_segs $x3 $x2); (five_segs $x1 $x2) <- (follow $x1 $x3)(four_segs $x3 $x2); (nop_adj $x1 $x2) <- (three_segs $x1 $x2); (nop_adj $x1 $x2) <- (four_segs $x1 $x2); (nop_adj $x1 $x2) <- (five_segs $x1 $x2); (semicircle $x1 $x2) <- (nop_adj $x1 $x2)(same_x12 $x1 $x2); ;----------------------------------------------------------- ; Operational predicates; ; the semantics of the predicates is continuous valued ; according to fuzzy set theory. Boolean predicates are ; just a special case. ; the predicate "fuzzy" defines a trapezoidal fuzzy set. ; The syntax is of the type: (fuzzy (a b c d) (lisp-function)) ; where (a b c d) are four number defining the position ; of the vertex of the trapeze. ; a,b,c,d can be defined in a parametric form (as functions of k1, k2..) ; which can be tuned by the inductive algorithm ; ; The macro constraints is used in order to set the ; range of variability of parameters as well as their default value ; ; The access to attributes describing the atomic objects ; of the learning set is provided through functions ; having the same name as the internal name of the attribute itself. ; ; The function (value $x) returns the name of the constant ; bound to $x (follow $x1 $x2) <- (fuzzy (0.0 0.0 k1 (+ k1 (/ k1 5.0))) (sqrt (+ (* (- (xx1 $x1) (xx2 $x2)) (- (xx1 $x1) (xx2 $x2))) (* (- (yy1 $x1) (yy2 $x2)) (- (yy1 $x1) (yy2 $x2)))))); (connected $x1 $x2) <- (min (<> (value $x1) (value $x2)) (fuzzy (0.0 0.0 k1 (+ k1 (/ k1 5.0))) (sqrt (+ (* (- (xx2 $x2) (xx2 $x1)) (- (xx2 $x2) (xx2 $x1))) (* (- (yy2 $x2) (yy2 $x1)) (- (yy2 $x2) (yy2 $x1))))))); (adj $x1 $x2) <- (min (<> (value $x1) (value $x2)) (fuzzy (0.0 0.0 k1 (+ k1 (/ k1 5.0))) (sqrt (+ (* (- (xx1 $x2)(xx1 $x1)) (- (xx1 $x2)(xx1 $x1))) (* (- (yy1 $x2)(yy1 $x1)) (- (yy1 $x2)(yy1 $x1))))))); (angle $x1 $x2) <- (fuzzy ((- k1 (/ k2 5.0)) k1 (+ k1 k2) (+ k1 k2 (/ k2 5.0))) (- (acos (/ (- (xx2 $x2) (xx1 $x2)) (size $x2))) (acos (/ (- (xx2 $x1) (xx1 $x1)) (size $x1))))); (orient $x1) <- (if (>= (- (yy2 $x1) (yy1 $x1)) 0) (fuzzy ((- k1 (/ k2 5.0)) k1 (+ k1 k2) (+ k1 k2 (/ k2 5.0))) (acos (/ (- (xx2 $x1) (xx1 $x1)) (size $x1)))) (fuzzy ((- k1 (/ k2 5.0)) k1 (+ k1 k2) (+ k1 k2 (/ k2 5.0))) (- (acos (/ (- (xx2 $x1) (xx1 $x1)) (size $x1)))))); (long $x1) <- (fuzzy ((- k1 (/ k2 5.0)) k1 (+ k1 k2) (+ k1 k2 (/ k2 5.0))) (/ (size $x1) (diag $x1))); (eql $x1 $x2) <- (= (value $x1) (value $x2)); (diff $x1 $x2) <- (<> (value $x1) (value $x2)); (same_x12 $x1 $x2) <- (min (<> (value $x1) (value $x2)) (fuzzy (0.0 0.0 k1 (+ k1 (/ k1 5.0))) (abs (- (xx1 $x1) (xx2 $x2))))); (same_x2 $x1 $x2) <- (min (<> (value $x1) (value $x2)) (fuzzy (0.0 0.0 k1 (+ k1 (/ k1 5.0))) (abs (- (xx2 $x1) (xx2 $x2))))); (same_x1 $x1 $x2) <- (min (<> (value $x1) (value $x2)) (fuzzy (0.0 0.0 k1 (+ k1 (/ k1 5.0))) (abs (- (xx1 $x1) (xx1 $x2))))); ;--------------------------------------------------- ; Constraints on K's values (constraints follow (k1 (default (1.0)) (min 0.0) (max 3.0)(step 0.25))) (constraints connected (k1 (default (1.0)) (min 0.0) (max 3.0)(step 0.1))) (constraints adj (k1 (default (1.0)) (min 0.0) (max 3.0)(step 0.1))) (constraints angle (k1 (default (0.0))(min -3.2) (max 3.1)(step 0.5)) (k2 (default (0.4)) (min 0.0) (max 3.0)(step 0.35))) (constraints orient (k1 (default (0.5)) (min -3.2) (max 3.1)(step 0.5)) (k2 (default (0.4)) (min 0.0) (max 3.0)(step 0.35))) (constraints long (k1 (default (0.0)) (min 0.0) (max 0.8)(step 0.08)) (k2 (default (0.1)) (min 0.1) (max 0.8)(step 0.1))) (constraints same_x12 (k1 (default (1.0)) (min 0.0) (max 3.0) (step 0.5))) (constraints same_x2 (k1 (default (1.0))(min 0.0) (max 3.0)(step 0.5))) (constraints same_x1 (k1 (default (1.0))(min 0.0) (max 3.0)(step 0.5)))