;;; HTN version of the domain of process planning ;;; described in: ;;; ;;; Munoz-Avila, H. & Weberskirch F.: A Specification of the ;;; Domain of Process Planning: Properties, Problems, and ;;; Solutions. LSA-Report LSA-96-10E, Centre for Learning ;;; Systems and Applications, Kaiserslautern, 1996. ;;; ;;; The domain is totally re-written to make use of ;;; HTNs representations but the resulting plans ;;; are equivalent to ones generated with ;;; the original STRIPS representation albeit ;;; the following items not yet represented ;;; in the HTN representation: ;;; - orientation of the outline tools ;;; - undercuts have two parts ;;; - the sides of the workpiece ;;; - side (face) clamping ;;; ;;; Added the generic pieces ;;; ;;; Last update: January 27, 2004 ;;; Author: H. Munoz-Avila ;;; (defdomain processPlanning ( ;;; process area ?part using ?tool (:operator (!process ?part ?tool) ((compatible ?part ?tool) ) () ((processed ?part)) ) ;;; mount piece from ?part1 to process ?part ;;; ?part is rotary (:operator (!mountFromRotary ?part1 ?part) ((rotary ?part) (not (mounted ?part2)) (not (mountedFixed ?part2)) (mountable ?part1 ?part) ) () ((mounted ?part1)) ) ;;; mount piece from ?part1 to process ?part ;;; dismount piece from ?part2 ;;; ?part is rotary (:operator (!mountFromRotary ?part1 ?part) ((rotary ?part) (mounted ?part2) (mountable ?part1 ?part) ) ((mounted ?part2)) ((mounted ?part1)) ) ;;; mount piece from ?part1 to process ?part ;;; dismount piece from ?part2 ;;; ?part is rotary (:operator (!mountFromRotary ?part1 ?part) ((rotary ?part) (mountedFixed ?part2) (mountable ?part1 ?part) ) ((mountedFixed ?part2)) ((mounted ?part1)) ) ;;; mount piece from ?part1 to process ?part ;;; ?part is fixed (:operator (!mountFromFixed ?part1 ?part) ((fixed ?part) (not (mounted ?part2)) (not (mountedFixed ?part2)) (mountable ?part1 ?part) ) () ((mountedFixed ?part1)) ) ;;; mount piece from ?part1 to process ?part ;;; dismount piece from ?part2 ;;; ?part is rotary (:operator (!mountFromFixed ?part1 ?part) ((fixed ?part) (mounted ?part2) (mountable ?part1 ?part) ) ((mounted ?part2)) ((mountedFixed ?part1)) ) ;;; mount piece from ?part1 to process ?part ;;; dismount piece from ?part2 ;;; ?part is rotary (:operator (!mountFromFixed ?part1 ?part) ((fixed ?part) (mountedFixed ?part2) (mountable ?part1 ?part) ) ((mountedFixed ?part2)) ((mountedFixed ?part1)) ) (:operator (!do-nothing) () () () 0) ;;; Main method to manufacture the workpiece (:method (manufacture ?wp) ((mounted ?part1) ;;case I: ;;use current mounting position ;;if possible ;;case I.a: ;;rotary mounting (processingArea ?part) (not (processed ?part)) (rotary ?part) (mountable ?part1 ?part) (tool ?tool) (compatible ?part ?tool) ) ((!process ?part ?tool) (manufacture ?wp) ) ((mountedFixed ?part1) ;;case I.b: ;;fixed mounting (processingArea ?part) (not (processed ?part)) (fixed ?part) (mountable ?part1 ?part) (tool ?tool) (compatible ?part ?tool) ) ((!process ?part ?tool) (manufacture ?wp) ) ((processingArea ?part) ;;case II: (general case) ;;find a processing area ;;and process it ;;case II.a: rotary mounting (not (processed ?part)) (rotary ?part) ;;;(processingArea ?part1) (mountable ?part1 ?part) ;;;(tool ?tool) (compatible ?part ?tool) ) ((!mountFromRotary ?part1 ?part) (!process ?part ?tool) (manufacture ?wp) ) ((processingArea ?part) ;;case II.b: fixed mounting (not (processed ?part)) (fixed ?part) ;;;(processingArea ?part1) (mountable ?part1 ?part) ;;;(tool ?tool) (compatible ?part ?tool) ) ((!mountFromFixed ?part1 ?part) (!process ?part ?tool) (manufacture ?wp) ) ((not (existsUnprocessedArea))) ;;case III: ((!do-nothing)) ;;all areas processed ) ;;; Main axioms: compatible and mountable ;;; (compatible ?part ?tool) ;;; ?tool can be used to process ?part (:- (compatible ?part ?tool) ((type ?part undercut) (type ?tool outlnTool)) ) (:- (compatible ?part ?tool) ((type ?part outline) (type ?tool outlnTool)) ) (:- (compatible ?part ?tool) ((type ?part thread) (type ?tool threadTool)) ) (:- (compatible ?part ?tool) ((type ?part drilledHole) (type ?tool drilledHoleTool)) ) (:- (compatible ?part ?tool) ((type ?part groove) (type ?tool grooveTool)) ) (:- (compatible ?part ?tool) ((type ?part slope) (type ?tool slopeTool)) ) (:- (compatible ?part ?tool) ((type ?part roundOff) (type ?tool roundOffTool)) ) ;; Add-on to compatible ;; Now I introduce generic tools (:- (compatible ?part ?tool) ((trueGenericPart ?part) (trueGenericTool ?tool)) ) (:- (compatible ?part ?tool) ((type ?tool outlnTool)(trueGenericPart ?part) ) ) (:- (compatible ?part ?tool) ((type ?part outline) (trueGenericTool ?tool)) ) (:- (trueGenericTool ?tool) ((type ?tool cuttingTool) (not (type ?tool threadTool)) (not (type ?tool drilledHoleTool)) (not (type ?tool grooveTool)) (not (type ?tool slopeTool)) (not (type ?tool roundOffTool)) ) ) (:- (trueGenericPart ?part) ((type ?part processingArea) (not (type ?part thread)) (not (type ?part drilledHole)) (not (type ?part groove)) (not (type ?part slope)) (not (type ?part roundOff)) (not (type ?part undercut)) ) ) ;;; (mountable ?part1 ?part) ;;; the piece can be mounted from ?part1 to process ?part (:- (mountable ?part1 ?part) ((mountableAux ?part1 ?part) (oppositeSides ?part1 ?part) ) ) (:- (oppositeSides ?part1 ?part) ( (type ?part1 ascendingOutline) (type ?part descendingOutline) ) ) (:- (oppositeSides ?part1 ?part) ( (type ?part horizontalOutline) (type ?part1 descendingOutline) ) ) (:- (oppositeSides ?part1 ?part) ( (type ?part1 ascendingOutline) (type ?part horizontalOutline) ) ) (:- (oppositeSides ?part1 ?part) ( (type ?part ascendingOutline) (type ?part1 descendingOutline) ) ) (:- (oppositeSides ?part1 ?part) ( (partOf ?part ?part2) (oppositeSides ?part1 ?part2) ) ) (:- (oppositeSides ?part1 ?part) ( (partOf ?part1 ?part2) (oppositeSides ?part2 ?part) ) ) (:- (oppositeSides ?part1 ?part) ( (partOf ?part ?part2) (partOf ?part1 ?part3) (oppositeSides ?part3 ?part2) ) ) ;;; add-on to oppositeSides (:- (oppositeSides ?part1 ?part) ( (type ?part1 descendingOutline) (not (type ?part descendingOutline)) (trueGenericPart ?part) ) ) (:- (oppositeSides ?part1 ?part) ( (type ?part1 ascendingOutline) (not (type ?part ascendingOutline)) (trueGenericPart ?part) ) ) ;;case I ;;outlines are always mountable ;;case I.a. ;;the outline, ?part1, is not ;;processed (:- (mountableAux ?part1 ?part) ((not (processed ?part1)) (type ?part1 outline) ) ) ;;CaseI.b ;;the outline, ?part1, is processed ;;but it doesn't have any subparts (:- (mountableAux ?part1 ?part) ((processed ?part1) (type ?part1 outline) (not (partOf ?part2 part1)) ) ) ;;Case II ;;The piece can be mounted from ;;areas that are not neighbours of threads (:- (mountableAux ?part1 ?part) ((not (type ?part1 thread)) (partOf ?part1 ?part2) (processed ?part2) (not (neighbourThread ?part1)) ) ) ;;Case III ;;workpieces can be mounted from unprocessed ;;threads (:- (mountableAux ?part1 ?part) ((type ?part1 thread) (not (processed ?part1)) (partOf ?part1 ?part2) (processed ?part2) ) ) ;;; Auxiliary axioms for (mountable ?part) (:- (neighbourThread ?part) ((neighbour ?part ?part1) (type ?part1 thread) ) ) (:- (existsUnprocessedArea) ((processingArea ?part) (not (processed ?part)) ) ) ;;; Type hierarchy (:- (type ?part outline) ((type ?part ascendingOutline)) ) (:- (type ?part outline) ((type ?part descendingOutline)) ) (:- (type ?part outline) ((type ?part horizontalOutline)) ) (:- (type ?part processingArea) ((type ?part outline)) ) (:- (type ?part processingArea) ((type ?part feature)) ) (:- (type ?part feature) ((type ?part drilledHole)) ) (:- (type ?part feature) ((type ?part thread)) ) (:- (type ?part feature) ((type ?part groove)) ) (:- (type ?part feature) ((type ?part slope)) ) (:- (type ?part feature) ((type ?part roundOff)) ) (:- (type ?part feature) ((type ?part undercut)) ) (:- (type ?tool cuttingTool) ((type ?tool outlnTool)) ) (:- (type ?part cuttingTool) ((type ?part threadTool)) ) (:- (type ?part cuttingTool) ((type ?part drilledHoleTool)) ) (:- (type ?part cuttingTool) ((type ?part grooveTool)) ) (:- (type ?part cuttingTool) ((type ?part slopeTool)) ) (:- (type ?part cuttingTool) ((type ?part roundOffTool)) ) ;;; rotary and fixed mounting (:- (rotary ?part) ((not (fixed ?part))) ) (:- (fixed ?part) ((type ?part drilledHole)) ) ;;; Standard axioms (:- (same ?x ?x) ()) (:- (different ?x ?y) ((not (same ?x ?y)))) ))