src/work/marci/lp/min_cost_gen_flow.h
changeset 1041 9d503ce002db
parent 1031 0b7169db694f
child 1074 4a24a46407db
equal deleted inserted replaced
3:27c9645b7db4 4:58fe7555e99e
   119       for (typename Graph::EdgeIt e(g); e!=INVALID; ++e) {
   119       for (typename Graph::EdgeIt e(g); e!=INVALID; ++e) {
   120 	typename GW::Edge ew(e, INVALID, false);
   120 	typename GW::Edge ew(e, INVALID, false);
   121 	typename GWWW::Edge ewww(ew, INVALID, false);
   121 	typename GWWW::Edge ewww(ew, INVALID, false);
   122 	flow.set(e, translated_flow[ewww]+lcapacity[e]);
   122 	flow.set(e, translated_flow[ewww]+lcapacity[e]);
   123       }
   123       }
   124       return (expected>=preflow.flowValue());
   124       return (preflow.flowValue()>=expected);
   125     }
   125     }
   126     // for nonnegative costs
   126     // for nonnegative costs
   127     bool run() {
   127     bool run() {
   128       //      std::cout << "making new vertices..." << std::endl; 
   128       //      std::cout << "making new vertices..." << std::endl; 
   129       typedef ListGraph Graph2;
   129       typedef ListGraph Graph2;
   206 	typename GWWW::Edge ewww(ew, INVALID, false);
   206 	typename GWWW::Edge ewww(ew, INVALID, false);
   207 	//	std::cout << g.id(e) << " " << flow[e] << std::endl;
   207 	//	std::cout << g.id(e) << " " << flow[e] << std::endl;
   208 	flow.set(e, lcapacity[e]+
   208 	flow.set(e, lcapacity[e]+
   209 		 min_cost_flow.getFlow()[ewww]);
   209 		 min_cost_flow.getFlow()[ewww]);
   210       }
   210       }
   211       return (expected>=min_cost_flow.flowValue());
   211       return (min_cost_flow.flowValue()>=expected);
   212     }
   212     }
   213     void runByLP() {
   213     void runByLP() {
   214       typedef LPSolverWrapper LPSolver;
   214       typedef LPSolverWrapper LPSolver;
   215       LPSolver lp;
   215       LPSolver lp;
   216       lp.setMinimize();
   216       lp.setMinimize();