Skip to content

Class walle::AStarAgent

ClassList > walle > AStarAgent

More...

  • #include <AStarAgent.hpp>

Inherits the following classes: AgentBase

Public Functions

Type Name
AStarAgent (size_t id, const std::string & name)
Constructor for creating a new AStarAgent object.
cse491::GridPosition GetGoalPosition () const
gets the goal position and returns it
cse491::GridPosition GetNextPosition () override
Get the next position to move to.
int GetPathLength () const
int GetRecalculateValue () const
bool Initialize () override
This agent needs a specific set of actions to function.
void RecalculatePath ()
Update the path to go to goal position.
size_t SelectAction (const cse491::WorldGrid &, const cse491::type_options_t &, const cse491::item_map_t &, const cse491::agent_map_t &) override
Choose the action to take a step in the appropriate direction.
void SetGoalPosition (const double x, const double y)
Set where the agent should head towards.
void SetGoalPosition (const cse491::GridPosition gp)
Set where the agent should head towards.
void SetRecalculate (const int recalculate)
Set how many moves should occur before recalculating path A lower number will react faster to updates in the world but will call A* search more often.
~AStarAgent () = default

Detailed Description

Class that describes a AStarAgent class

Public Functions Documentation

function AStarAgent

Constructor for creating a new AStarAgent object.

inline walle::AStarAgent::AStarAgent (
    size_t id,
    const std::string & name
) 

Parameters:

  • id id of the agent
  • name name of the agent

function GetGoalPosition

gets the goal position and returns it

inline cse491::GridPosition walle::AStarAgent::GetGoalPosition () const

Returns:

goal_position member variable

function GetNextPosition

Get the next position to move to.

inline cse491::GridPosition walle::AStarAgent::GetNextPosition () override

Returns:

GridPosition to move to

function GetPathLength

inline int walle::AStarAgent::GetPathLength () const

Gets the size of the current path

Returns:

length of path

function GetRecalculateValue

inline int walle::AStarAgent::GetRecalculateValue () const

Returns the recalculate value

Returns:

recalculated value

function Initialize

This agent needs a specific set of actions to function.

inline bool walle::AStarAgent::Initialize () override

Returns:

Success.

function RecalculatePath

inline void walle::AStarAgent::RecalculatePath () 

function SelectAction

inline size_t walle::AStarAgent::SelectAction (
    const cse491::WorldGrid &,
    const cse491::type_options_t &,
    const cse491::item_map_t &,
    const cse491::agent_map_t &
) override

function SetGoalPosition [1/2]

Set where the agent should head towards.

inline void walle::AStarAgent::SetGoalPosition (
    const double x,
    const double y
) 

Parameters:

  • x x-coordinate of the goal position
  • y y-coordinate of the goal position

function SetGoalPosition [2/2]

Set where the agent should head towards.

inline void walle::AStarAgent::SetGoalPosition (
    const cse491::GridPosition gp
) 

Parameters:

  • gp position agent should go towards

function SetRecalculate

Set how many moves should occur before recalculating path A lower number will react faster to updates in the world but will call A* search more often.

inline void walle::AStarAgent::SetRecalculate (
    const int recalculate
) 

Parameters:

  • recalculate How often path should be recalculated

function ~AStarAgent

walle::AStarAgent::~AStarAgent () = default

The documentation for this class was generated from the following file source/Agents/AStarAgent.hpp