14 auto it = eastl::lower_bound(begin(
open_),
21 assert(!
open_.empty());
36 return std::find_if(std::begin(
open_), std::end(
open_), [&](
const Node& n) {
return n.
ws_ == ws; });
41 for (
const auto& n :
open_)
43 output.append(n.toString());
52 output.append( n.toString() );
53 output.append(
"\n" );
72 open_.push_back(
MOV(starting_node));
75 while (
open_.size() > 0) {
94 the_plan.push_back(current.
action_);
101 for (
const auto& action : actions) {
102 if (action->eligibleFor(current.
ws_)) {
113 if (needle==end(
open_)) {
122 if ((current.
g_ + action->cost()) < needle->g_) {
124 needle->parent_id_ = current.
id_;
125 needle->g_ = current.
g_ + action->cost();
void printOpenList(Divide::string &output) const
void printClosedList(Divide::string &output) const
bool memberOfClosed(const WorldState &ws) const
void addToOpenList(Node &&node)
int calculateHeuristic(const WorldState &now, const WorldState &goal) const
vector< const Action * > plan(const WorldState &start, const WorldState &goal, const vector< const Action * > &actions)
hashMap< I32, Node > known_nodes_
A master lookup table of ID-to-Node; useful during the action replay.
vector< goap::Node >::iterator memberOfOpen(const WorldState &ws)
eastl::vector< Type > vector
int distanceTo(const WorldState &goal_state) const
bool meetsGoal(const WorldState &goal_state) const