Question: Hello Just a quick question. Can someone explain what the minus sign infront of this python code is? It says the importance of the -
Hello Just a quick question.
Can someone explain what the minus sign infront of this python code is? It says the importance of the "-" is to consider an infinite integer grid,
states are pairs of integers
start ( 0 , 0 )
goal is ( 10 , 10 ).
The neighbours of (a,b) are ( a + 1, b) and (a, b + 1).
heuristic h((a,b)) = |10 - a| + |10 - j |.
how many paths are expanded with/without the "-" ?
What does it do? Why is it there?
The code is here, only a snippet. when I do search examples without the minus, some paths are expanded by more.
def add(self, path, value): """adds a path to queue priority value to be minimized""" self.front_index += 1 # new unique index heapq.heappush(self.frontpq, (value, -self.front_index, path))
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
