the variable frontier index is the total number of elements of the frontier that have been created as well as being used as unique indexit is useful for statisticsparticularly in conjunction with the current size of the frontier searchgeneric py -(continued import heapq part of the python standard library from searchproblem import path class frontierpq(object)""" frontier consists of priority queue (heap)frontierpqof (valueindexpathtripleswhere value is the value we want to minimize ( path cost hindex is unique index for each element path is the path on the queue note that the priority queue always returns the smallest element "" def __init__(self)"""constructs the frontierinitially an empty priority queue ""self frontier_index the number of items ever added to the frontier self frontierpq [the frontier priority queue def empty(self)"""is true if the priority queue is empty""return self frontierpq =[ def add(selfpathvalue)"""add path to the priority queue value is the value to be minimized""self frontier_index + get new unique index heapq heappush(self frontierpq,(value-self frontier_indexpath) def pop(self)"""returns and removes the path of the frontier with minimum value ""( , ,pathheapq heappop(self frontierpqreturn path the following methods are used for finding and printing information about the frontier searchgeneric py -(continued def count(self,val)"""returns the number of elements of the frontier with value=val""return sum( for in self frontierpq if [ ]==val def __repr__(self)"""string representation of the frontier""return str([( , ,str( )for ( , ,pin self frontierpq]version june