Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I need solution for Milestone 2 3 . 2 Milestone 2 : Forward Search In this milestone, you will implement a forward search algorithm that
I need solution for Milestone
Milestone : Forward Search
In this milestone, you will implement a forward search algorithm that starts from the "start" position and explore
the environment is a systematic way until it reaches the "goal" position. The pseudocode for the algorithm you
need to implement is provided below:
Forward Search Algorithm
In this algorithm, a position in the environment that the robot can reach is denoted by a node and each node
will contain the colrow coordinate and distancetravelled the distance that the algorithm took to reach
that position from the robot's starting position
Pseudocode for the forward Search algorithm Estimated distance
For the above algorithm we need to estimate the distance from a given node to the goal node. It is not possible
to know the exact distance from a given node to the goal before solving the path planning problem. However
we can come up with an approximation. In this implementation we use the following approximation as the
estimated distance from a given node, to the goal node
Estimated distance ravelled node Manhattan distance from
The Manhattan distance from node with coordinates colp row to node with coordinates col row is
computed as:
istance col row row
here is the absolute value of The Manhattan distance represent the shortest distance from a node to goal
if there are no obstacles.
Implementation details
It is important to have a good design for our programs and use suitable data structures and classes. In
Assignment you will implement our design You will implement classes:
Node class to represent a position col row, distancetravelled of the robot.
NodeList class provides a method for storing a list of node objects as used in pseudocode above.
PathSolver class that executes the forward search and backtracking algorithms.
The main file that uses these classes, and does any readingwriting to standard inputoutput
You are given these classes in the starter code. You may add any of your own code, but you must not modify
the definitions of the provided class methods and fields.
Node Class
The Node class represents a position of the robot. It is a tuple colrow,distancetravelled which is the
y location of the robot, and the distance that the algorithm took to reach that position from the robot's
starting position. It contains getters for this information and setter for distancetravelled.
This won't be the case for Assignment where you will have to make these decisions for yourself. NodeList Class
The NodeList class provides a method for storing a list of Node objects. It stores an array of Node objects.
Since it's an array we also need to track the number of position objects in the NodeList.
You must implement the NodeList class using an array.
The constant NODELISTARRAYMAXSIZE is the maximum number of objects that can be in a NodeList. This
constant is given in the Types.h header file. The NodeLsit class has the following methods:
These methods let you add positions to the NodeList, and get a pointer to an existing position. Be aware, that
the NodeList class has full control over all position objects that are stored in the array. Thus, if position objects
are removed from the array you must remember to "delete" the objects PathSolver Class
The PathSolver class executes the two parts forward search, backtracking of the path planning algorithm by
using the NodeList and Node classes. It has three main components:
forwardSearch: Execute the forward search algorithm.
getNodesExplored: returns a DEEP COPY of the explored NodeList in forward search.
getPath: Execute backtracking and Get a DEEP COPY of the path the robot should travel. To be
implemented for milestone
This uses a custom data type Env, which is given in the Types.h It is a D array of characters that represents
a environment using the format in Section It is a fixed size, because we assume the size of the environment
is known.
It is very important to understand the Env type. It is defined as a D array. If you recall from lectureslabs a
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started