; p5 -- test problem file


;;; -------------------------------------------------------------------------
;;;  This problem demonstrates a bunch of mostly infantry, attacking a mixed
;;;  set of objectives.  Again, this fails without unit type sc-rules.
;;; -------------------------------------------------------------------------

;;; -------------------------------------------------------------------------
;;;	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)       ); 0 < reserve < 3.
			 (less-than 0 <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)

       (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)

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

       (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 0)
					; (I have assumed that all
					; defender (objective) classes
       (objective-class group1 ARMOR)	; are part infantry.)
       (objective-class group2 ARMOR)	;   ARMOR = Tanks.
       (objective-class group3 AT   )	;   AT    = Anti-Tank Guns.
       (objective-class group4 INF  )	;   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)

       ))
