Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hi, I have a programing problem of finding monotonic heuristics (in python). I have this function which takes two points a and b in the

Hi,

I have a programing problem of finding monotonic heuristics (in python).

I have this function which takes two points a and b in the n-dimensional space and returns the d-dimensional point r such that r_i = | a_i - b_i | for i = 1...d

def distance_in_each_coordinate(x, y):

res = [ abs(a-b) for (a,b) in zip(x, y) ]

return res

Then I have the following functions, which receive coordinates of two grid points and return the estimated distance between them.

def grid_3D_heuristic(current, destination): # in the classis 3D grid

dst_per_coor = distance_in_each_coordinate(current, destination)

return sum(dst_per_coor)

def grid_all_diagonal_3D_heuristic(current, destination): # in the 3D grid containing both face and space diagonals

dst_per_coor = distance_in_each_coordinate(current, destination)

return max(dst_per_coor)

And similarly I would like to know how to calculate the distance in a 3D grid, which contains only face diagonals (no space diagonals):

def grid_face_diagonal_3D_heuristic(current, destination):

dst_per_coor = distance_in_each_coordinate(current, destination)

return 'WHAT DO I RETURN HERE?'

Could you please help me with the case of a 3D grid with only face diagonals?

Thank you! <3

Step by Step Solution

There are 3 Steps involved in it

Step: 1

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

Repairing And Querying Databases Under Aggregate Constraints

Authors: Sergio Flesca ,Filippo Furfaro ,Francesco Parisi

2011th Edition

146141640X, 978-1461416401

Students also viewed these Databases questions

Question

Explain what is meant by the terms unitarism and pluralism.

Answered: 1 week ago

Question

Are robots going to displace all workers? Explain your answer.

Answered: 1 week ago