Chris@16: //======================================================================= Chris@16: // Copyright 2013 University of Warsaw. Chris@16: // Authors: Piotr Wygocki Chris@16: // Chris@16: // Distributed under the Boost Software License, Version 1.0. (See Chris@16: // accompanying file LICENSE_1_0.txt or copy at Chris@16: // http://www.boost.org/LICENSE_1_0.txt) Chris@16: //======================================================================= Chris@16: #ifndef BOOST_GRAPH_FIND_FLOW_COST_HPP Chris@16: #define BOOST_GRAPH_FIND_FLOW_COST_HPP Chris@16: Chris@16: #include Chris@16: Chris@16: namespace boost { Chris@16: Chris@16: template Chris@16: typename property_traits::type>::value_type Chris@16: find_flow_cost(const Graph & g, Capacity capacity, ResidualCapacity residual_capacity, Weight weight) { Chris@16: typedef typename property_traits::const_type>::value_type Cost; Chris@16: Chris@16: Cost cost = 0; Chris@16: BGL_FORALL_EDGES_T(e, g, Graph) { Chris@16: if(get(capacity, e) > Cost(0)) { Chris@16: cost += (get(capacity, e) - get(residual_capacity, e)) * get(weight, e); Chris@16: } Chris@16: } Chris@16: return cost; Chris@16: } Chris@16: Chris@16: template Chris@16: typename property_traits::type>::value_type Chris@16: find_flow_cost(const Graph & g, Chris@16: const bgl_named_params& params) { Chris@16: return find_flow_cost(g, Chris@16: choose_const_pmap(get_param(params, edge_capacity), g, edge_capacity), Chris@16: choose_const_pmap(get_param(params, edge_residual_capacity), Chris@16: g, edge_residual_capacity), Chris@16: choose_const_pmap(get_param(params, edge_weight), g, edge_weight)); Chris@16: } Chris@16: Chris@16: template Chris@16: typename property_traits::type>::value_type Chris@16: find_flow_cost(const Graph &g) { Chris@16: bgl_named_params params(0); Chris@16: return find_flow_cost(g, params); Chris@16: } Chris@16: Chris@16: Chris@16: } //boost Chris@16: Chris@16: #endif /* BOOST_GRAPH_FIND_FLOW_COST_HPP */ Chris@16: