Class examples::SoftSpinState
Methods
render()
render the object in structured form
Return a structured representation of the object. This is intended for output purposes. For instance, the solution your solver finds should have a render method which allows it to be returned as part of the result. Example:
{c++}
MySolution : public Component {
public:
// Represent the internal bool vector as +-1 output.
utils::Structure render() const override {
utils::Structure rendered;
for (bool item : solution_) rendered.push_back(item ? 1 : -1);
return rendered;
}
private:
std::vector<bool> solution_;
}
MySolution solution;
std::cout << solution.render().to_string() << std::endl;
Declaration
utils::Structure examples::SoftSpinState::render() const override
get_status()
get_status shows a simplified state representation
Like render
, this produces a structured representation of the object's state. However, it is intended to be simpler in nature with the purpose of rendering the object during stream-output and logging. By default, it will fall back to the full render
, but overloading this allows distinguising how the object looks during LOG vs full output.
Declaration
utils::Structure examples::SoftSpinState::get_status() const override
get_class_name()
get_class_name shows an identifier of the (derived) class name
Its primary use is for type identification during stream output and logging, where a component is rendered as <ClassName: status>
.
Example:
{c++}
MyClass : public Component {}
// This will render as '<MyClass>'
MyClass my_object;
std::cout << my_object << std::endl;
Note
You do not need to overload this method unless you want to change the output of the default implementation.
Declaration
std::string examples::SoftSpinState::get_class_name() const override
memory_estimate()
Declaration
static size_t examples::SoftSpinState::memory_estimate(size_t N)
state_only_memory_estimate()
Declaration
static size_t examples::SoftSpinState::state_only_memory_estimate(size_t N)