00001 /** 00002 * \file Constraint.h \brief A base class for constraints. 00003 * 00004 * Copyright 2007-2010 IMP Inventors. All rights reserved. 00005 * 00006 */ 00007 00008 #ifndef IMP_CONSTRAINT_H 00009 #define IMP_CONSTRAINT_H 00010 00011 #include "ScoreState.h" 00012 00013 IMP_BEGIN_NAMESPACE 00014 00015 //! Implement a constraint on the Model. 00016 /** The solution model can be restricted two ways, either by 00017 penalizing "bad" conformations (a restraint) or by forcing some 00018 set of attributes to a function of other attributes (a 00019 constraint). For example, rigid bodies consisting of a number of 00020 particles could be implemented either way. 00021 00022 - As a restraint: the particles in the rigid body are each moved 00023 independently by the optimizer. The scoring function has a term 00024 for how far each particle diverges from its rigid position. 00025 00026 - As a constraint: the optimizer only changes the position of the 00027 rigid body itself and the position of the particles in the body 00028 are computed from the position of the rigid body. 00029 00030 In IMP, constraints are implemented as a type of 00031 ScoreState. Before evaluation, the constraint updates the 00032 attributes of some of the particles to ensure that the constraint 00033 is satisfied. Since this update creates implicit relationships 00034 between the particles, after the derivatives are computed, the 00035 constraint can move them around to make sure the derivatives of 00036 the optimizer parameters are correct. 00037 00038 In general, constraints are associated with Decorator objects 00039 and created invisibly when needed. 00040 00041 \note Constraint invariants will not necessarily hold if 00042 involved particles have been called and Model::evaluate() 00043 has not been called. For example, if you change a 00044 particle's coordinates, a IMP::core::Centroid of a set 00045 containing the particle will not be correct until the 00046 Model is evaluated. 00047 00048 \implementationwithoutexample{Constraint, IMP_CONSTRAINT} 00049 */ 00050 class IMPEXPORT Constraint : public ScoreState 00051 { 00052 public: 00053 Constraint(std::string name=std::string()); 00054 00055 IMP_REF_COUNTED_DESTRUCTOR(Constraint); 00056 }; 00057 00058 00059 IMP_OBJECTS(Constraint); 00060 00061 IMP_END_NAMESPACE 00062 00063 #endif /* IMP_CONSTRAINT_H */