AI 24/25 Project Software
Documentation for the AI 24/25 course programming project software
Loading...
Searching...
No Matches
lifo_open_list.h
1#ifndef PROBFD_OPEN_LISTS_LIFO_OPEN_LIST_H
2#define PROBFD_OPEN_LISTS_LIFO_OPEN_LIST_H
3
4#include "probfd/algorithms/open_list.h"
5
6#include <deque>
7
8namespace probfd::open_lists {
9
10template <typename Action>
11class LifoOpenList : public algorithms::OpenList<Action> {
12 std::deque<StateID> queue_;
13
14public:
15 [[nodiscard]]
16 bool empty() const override
17 {
18 return queue_.empty();
19 }
20
21 [[nodiscard]]
22 unsigned size() const override
23 {
24 return queue_.size();
25 }
26
27 StateID pop() override
28 {
29 StateID s = queue_.back();
30 queue_.pop_back();
31 return s;
32 }
33
34 void push(StateID state_id) override { queue_.push_back(state_id); }
35
36 void clear() override { queue_.clear(); }
37};
38
39} // namespace probfd::open_lists
40
41#endif // PROBFD_OPEN_LISTS_LIFO_OPEN_LIST_H
This namespace contains implementations of open lists.
Definition fifo_open_list.h:9