10 #ifndef IMPMULTI_STATE_MULTI_STATE_MODEL_H
11 #define IMPMULTI_STATE_MULTI_STATE_MODEL_H
13 #include <IMP/multi_state/multi_state_config.h>
19 IMPMULTISTATE_BEGIN_NAMESPACE
21 class MultiStateModel {
23 MultiStateModel(
unsigned int size) : score_(0.0), zscore_(0.0) {
24 states_.reserve(size);
29 void add_state(
unsigned int new_state) {
30 states_.push_back(new_state);
35 void set_score(
double score) { score_ = score; }
37 void set_zscore(
double score) { zscore_ = score; }
39 void replace_last_state(
unsigned int new_state) {
40 states_[states_.size()-1] = new_state;
45 const std::vector<unsigned int>& get_states()
const {
return states_; }
47 double get_score()
const {
return score_; }
49 double get_zscore()
const {
return zscore_; }
51 unsigned int size()
const {
return states_.size(); }
53 unsigned int get_last_state()
const {
return states_.back(); }
55 friend std::ostream& operator<<(std::ostream& s,
const MultiStateModel& e) {
56 for(
unsigned int i=0; i<e.states_.size(); i++)
57 s << std::setw(4) << e.states_[i] <<
" ";
58 s << std::setw(6) << std::setprecision(4) << e.score_;
63 std::vector<unsigned int> states_;
68 class CompareMultiStateModels {
70 bool operator()(
const MultiStateModel& e1,
const MultiStateModel& e2)
const {
71 return (e1.get_score() < e2.get_score());
75 IMPMULTISTATE_END_NAMESPACE