There were various inconsistencies in how IMP handled maximum scores (eg who was responsible for reporting that scores were bad, how maxima were handled when decomposing restraints etc). This led to various bugs in domino and other optimizers when used with maximum scores. In order to address this and make cache and make cache management easier in Domino, I'd like to introduce the following changes:
- introduce IMP::domino::RestraintCache which provides a centralized cache for all restraint evaluations within a domino run. It has an interface that can be used to extract scores and will, eventually, support reading from and writing to disk.
- IMP::domino::RestraintScoreSubsetFilterTable and IMP::domino::MinimumRestrainScoreSubsetFilterTable will move to using this. That change will require code changes if you do something beyond just use them for filtering (eg extracting scores).
- reorganize general restraint evaluation around the concept of an IMP::ScoringFunction. This will bundle a list of restraints as well as cached information to aid in speedy evaluation. Since it is an object independent from the model, it is easier to manage having multiple scoring functions around (as is done in a number of Optimizers, Domino, etc). The model will have a default ScoringFunction, so once again, basic usage (Model::evaluate(), Restraint::evaluate()) will not change, but more involved evaluates, such as explicitly passing restraints to the model to evaluate or using Model::evaluate_if_good()) will change by requiring that you create a ScoringFunction first.
These provide a much cleaner and simpler set of functionality to manage restraint evaluation, and so should make further experiments less likely to introduce bugs as has happened recently.
Do these make sense? Any issues? More questions? As usual, code in the IMP repository will be updated as needed.
I more or less have the changes made (along with numerous bug fixes that came up in the process), but will be away for the weekend, so will wait until at least Monday.