8#ifndef IMPKERNEL_OPTIMIZER_STATE_H
9#define IMPKERNEL_OPTIMIZER_STATE_H
11#include <IMP/kernel_config.h>
15#include <cereal/access.hpp>
16#include <cereal/types/base_class.hpp>
19IMPKERNEL_BEGIN_NAMESPACE
46 friend class Optimizer;
47 unsigned int period_, call_number_, update_number_;
49 friend class cereal::access;
51 template<
class Archive>
void serialize(Archive &ar) {
52 ar(cereal::base_class<ModelObject>(
this), period_, call_number_,
53 update_number_, is_optimizing_);
54 if (std::is_base_of<cereal::detail::InputArchiveBase, Archive>::value) {
59 void set_optimizer(Optimizer* optimizer);
93 Optimizer* get_optimizer()
const {
95 "Must call set_optimizer before get_optimizer on state");
96 return optimizer_.get();
135 virtual void do_set_is_optimizing(
bool) {}
149IMPKERNEL_END_NAMESPACE
Base class for objects in a Model that depend on other objects.
A shared base class to help in debugging and things.
A weak pointer to an Object or RefCountedObject.
#define IMP_INTERNAL_CHECK(expr, message)
An assertion to check for internal errors in IMP. An IMP::ErrorException will be thrown.
Shared optimizer state that is invoked upon commitment of new coordinates.
void set_period(unsigned int p)
Set the periodicity of this state.
unsigned int get_number_of_updates() const
Return the number of times do_update() has been called.
virtual ModelObjectsTemp do_get_outputs() const override
virtual void reset()
Reset counters, as if at the start of an optimize run.
void set_number_of_updates(unsigned int n)
Set the counter of number of times do_update() has been called.
virtual void set_is_optimizing(bool)
Called by an Optimizer to signal begin/end of an optimize run.
virtual void update()
Called when the Optimizer accepts a new conformation.
void update_always()
Force the state to perform its action now, ignoring the periodicity.
virtual ModelObjectsTemp do_get_inputs() const override
OptimizerState(Model *m, std::string name)
Constructor.
unsigned int get_period() const
Get the periodicity of this state.
virtual void do_update(unsigned int)
#define IMP_SWIG_FINAL
Have the compiler report an error if anything overrides this method.
IMP::Vector< IMP::WeakPointer< ModelObject > > ModelObjectsTemp
#define IMP_REF_COUNTED_DESTRUCTOR(Name)
Set up destructor for a ref counted object.
A weak pointer to an Object or RefCountedObject.