<commit_before>#pragma once
#include "../search/search.hpp"
#include "../utils/geom2d.hpp"
#include "../utils/pool.hpp"
#include <vector>

template <class D>
class Flrtastar2 : public SearchAlgorithm<D> {
private:

	typedef typename D::PackedState PackedState;
	typedef typename D::Operators Operators;
	typedef typename D::State State;
	typedef typename D::Cost Cost;
	typedef typename D::Oper Oper;
	typedef typename D::Edge Edge;

	class Node;
	class Nodes;

	struct inedge {
		inedge(Node *n, double c) : node(n), incost(c) {
		}

		Node *node;
		double incost;
	};

	struct outedge {
		outedge(Node *n, Oper o, Cost rc, Cost c) :
			node(n),
			op(o),
			revcost(rc == Cost(-1) ? geom2d::Infinity : rc),
			outcost(c == Cost(-1) ? geom2d::Infinity : c) {
		}

		Node *node;
		Oper op;
		double revcost;
		double outcost;
	};

	class Node {
	public:
		static ClosedEntry<Node, D> &closedentry(Node *n) {
			return n->closedent;
		}

		static PackedState &key(Node *n) {
			return n->state;
		}

		PackedState state;
		double gglobal, h, hdef;
		bool dead;
		bool expd;	// was this expanded before?
		bool goal;
		std::vector<outedge> succs;
		std::vector<inedge> preds;

	private:
		friend class Nodes;
		friend class Pool<Node>;

		Node() : gglobal(geom2d::Infinity), dead(false), expd(false) {
		}

		ClosedEntry<Node, D> closedent;
	};

	class Nodes {
	public:
		Nodes(unsigned int sz) : tbl(sz) {
			pool = new Pool<Node>();
		}

		~Nodes() {
			delete pool;
		}

		void clear() {
			tbl.clear();
			delete pool;
			pool = new Pool<Node>();
		}

		Node *get(D &d, State &s) {
			Node *n = pool->construct();
			d.pack(n->state, s);

			unsigned long hash = d.hash(n->state);
			Node *found = tbl.find(n->state, hash);
			if (found) {
				pool->destruct(n);
				return found;
			}

			n->goal = d.isgoal(s);
			n->h = n->hdef = d.h(s);
			assert (n->goal || n->h > 0);
			tbl.add(n, hash);<commit_msg>search: remove a debugging assert.<commit_after>#pragma once
#include "../search/search.hpp"
#include "../utils/geom2d.hpp"
#include "../utils/pool.hpp"
#include <vector>

template <class D>
class Flrtastar2 : public SearchAlgorithm<D> {
private:

	typedef typename D::PackedState PackedState;
	typedef typename D::Operators Operators;
	typedef typename D::State State;
	typedef typename D::Cost Cost;
	typedef typename D::Oper Oper;
	typedef typename D::Edge Edge;

	class Node;
	class Nodes;

	struct inedge {
		inedge(Node *n, double c) : node(n), incost(c) {
		}

		Node *node;
		double incost;
	};

	struct outedge {
		outedge(Node *n, Oper o, Cost rc, Cost c) :
			node(n),
			op(o),
			revcost(rc == Cost(-1) ? geom2d::Infinity : rc),
			outcost(c == Cost(-1) ? geom2d::Infinity : c) {
		}

		Node *node;
		Oper op;
		double revcost;
		double outcost;
	};

	class Node {
	public:
		static ClosedEntry<Node, D> &closedentry(Node *n) {
			return n->closedent;
		}

		static PackedState &key(Node *n) {
			return n->state;
		}

		PackedState state;
		double gglobal, h, hdef;
		bool dead;
		bool expd;	// was this expanded before?
		bool goal;
		std::vector<outedge> succs;
		std::vector<inedge> preds;

	private:
		friend class Nodes;
		friend class Pool<Node>;

		Node() : gglobal(geom2d::Infinity), dead(false), expd(false) {
		}

		ClosedEntry<Node, D> closedent;
	};

	class Nodes {
	public:
		Nodes(unsigned int sz) : tbl(sz) {
			pool = new Pool<Node>();
		}

		~Nodes() {
			delete pool;
		}

		void clear() {
			tbl.clear();
			delete pool;
			pool = new Pool<Node>();
		}

		Node *get(D &d, State &s) {
			Node *n = pool->construct();
			d.pack(n->state, s);

			unsigned long hash = d.hash(n->state);
			Node *found = tbl.find(n->state, hash);
			if (found) {
				pool->destruct(n);
				return found;
			}

			n->goal = d.isgoal(s);
			n->h = n->hdef = d.h(s);
			tbl.add(n, hash);
{'fraction_non_alphanumeric': 0.1587802313354364, 'fraction_numerical': 0.003943217665615142, 'mean_word_length': 3.241917502787068, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 46, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2059454', 'n_tokens_mistral': 1677, 'n_tokens_neox': 1425, 'n_words': 381}