Class model::PuboBinaryAdaptive
Adaptive Binary State.
This adaptive state stores its state in a contigous (self allocated) chunk of heap memory (pointed to by data_). This chunk is organized as follows: +-----------------------------------------------------------------------+ | Binary values stored in uint64_t | 32-bit counters | 8-bit counters | +---------------------------------+-----+-----++++++ | 0101010100001010011111011110101101 | 256 | 42 | 3 | 0 | 7 | 2 | 1 | +---------------------------------+-----+-----++++++
- The first section consists of as many uint64_t as needed to store the state of each variable in the problem
- Counters are used to cache the number of zeros in a given term. Their usage is allocated problem-dependent to the highest-locality terms and according to memory allowance passed during configuration.
Note
In addition to limiting per-state memory, PuboAdaptive can be templated for the index type (i.e. uint16_t). Because chache ids are appended to the variable ids; they must fit within the numeric range of the type used for indexing as well (see below).
Constructors
PuboBinaryAdaptive()
Create an empty adaptive state (used by std::vector)
Declaration
model::PuboBinaryAdaptive::PuboBinaryAdaptive()
PuboBinaryAdaptive()
Create an adaptive state of the desired size and initialize it to zero.
Declaration
model::PuboBinaryAdaptive::PuboBinaryAdaptive(size_t size)
PuboBinaryAdaptive()
Declaration
model::PuboBinaryAdaptive::PuboBinaryAdaptive(const PuboBinaryAdaptive&other)
PuboBinaryAdaptive()
Declaration
model::PuboBinaryAdaptive::PuboBinaryAdaptive(PuboBinaryAdaptive&&other)
Methods
operator=()
Copy another state (allocating memory if it is empty).
Declaration
PuboBinaryAdaptive&model::PuboBinaryAdaptive::operator=(const PuboBinaryAdaptive&other)
operator=()
Move assignment can be done without copy.
Declaration
PuboBinaryAdaptive&model::PuboBinaryAdaptive::operator=(PuboBinaryAdaptive&&other)
copy_state_only()
We need to copy the whole state (including caches); the model cannot compute the cost function without them. This functionality is exclusively used to keep track of the best cost milestones I expect this to happen rarely enough that we can afford the overhead.
Declaration
void model::PuboBinaryAdaptive::copy_state_only(const PuboBinaryAdaptive&other)
memory_estimate()
Declaration
static size_t model::PuboBinaryAdaptive::memory_estimate(size_t size)
state_only_memory_estimate()
Declaration
static size_t model::PuboBinaryAdaptive::state_only_memory_estimate(size_t size)