Bagger 1 prodns start_bagging pmatch step is start bagging pred null comp null actions delete step is start bagging add step is get next item add current bag number 1 space left 100 -------------------------------------------- get_next_item pmatch step is get next item trolley contains ?I space ?S pred null comp null actions delete step is get next item add step is bag item delete trolley contains ?I space ?S add item to bag ?I space ?S -------------------------------------------- bag_in_current pmatch step is bag item item to bag ?I space ?IS current bag number ?N space ?BS pred ?BS >= ?IS comp ?RS = ?BS-?IS actions delete step is bag item add step is get next item delete item to bag ?I space ?IS add bag ?N contains ?I add current bag number ?N space ?RS -------------------------------------------- start_new_bag pmatch step is bag item current bag number ?N space ?BS pred null comp ?NB = ?N+1 actions delete current bag number ?N space ?BS add current bag number ?NB space 100