JaffarPlus
High-performance best-first search optimizer for tool-assisted speedruns
Loading...
Searching...
No Matches
jaffarPlus::InputHistory Class Referenceabstract

Abstract strategy for remembering the input path that produced each search state. More...

#include <inputHistory.hpp>

Inheritance diagram for jaffarPlus::InputHistory:
[legend]

Public Member Functions

virtual ~InputHistory ()=default
 Virtual destructor for the strategy interface.
 
virtual void reset ()=0
 Resets the cursor to the empty path.
 
virtual void pushInput (const size_t stepCount, const InputSet::inputIndex_t input)=0
 Records one applied input at path position stepCount (the runner's current step counter).
 
virtual void serializeCold (jaffarCommon::serializer::Base &s) const =0
 Writes the compact "cold" path representation (stored in each StateDb slot), excluding the count.
 
virtual void deserializeCold (jaffarCommon::deserializer::Base &d)=0
 Restores the cursor from a "cold" representation (the count is restored by the runner).
 
virtual void serializeFull (jaffarCommon::serializer::Base &s) const =0
 Writes the self-contained "full" path representation (for standalone snapshot buffers), excluding the count.
 
virtual void deserializeFull (jaffarCommon::deserializer::Base &d, const size_t stepCount)=0
 Restores the cursor from a "full" representation.
 
virtual std::string toString (const std::map< InputSet::inputIndex_t, std::string > &inputStringMap, const size_t stepCount) const =0
 Reconstructs the path as a newline-separated string of input strings (the solution).
 
virtual size_t getColdSize () const =0
 Size, in bytes, of the cold path representation in a StateDb slot (EXCLUDING the runner's count).
 
virtual size_t getFullSize () const =0
 Size, in bytes, of the full (self-contained) path representation in a snapshot buffer (EXCLUDING the count).
 
virtual void initColdSlot (void *cold) const
 Prepares a fresh/recycled cold slot (e.g. marks it as holding no trie node). Default: no-op.
 
virtual void releaseColdSlot (void *cold, const size_t shard) const
 Releases any shared resource a freed cold slot was holding (trie GC).
 
virtual void captureColdToFull (const void *cold, void *full) const =0
 Converts a stored cold path into a self-contained full one (best/worst snapshot).
 
virtual size_t getApproxMemoryBytes () const
 Approximate resident memory of any shared structure (e.g. the trie), in bytes. Default: 0.
 

Detailed Description

Abstract strategy for remembering the input path that produced each search state.

Concrete strategies (none / raw bit-packed / shared-prefix trie) implement the per-runner cursor ops and the manager ops on stored cold-slot bytes; see the file header and inputHistoryFactory.hpp.

Definition at line 39 of file inputHistory.hpp.

Member Function Documentation

◆ captureColdToFull()

virtual void jaffarPlus::InputHistory::captureColdToFull ( const void *  cold,
void *  full 
) const
pure virtual

Converts a stored cold path into a self-contained full one (best/worst snapshot).

Operates on the path only; the runner's count prefix is copied separately by the StateDb.

Implemented in jaffarPlus::InputHistoryNone, jaffarPlus::InputHistoryRaw, and jaffarPlus::InputHistoryTrie.

◆ deserializeCold()

virtual void jaffarPlus::InputHistory::deserializeCold ( jaffarCommon::deserializer::Base &  d)
pure virtual

Restores the cursor from a "cold" representation (the count is restored by the runner).

Implemented in jaffarPlus::InputHistoryNone, jaffarPlus::InputHistoryRaw, and jaffarPlus::InputHistoryTrie.

◆ deserializeFull()

virtual void jaffarPlus::InputHistory::deserializeFull ( jaffarCommon::deserializer::Base &  d,
const size_t  stepCount 
)
pure virtual

Restores the cursor from a "full" representation.

stepCount is the runner's already-restored step counter, needed by strategies (the trie) that rebuild their cursor from the path length.

Implemented in jaffarPlus::InputHistoryNone, jaffarPlus::InputHistoryTrie, and jaffarPlus::InputHistoryRaw.

◆ getApproxMemoryBytes()

virtual size_t jaffarPlus::InputHistory::getApproxMemoryBytes ( ) const
inlinevirtual

Approximate resident memory of any shared structure (e.g. the trie), in bytes. Default: 0.

Reimplemented in jaffarPlus::InputHistoryTrie.

Definition at line 94 of file inputHistory.hpp.

◆ getColdSize()

virtual size_t jaffarPlus::InputHistory::getColdSize ( ) const
pure virtual

Size, in bytes, of the cold path representation in a StateDb slot (EXCLUDING the runner's count).

Implemented in jaffarPlus::InputHistoryNone, jaffarPlus::InputHistoryRaw, and jaffarPlus::InputHistoryTrie.

◆ getFullSize()

virtual size_t jaffarPlus::InputHistory::getFullSize ( ) const
pure virtual

Size, in bytes, of the full (self-contained) path representation in a snapshot buffer (EXCLUDING the count).

Implemented in jaffarPlus::InputHistoryNone, jaffarPlus::InputHistoryRaw, and jaffarPlus::InputHistoryTrie.

◆ initColdSlot()

virtual void jaffarPlus::InputHistory::initColdSlot ( void *  cold) const
inlinevirtual

Prepares a fresh/recycled cold slot (e.g. marks it as holding no trie node). Default: no-op.

Reimplemented in jaffarPlus::InputHistoryTrie.

Definition at line 81 of file inputHistory.hpp.

◆ pushInput()

virtual void jaffarPlus::InputHistory::pushInput ( const size_t  stepCount,
const InputSet::inputIndex_t  input 
)
pure virtual

Records one applied input at path position stepCount (the runner's current step counter).

Implemented in jaffarPlus::InputHistoryRaw, jaffarPlus::InputHistoryTrie, and jaffarPlus::InputHistoryNone.

◆ releaseColdSlot()

virtual void jaffarPlus::InputHistory::releaseColdSlot ( void *  cold,
const size_t  shard 
) const
inlinevirtual

Releases any shared resource a freed cold slot was holding (trie GC).

shard is the freeing thread's id, used to recycle into a contention-free per-thread pool. Default: no-op.

Reimplemented in jaffarPlus::InputHistoryTrie.

Definition at line 84 of file inputHistory.hpp.

◆ reset()

virtual void jaffarPlus::InputHistory::reset ( )
pure virtual

Resets the cursor to the empty path.

Implemented in jaffarPlus::InputHistoryNone, jaffarPlus::InputHistoryRaw, and jaffarPlus::InputHistoryTrie.

◆ serializeCold()

virtual void jaffarPlus::InputHistory::serializeCold ( jaffarCommon::serializer::Base &  s) const
pure virtual

Writes the compact "cold" path representation (stored in each StateDb slot), excluding the count.

Implemented in jaffarPlus::InputHistoryNone, jaffarPlus::InputHistoryRaw, and jaffarPlus::InputHistoryTrie.

◆ serializeFull()

virtual void jaffarPlus::InputHistory::serializeFull ( jaffarCommon::serializer::Base &  s) const
pure virtual

Writes the self-contained "full" path representation (for standalone snapshot buffers), excluding the count.

Implemented in jaffarPlus::InputHistoryNone, jaffarPlus::InputHistoryRaw, and jaffarPlus::InputHistoryTrie.

◆ toString()

virtual std::string jaffarPlus::InputHistory::toString ( const std::map< InputSet::inputIndex_t, std::string > &  inputStringMap,
const size_t  stepCount 
) const
pure virtual

Reconstructs the path as a newline-separated string of input strings (the solution).

stepCount is the runner's step counter, bounding how many recorded steps are rendered.

Implemented in jaffarPlus::InputHistoryNone, jaffarPlus::InputHistoryRaw, and jaffarPlus::InputHistoryTrie.


The documentation for this class was generated from the following file: