1
차 앞에 장애물이 있는지 확인하려고합니다. 자동차 위치 "2"에 있다고 가정 해 봅시다. 내 목표는 "3"위치에 장애물이 있는지 확인하는 것입니다. 특정 위치에 장애물이 없다는 것을 의미하는 장애물이 정의되지 않았을 수 있습니다. 나는 을 사용하여을 조건부로 사용하는지 확인합니다. 하지만 CLIPS 구문 오류 이 부분에 대한(+? location_car 1) 규칙 r6에 대한 내용입니다. 내가 첨가물을 버리면 작동하지. 어떤 대안을 사용할 수 있습니까, 아니면 방금 구문 구문이 누락 되었습니까?존재 조건 내에서 추가를 올바르게 사용하는 방법은 무엇입니까? CLIPS
(deftemplate car
(slot location)
)
(deftemplate obstacles
(slot location) ; location of road segment
(slot tlights) ; number of red traffic lights
(slot cars) ; number of cars which have priority drive through
(slot pedestrians) ; number of pedestrians crossing the road
(slot spec_service) ; number of spec service vehicles passing by
)
(deffacts faktu-inicializavimas
(car (location 0))
(obstacles (location 9) (tlights 1) (cars 2) (pedestrians 5) (spec_service 2))
)
(defrule r6 "Drive to location"
?fact-id1 <- (car (location ?location_car))
(or
(exists (obstacles (location (+ ?location_car 1)) (tlights 0) (cars 0) (pedestrians 0) (spec_service 0)))
(not
(exists (obstacles (location (+ ?location_car 1))))
)
)
=>
(printout t "Drive to location")
(modify ?fact-id1 (location (+ ?location_car 2)))
)