searching for solutions class searchermpp(astarsearcher)"""returns searcher for problem paths can be found by repeatedly calling search(""def __init__(selfproblem)super(__init__(problemself explored set( @visualize def search(self)"""returns next path from an element of problem' start nodes to goal node returns none if no path exists ""while not self empty_frontier()path self frontier pop(if path end(not in self exploredself display( "expanding:",path,"(cost:",path cost,")"self explored add(path end()self num_expanded + if self problem is_goal(path end())self display( self num_expanded"paths have been expanded and"len(self frontier)"paths remain in the frontier"self solution path store the solution found return path elseneighs self problem neighbors(path end()self display( ,"neighbors are"neighsfor arc in neighsself add_to_frontier(path(path,arc)self display( ,"frontier:",self frontierself display( ,"no (moresolutions total of"self num_expanded,"paths expanded " from searchgeneric import test if __name__ ="__main__"test(searchermpp import searchproblem searchermppcdp searchermpp(searchproblem cyclic_delivery_problemprint(searchermppcdp search()find first path exercise implement searcher that implements cycle pruning instead of multiple-path pruning you need to decide whether to check for cycles when paths are added to the frontier or when they are removed (hinteither method can be implemented by only changing one or two lines in searchermpp hintthere is cyle if path end(in path initial_nodes(compare no pruningmultiple path version june