9 #ifndef IMPKERNEL_ATTRIBUTE_OPTIMIZER_H
10 #define IMPKERNEL_ATTRIBUTE_OPTIMIZER_H
12 #include <IMP/kernel/kernel_config.h>
15 IMPKERNEL_BEGIN_NAMESPACE
37 return get_model()->get_optimized_attributes();
39 void set_value(
FloatIndex fi,
double v)
const {
40 get_model()->set_attribute(fi.get_key(), fi.get_particle(), v);
44 return get_model()->get_attribute(fi.get_key(), fi.get_particle());
48 return get_model()->get_derivative(fi.get_key(), fi.get_particle());
54 if (widths_.size() <= k.get_index() || widths_[k.get_index()] == 0) {
56 double wid =
static_cast<double>(w.second) - w.first;
57 widths_.resize(std::max(widths_.size(), size_t(k.get_index() + 1)), 0.0);
60 widths_[k.get_index()] = wid;
62 widths_[k.get_index()] = 1.0;
65 return widths_[k.get_index()];
76 double wid = get_width(fi.get_key());
77 set_value(fi, v * wid);
81 double uv = get_value(fi);
82 double wid = get_width(fi.get_key());
86 double get_scaled_derivative(
FloatIndex fi)
const {
87 double uv = get_derivative(fi);
88 double wid = get_width(fi.get_key());
102 IMPKERNEL_END_NAMESPACE
std::pair< Float, Float > FloatRange
A pair representing the allowed range for a Float attribute.
Base class for all optimizers.
void clear_range_cache()
Clear the cache of range information. Do this at the start of.
Base class for all optimizers.
Base class for optimizers that act on individual attributes.
#define IMP_OBJECTS(Name, PluralName)
Define the types for storing sets of objects.
double Float
Basic floating-point value (could be float, double...)
Class for storing model, its restraints, constraints, and particles.