13#include <jaffarCommon/bitwise.hpp>
14#include <jaffarCommon/exceptions.hpp>
15#include <jaffarCommon/logger.hpp>
31 _bits = jaffarCommon::bitwise::getEncodingBitsForElementCount(maxInputIndex);
43 jaffarCommon::logger::log(
"[J+] Warning: input history exceeded its maximum size (%u). Longer solutions are truncated; raise 'Store Input History / Max Size'.\n",
_maxSize);
51 std::string
toString(
const std::map<InputSet::inputIndex_t, std::string>& inputStringMap,
const size_t stepCount)
const override
54 for (
size_t i = 0; i < stepCount && i <
_maxSize; i++)
57 if (inputStringMap.contains(idx) ==
false) JAFFAR_THROW_RUNTIME(
"Move Index %u not found in runner\n", idx);
58 out += inputStringMap.at(idx) + std::string(
"\n");
Stores the full bit-packed input sequence in every state (JaffarPlus's classic behavior): self-contai...
const uint32_t _maxSize
Maximum number of steps recorded.
std::string toString(const std::map< InputSet::inputIndex_t, std::string > &inputStringMap, const size_t stepCount) const override
Reconstructs the path as a newline-separated string of input strings (the solution).
void pushInput(const size_t stepCount, const InputSet::inputIndex_t input) override
Records one applied input at path position stepCount (the runner's current step counter).
void deserializeFull(jaffarCommon::deserializer::Base &d, const size_t) override
Restores the cursor from a "full" representation.
void setInput(const size_t step, const InputSet::inputIndex_t input)
Writes the input index for step into the bit-packed buffer.
void deserializeCold(jaffarCommon::deserializer::Base &d) override
Restores the cursor from a "cold" representation (the count is restored by the runner).
void captureColdToFull(const void *cold, void *full) const override
Converts a stored cold path into a self-contained full one (best/worst snapshot).
std::vector< uint8_t > _buffer
Bit-packed input sequence.
InputSet::inputIndex_t getInput(const size_t step) const
Reads the input index recorded for step from the bit-packed buffer.
void serializeFull(jaffarCommon::serializer::Base &s) const override
Writes the self-contained "full" path representation (for standalone snapshot buffers),...
void reset() override
Resets the cursor to the empty path.
void serializeCold(jaffarCommon::serializer::Base &s) const override
Writes the compact "cold" path representation (stored in each StateDb slot), excluding the count.
size_t getColdSize() const override
Size, in bytes, of the cold path representation in a StateDb slot (EXCLUDING the runner's count).
static std::atomic< bool > _truncationWarned
Set once after the first over-Max-Size push.
size_t _bits
Bits used to encode one input index.
InputHistoryRaw(const uint32_t maxInputIndex, const uint32_t maxSize)
Constructs the strategy and sizes the per-state bit-packed buffer.
size_t getFullSize() const override
Size, in bytes, of the full (self-contained) path representation in a snapshot buffer (EXCLUDING the ...
Abstract strategy for remembering the input path that produced each search state.
Abstract interface for how a search remembers the sequence of inputs ("path") that produced each stat...