; p3 -- test problem file

;;; -------------------------------------------------------------------------
;;;  This problem has several tank units attacking one infantry objective and
;;;  several anti-tank objective.  It should be possible to attack only one
;;;  of the AT objectives.  This problem is not solvable in 2500 nodes,
;;;  without sc-rules.  But p4 (which is a duplicate with reversed order of
;;;  objectives) is solvable in 50 nodes.
;;; -------------------------------------------------------------------------

;;; -------------------------------------------------------------------------
;;;	This is the basic goal.  It's pretty complicated, as I've been 
;;;	modifying it quit a bit.  I think it could be put into the preconds
;;;	of one operator, but I found more interesting stuff to work on.
;;;	It might be a good idea to make the constants (2 & 3, below) part
;;;	of the start state.  Then you could work on different problems
;;;	without having to change the goal.
;;; -------------------------------------------------------------------------

(load-goal '(and (FORALL (<unit>)			; Want all units
			 (is-unit <unit>)		; assigned.
			 (~ (unassigned <unit>))       ); (No waste.)

		 (FORALL (<group>)			; Want enough strength
			 (is-group <group>)		; in each group, or
			 (or (has-strength <group> 0)	; no strength.
			     (has-adequate-strength <group>) ))

		 (and    (engagements-counted)		; Want at least 2
		 	 (number-of-engaged-groups <no>); groups engaged
		 	 (gtr-or-eql <no> 2) )		; (to attack).

		 (and	 (reserve-strength <reserve>)	; Want
			 (less-than <reserve> 3)        ; -1 < reserve < 3.
			 (less-than -1 <reserve>)      )

		 ))


(load-start-state 
    '( (is-unit a)
       (is-unit b)
       (is-unit c)
       (is-unit d)
       (is-unit e)
       (is-unit f)
       (is-unit g)
       (is-unit h)

       (unassigned a)		; If you run out of things to do,
       (unassigned b)		; try to infer these, so they don't
       (unassigned c)		; need to be a part of the initial
       (unassigned d)		; state.
       (unassigned e)
       (unassigned f)
       (unassigned g)
       (unassigned h)

       (unit-class a ARMOR)		; ARMOR = Tanks.
       (unit-class b ARMOR)		; INF   = Infantry.
       (unit-class c ARMOR)
       (unit-class d ARMOR)
       (unit-class e ARMOR)
       (unit-class f ARMOR)
       (unit-class g ARMOR)
       (unit-class h ARMOR)

       (is-group group1)
       (is-group group2)
       (is-group group3)
       (is-group group4)

       (has-strength group1 0)	; Try to infer, see "unassigned", above.
       (has-strength group2 0)
       (has-strength group3 0)
       (has-strength group4 0)

       (objective-strength group1 1)
       (objective-strength group2 1)
       (objective-strength group3 2)
       (objective-strength group4 2)
					; (I have assumed that all
					; defender (objective) classes
       (objective-class group1 INF  )	; are part infantry.)
       (objective-class group2 AT   )	;   ARMOR = Tanks.
       (objective-class group3 AT   )	;   AT    = Anti-Tank Guns.
       (objective-class group4 AT   )	;   INF   = Infantry.

       (objective-modifier group1 0)	;     0 = not attacked
       (objective-modifier group2 0)	;    50 = x 0.5
       (objective-modifier group3 0)	;   100 = x 1
       (objective-modifier group4 0)	;   200 = x 2

       (number-of-engaged-groups 0)
       (reserve-strength 0)

       ))
