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

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

def add(self, path, value): ""adds a path to queue priority value to be minimized"" " self.front_index += 1 heapq.heappush(self.frontpq, (value, -self.front_index, path)) # new unique index

Step by Step Solution

3.35 Rating (155 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

the importance of the is to consider an infinite integer grid The ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!