9#ifndef IMPKERNEL_SCORE_ACCUMULATOR_H
10#define IMPKERNEL_SCORE_ACCUMULATOR_H
12#include <IMP/kernel_config.h>
22#include <cereal/access.hpp>
24IMPKERNEL_BEGIN_NAMESPACE
29struct EvaluationState {
32 EvaluationState(
double oscore,
bool ogood) : score(oscore), good(ogood) {}
33 EvaluationState() : score(
BAD_SCORE), good(
false) {}
37 friend class cereal::access;
39 template<
class Archive>
void serialize(Archive &ar) {
53class IMPKERNELEXPORT ScoreAccumulator :
public Value {
60 friend class ScoringFunction;
61 friend class Restraint;
63 double global_max,
double local_max,
bool abort_on_bad)
66 global_max_(global_max),
67 local_max_(local_max),
69 abort_on_bad_(abort_on_bad) {}
72 IMP_CXX11_DEFAULT_COPY_CONSTRUCTOR(ScoreAccumulator);
82 local_max_ = std::min(local_max, o.local_max_);
88 double wscore = weight_.get_weight() * score;
90 score_->score += wscore;
91 if (score > local_max_) {
103 if (global_max_ ==
NO_MAX && !abort_on_bad_)
return false;
112 double score = score_->score;
113 return score > global_max_;
131 double get_maximum()
const {
return std::min(global_max_, local_max_); }
146IMPKERNEL_END_NAMESPACE
Class for adding derivatives from restraints to the model.
Class for adding derivatives from restraints to the model.
Class for adding up scores during ScoringFunction evaluation.
ScoreAccumulator(ScoreAccumulator o, const Restraint *r)
bool get_is_evaluate_if_below() const
bool get_is_evaluate_if_good() const
double get_maximum() const
void add_score(double score)
ScoreAccumulator(ScoreAccumulator o, double weight, double local_max)
bool get_abort_evaluation() const
Return if the score already exceeds the maximum.
Various useful constants.
Exception definitions and assertions.
Logging and error reporting support.
#define IMP_LOG_VERBOSE(expr)
Helper functions to check for NaN or infinity.
IMP::Vector< EvaluationState > EvaluationStates
const double NO_MAX
Use this value when you want to turn off maximum for restraint evaluation.
IMP::Vector< ScoreAccumulator > ScoreAccumulators
Macros to help with objects that can be printed to a stream.
#define IMP_SHOWABLE_INLINE(Name, how_to_show)
Declare the methods needed by an object that can be printed.
#define IMP_OMP_PRAGMA(x)
Macros to help in defining tuple classes.
Macros to help in implementing Value objects.
#define IMP_VALUES(Name, PluralName)
Define the type for storing sets of values.