src/work/marci/lp/max_flow_by_lp.cc
changeset 986 e997802b855c
parent 921 818510fa3d99
child 1014 aae850a2394d
equal deleted inserted replaced
1:9c34fce04bd8 2:5896c9db7aa5
    61     std::cout << "elapsed time: " << ts << std::endl;
    61     std::cout << "elapsed time: " << ts << std::endl;
    62     std::cout << "flow value: "<< max_flow_test.flowValue() << std::endl;
    62     std::cout << "flow value: "<< max_flow_test.flowValue() << std::endl;
    63     max_flow_test.actMinCut(cut);
    63     max_flow_test.actMinCut(cut);
    64 
    64 
    65     FOR_EACH_LOC(Graph::EdgeIt, e, g) {
    65     FOR_EACH_LOC(Graph::EdgeIt, e, g) {
    66       if (cut[g.tail(e)] && !cut[g.head(e)] && !flow[e]==cap[e]) 
    66       if (cut[g.source(e)] && !cut[g.target(e)] && !flow[e]==cap[e]) 
    67 	std::cout << "Slackness does not hold!" << std::endl;
    67 	std::cout << "Slackness does not hold!" << std::endl;
    68       if (!cut[g.tail(e)] && cut[g.head(e)] && flow[e]>0) 
    68       if (!cut[g.source(e)] && cut[g.target(e)] && flow[e]>0) 
    69 	std::cout << "Slackness does not hold!" << std::endl;
    69 	std::cout << "Slackness does not hold!" << std::endl;
    70     }
    70     }
    71   }
    71   }
    72 
    72 
    73 //   {
    73 //   {
    77 //     max_flow_test.preflow(MaxFlow<Graph, int, Graph::EdgeMap<int>, Graph::EdgeMap<int> >::GEN_FLOW);
    77 //     max_flow_test.preflow(MaxFlow<Graph, int, Graph::EdgeMap<int>, Graph::EdgeMap<int> >::GEN_FLOW);
    78 //     std::cout << "elapsed time: " << ts << std::endl;
    78 //     std::cout << "elapsed time: " << ts << std::endl;
    79 //     std::cout << "flow value: "<< max_flow_test.flowValue() << std::endl;
    79 //     std::cout << "flow value: "<< max_flow_test.flowValue() << std::endl;
    80 
    80 
    81 //     FOR_EACH_LOC(Graph::EdgeIt, e, g) {
    81 //     FOR_EACH_LOC(Graph::EdgeIt, e, g) {
    82 //       if (cut[g.tail(e)] && !cut[g.head(e)] && !flow[e]==cap[e]) 
    82 //       if (cut[g.source(e)] && !cut[g.target(e)] && !flow[e]==cap[e]) 
    83 // 	std::cout << "Slackness does not hold!" << std::endl;
    83 // 	std::cout << "Slackness does not hold!" << std::endl;
    84 //       if (!cut[g.tail(e)] && cut[g.head(e)] && flow[e]>0) 
    84 //       if (!cut[g.source(e)] && cut[g.target(e)] && flow[e]>0) 
    85 // 	std::cout << "Slackness does not hold!" << std::endl;
    85 // 	std::cout << "Slackness does not hold!" << std::endl;
    86 //     }
    86 //     }
    87 //   }
    87 //   }
    88 
    88 
    89 //   {
    89 //   {
   104     std::cout << "elapsed time: " << ts << std::endl;
   104     std::cout << "elapsed time: " << ts << std::endl;
   105     std::cout << "number of augmentation phases: " << i << std::endl; 
   105     std::cout << "number of augmentation phases: " << i << std::endl; 
   106     std::cout << "flow value: "<< augmenting_flow_test.flowValue() << std::endl;
   106     std::cout << "flow value: "<< augmenting_flow_test.flowValue() << std::endl;
   107 
   107 
   108     FOR_EACH_LOC(Graph::EdgeIt, e, g) {
   108     FOR_EACH_LOC(Graph::EdgeIt, e, g) {
   109       if (cut[g.tail(e)] && !cut[g.head(e)] && !flow[e]==cap[e]) 
   109       if (cut[g.source(e)] && !cut[g.target(e)] && !flow[e]==cap[e]) 
   110 	std::cout << "Slackness does not hold!" << std::endl;
   110 	std::cout << "Slackness does not hold!" << std::endl;
   111       if (!cut[g.tail(e)] && cut[g.head(e)] && flow[e]>0) 
   111       if (!cut[g.source(e)] && cut[g.target(e)] && flow[e]>0) 
   112 	std::cout << "Slackness does not hold!" << std::endl;
   112 	std::cout << "Slackness does not hold!" << std::endl;
   113     }
   113     }
   114   }
   114   }
   115 
   115 
   116 //   {
   116 //   {
   133     std::cout << "elapsed time: " << ts << std::endl;
   133     std::cout << "elapsed time: " << ts << std::endl;
   134     std::cout << "number of augmentation phases: " << i << std::endl; 
   134     std::cout << "number of augmentation phases: " << i << std::endl; 
   135     std::cout << "flow value: "<< augmenting_flow_test.flowValue() << std::endl;
   135     std::cout << "flow value: "<< augmenting_flow_test.flowValue() << std::endl;
   136 
   136 
   137     FOR_EACH_LOC(Graph::EdgeIt, e, g) {
   137     FOR_EACH_LOC(Graph::EdgeIt, e, g) {
   138       if (cut[g.tail(e)] && !cut[g.head(e)] && !flow[e]==cap[e]) 
   138       if (cut[g.source(e)] && !cut[g.target(e)] && !flow[e]==cap[e]) 
   139 	std::cout << "Slackness does not hold!" << std::endl;
   139 	std::cout << "Slackness does not hold!" << std::endl;
   140       if (!cut[g.tail(e)] && cut[g.head(e)] && flow[e]>0) 
   140       if (!cut[g.source(e)] && cut[g.target(e)] && flow[e]>0) 
   141 	std::cout << "Slackness does not hold!" << std::endl;
   141 	std::cout << "Slackness does not hold!" << std::endl;
   142     }
   142     }
   143   }
   143   }
   144 
   144 
   145 //   {
   145 //   {
   151 //     std::cout << "elapsed time: " << ts << std::endl;
   151 //     std::cout << "elapsed time: " << ts << std::endl;
   152 //     std::cout << "number of augmentation phases: " << i << std::endl; 
   152 //     std::cout << "number of augmentation phases: " << i << std::endl; 
   153 //     std::cout << "flow value: "<< augmenting_flow_test.flowValue() << std::endl;
   153 //     std::cout << "flow value: "<< augmenting_flow_test.flowValue() << std::endl;
   154 
   154 
   155 //     FOR_EACH_LOC(Graph::EdgeIt, e, g) {
   155 //     FOR_EACH_LOC(Graph::EdgeIt, e, g) {
   156 //       if (cut[g.tail(e)] && !cut[g.head(e)] && !flow[e]==cap[e]) 
   156 //       if (cut[g.source(e)] && !cut[g.target(e)] && !flow[e]==cap[e]) 
   157 // 	std::cout << "Slackness does not hold!" << std::endl;
   157 // 	std::cout << "Slackness does not hold!" << std::endl;
   158 //       if (!cut[g.tail(e)] && cut[g.head(e)] && flow[e]>0) 
   158 //       if (!cut[g.source(e)] && cut[g.target(e)] && flow[e]>0) 
   159 // 	std::cout << "Slackness does not hold!" << std::endl;
   159 // 	std::cout << "Slackness does not hold!" << std::endl;
   160 //     }
   160 //     }
   161 //   }
   161 //   }
   162 
   162 
   163 //   {
   163 //   {
   169 //     std::cout << "elapsed time: " << ts << std::endl;
   169 //     std::cout << "elapsed time: " << ts << std::endl;
   170 //     std::cout << "number of augmentation phases: " << i << std::endl; 
   170 //     std::cout << "number of augmentation phases: " << i << std::endl; 
   171 //     std::cout << "flow value: "<< augmenting_flow_test.flowValue() << std::endl;
   171 //     std::cout << "flow value: "<< augmenting_flow_test.flowValue() << std::endl;
   172 
   172 
   173 //     FOR_EACH_LOC(Graph::EdgeIt, e, g) {
   173 //     FOR_EACH_LOC(Graph::EdgeIt, e, g) {
   174 //       if (cut[g.tail(e)] && !cut[g.head(e)] && !flow[e]==cap[e]) 
   174 //       if (cut[g.source(e)] && !cut[g.target(e)] && !flow[e]==cap[e]) 
   175 // 	std::cout << "Slackness does not hold!" << std::endl;
   175 // 	std::cout << "Slackness does not hold!" << std::endl;
   176 //       if (!cut[g.tail(e)] && cut[g.head(e)] && flow[e]>0) 
   176 //       if (!cut[g.source(e)] && cut[g.target(e)] && flow[e]>0) 
   177 // 	std::cout << "Slackness does not hold!" << std::endl;
   177 // 	std::cout << "Slackness does not hold!" << std::endl;
   178 //     }
   178 //     }
   179 //   }
   179 //   }
   180 
   180 
   181   ts.reset();
   181   ts.reset();