Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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 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

Step: 1

the importance of the is to consider an infinite integer grid The ... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Quantum Chemistry

Authors: Ira N. Levine

7th edition

321803450, 978-0321803450

More Books

Students also viewed these Programming questions

Question

What are some of the costs of unmanaged, chronic stress?

Answered: 1 week ago