AI 24/25 Project Software
Documentation for the AI 24/25 course programming project software
Loading...
Searching...
No Matches
uniform_successor_sampler_impl.h
1#include "probfd/successor_samplers/uniform_successor_sampler.h"
2
3#include "probfd/distribution.h"
4
5#include "downward/utils/rng.h"
6
7#include <memory>
8#include <utility>
9
11
12template <typename Action>
13UniformSuccessorSampler<Action>::UniformSuccessorSampler(int random_seed)
14 : rng_(std::make_shared<utils::RandomNumberGenerator>(random_seed))
15{
16}
17
18template <typename Action>
19UniformSuccessorSampler<Action>::UniformSuccessorSampler(
20 std::shared_ptr<utils::RandomNumberGenerator> rng)
21 : rng_(std::move(rng))
22{
23}
24
25template <typename Action>
26StateID UniformSuccessorSampler<Action>::sample(
27 StateID,
28 Action,
29 const Distribution<StateID>& successors,
30 algorithms::StateProperties&)
31{
32 assert(!successors.empty());
33 return successors.begin()[rng_->random(successors.size())].item;
34}
35
36} // namespace probfd::successor_samplers
This namespace contains implementations of transition successor samplers.
Definition arbitrary_sampler.h:7
STL namespace.