Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
MultiStateAggregateFunction.cc
Go to the documentation of this file.
1 // -*- mode:c++;tab-width:2;indent-tabs-mode:t;show-trailing-whitespace:t;rm-trailing-spaces:t -*-
2 // vi: set ts=2 noet:
3 //
4 // (c) Copyright Rosetta Commons Member Institutions.
5 // (c) This file is part of the Rosetta software suite and is made available under license.
6 // (c) The Rosetta software is developed by the contributing members of the Rosetta Commons.
7 // (c) For more information, see http://www.rosettacommons.org. Questions about this can be
8 // (c) addressed to University of Washington UW TechTransfer, email: license@u.washington.edu.
9 
10 /// @file MultiStateAggregateFunction.tmpl.hh
11 /// @brief
12 /// @author Colin A. Smith
13 
14 // Unit headers
16 
17 #include <core/types.hh>
18 // AUTO-REMOVED #include <core/pose/Pose.hh> // REQUIRED FOR WINDOWS
19 
20 // Utility Headers
21 #include <utility/pointer/ReferenceCount.hh>
22 
25 #include <utility/exit.hh>
26 #include <utility/vector1.hh>
27 
28 
29 namespace protocols {
30 namespace multistate_design {
31 
34  utility::vector1<core::Real> const & single_state_fitnesses,
35  MultiStateFitnessFunction & fitness_function
36 ) const
37 {
38  utility::vector1<SingleStateCOP> single_states(fitness_function.const_states());
39  runtime_assert(single_state_fitnesses.size() == single_states.size());
40 
41  core::Real aggregate_fitness = 0;
42 
43  for (core::Size i = 1; i <= single_state_fitnesses.size(); ++i) {
44  aggregate_fitness += (single_states[i]->is_positive_state() ? 1.0 : -1.0) * single_state_fitnesses[i];
45  }
46 
47  return aggregate_fitness;
48 }
49 
50 } // namespace multistate_design
51 } // namespace protocols
52 
53