コード例 #1
0
        void calc_next_sols()
        {
          if (is_allocable()) {
            dag_hop_constrained_shortest_paths(
                graph,
                num_center + 2,
                get(boost::vertex_index, graph),
                get(boost::edge_index, graph),
                vertex(0, graph),
                vertex(num_vertices(graph) - 1, graph),
                get(boost::edge_bundle, graph),
                *optimal_solutions,
                *optimal_resource_containers);

            next_value = (*optimal_resource_containers)[0].weight;
            next_solution.swap((*optimal_solutions)[0]);
          }
        }
コード例 #2
0
 graph_info
 (const Graph& g, Compare cmp, Combine& cmb, DistZero zero,
  OptimalSolutions& opt_sols, OptimalResouceContainers& opt_res_conts)
   : graph(g), num_center(0), prev_value(zero), next_value(zero),
   compare(cmp), combine(&cmb),
   optimal_solutions(&opt_sols),
   optimal_resource_containers(&opt_res_conts)
 {
   using boost::num_vertices;
   using boost::vertex;
   typedef typename boost::graph_traits<Graph>::vertex_descriptor Vertex;
   if (num_vertices(graph) > 1) {
     const Vertex s = vertex(0, graph);
     const Vertex t = vertex(num_vertices(graph) - 1, graph);
     typename boost::graph_traits<Graph>::edge_descriptor e;
     boost::tie(e, boost::tuples::ignore) = edge(s, t, graph);
     prev_value = g[e];
     prev_solution.push_back(e);
     calc_next_sols();
   }
 }