/** * \file IncrementalScoringFunction.h \brief Simple Monte Carlo optimizer. * * Copyright 2007-2013 IMP Inventors. All rights reserved. * */ #ifndef IMPCORE_INTERNAL_INCREMENTAL_SCORING_FUNCTION_H #define IMPCORE_INTERNAL_INCREMENTAL_SCORING_FUNCTION_H #include #include "../RestraintsScoringFunction.h" #include #include #include #include #include #include IMPCORE_BEGIN_INTERNAL_NAMESPACE struct IMPCOREEXPORT NBGenerator { base::Pointer m_; base::OwnerPointer score_; double distance_; ParticleIndexes pis_; PairPredicates filters_; base::map to_dnn_; base::OwnerPointer dnn_; NBGenerator(Model*m, const ParticleIndexes& pis, PairScore* ps, double distance, const PairPredicates &pfs); struct single_result_type: public ParticleIndexPair { double score; single_result_type(ParticleIndex a, ParticleIndex b, double s): ParticleIndexPair(a,b), score(s){} IMP_SHOWABLE_INLINE(single_result_type, ParticleIndexPair::show(out); out << " " << score;); }; typedef base::Vector result_type; typedef ParticleIndexes argument_type; template result_type operator()(const argument_type &a, const T&) const { return operator()(a); } result_type operator()( argument_type a) const; }; struct IMPCOREEXPORT NBChecker { base::Pointer m_; ParticleIndexes pis_; base::Pointer score_; double distance_; PairPredicates filt_; NBChecker(Model *m, const ParticleIndexes &pis, PairScore *score, double d, const PairPredicates &filt); bool operator()(const NBGenerator::result_type &vals) const; }; class IMPCOREEXPORT NBLScoring { ParticleIndexes to_move_; base::OwnerPointer dummy_restraint_; typedef base::SparseSymmetricPairMemoizer Cache; Cache cache_; // changes to cache for rollback double weight_, max_; base::map controlled_; public: NBLScoring(PairScore *ps, double distance, const ParticleIndexes &to_move, const ParticlesTemp &particles, const PairPredicates &filters, double weight, double max); void set_moved(const ParticleIndexes& moved); double get_score(); Restraint* create_restraint() const; Restraint* get_dummy_restraint() const { return dummy_restraint_; } void update_dependencies(const DependencyGraph &dg, const DependencyGraphVertexIndex &index); }; IMPCORE_END_INTERNAL_NAMESPACE #endif /* IMPCORE_INTERNAL_INCREMENTAL_SCORING_FUNCTION_H */