diff options
| author | Charlie Blake | 2018-06-19 16:48:56 +0100 |
|---|---|---|
| committer | Charlie Blake | 2018-06-19 17:36:17 +0100 |
| commit | 2bad89dfd8d100145526637c5ef33b8f410014df (patch) | |
| tree | 1fb5c123465c39b77c05e6857621bc06bfc34b4f /src/main/solver/solver.h | |
| parent | Add option to resume stopped run (diff) | |
| download | metasol-2bad89dfd8d100145526637c5ef33b8f410014df.tar.gz metasol-2bad89dfd8d100145526637c5ef33b8f410014df.zip | |
Reduce memory taken up by dfs datastructures
Diffstat (limited to 'src/main/solver/solver.h')
| -rw-r--r-- | src/main/solver/solver.h | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/main/solver/solver.h b/src/main/solver/solver.h index ef0709a..14dedc5 100644 --- a/src/main/solver/solver.h +++ b/src/main/solver/solver.h @@ -18,15 +18,13 @@ public: lru_cache cache; struct node { - node(node*, move, boost::optional<lru_cache::item_list::iterator> = boost::none); - node* parent; + node(move); const move mv; - std::vector<node> children; - boost::optional<lru_cache::item_list::iterator> parent_state_iter; // Optional, as dominance moves aren't cached + std::vector<move> child_moves; + boost::optional<lru_cache::item_list::iterator> cache_state; // Optional, as dominance moves aren't cached }; explicit solver(const game_state&, uint64_t); - ~solver(); sol_state run(boost::optional<std::atomic<bool> &> = boost::none); @@ -36,15 +34,15 @@ public: int get_unique_states_searched() const; int get_cache_size() const; int get_states_rem_from_cache() const; - const node& get_search_tree() const; + const std::vector<node> get_frontier() const; private: bool revert_to_last_node_with_children(boost::optional<lru_cache::item_list::iterator> = boost::none); - void add_children(std::vector<move>&, boost::optional<lru_cache::item_list::iterator> = boost::none); - void add_child(move, boost::optional<lru_cache::item_list::iterator> = boost::none); + void set_to_child(); const game_state init_state; game_state state; + std::vector<node> frontier; int states_searched; int unique_states_searched; @@ -54,7 +52,7 @@ private: int max_depth; node root; - node* current_node; + std::vector<node>::iterator current_node; }; |
