lemon/network_simplex.h
changeset 2468 16615642ac7b
parent 2444 06f3702bf18d
child 2471 ed70b226cc48
equal deleted inserted replaced
1:76addb67b01f 2:811bd273ed36
   273       for (typename Graph::NodeIt n(graph_ref); n != INVALID; ++n)
   273       for (typename Graph::NodeIt n(graph_ref); n != INVALID; ++n)
   274 	sum += _supply[n];
   274 	sum += _supply[n];
   275       if (!(valid_supply = sum == 0)) return;
   275       if (!(valid_supply = sum == 0)) return;
   276 
   276 
   277       // Copying graph_ref to graph
   277       // Copying graph_ref to graph
       
   278       graph.reserveNode(countNodes(graph_ref) + 1);
       
   279       graph.reserveEdge(countEdges(graph_ref) + countNodes(graph_ref));
   278       copyGraph(graph, graph_ref)
   280       copyGraph(graph, graph_ref)
   279 	.edgeMap(cost, _cost)
   281 	.edgeMap(cost, _cost)
   280 	.nodeRef(node_ref)
   282 	.nodeRef(node_ref)
   281 	.edgeRef(edge_ref)
   283 	.edgeRef(edge_ref)
   282 	.run();
   284 	.run();
   475 
   477 
   476       // Adding an artificial root node to the graph
   478       // Adding an artificial root node to the graph
   477       root = graph.addNode();
   479       root = graph.addNode();
   478       parent[root] = INVALID;
   480       parent[root] = INVALID;
   479       pred_edge[root] = INVALID;
   481       pred_edge[root] = INVALID;
   480       depth[root] = supply[root] = potential[root] = 0;
   482       depth[root] = 0;
       
   483       supply[root] = 0;
       
   484       potential[root] = 0;
   481 
   485 
   482       // Adding artificial edges to the graph and initializing the node
   486       // Adding artificial edges to the graph and initializing the node
   483       // maps of the spanning tree data structure
   487       // maps of the spanning tree data structure
   484       Supply sum = 0;
   488       Supply sum = 0;
   485       Node last = root;
   489       Node last = root;
   511       thread[last] = root;
   515       thread[last] = root;
   512 
   516 
   513 #ifdef EDGE_BLOCK_PIVOT
   517 #ifdef EDGE_BLOCK_PIVOT
   514       // Initializing block_size for the edge block pivot rule
   518       // Initializing block_size for the edge block pivot rule
   515       int edge_num = countEdges(graph);
   519       int edge_num = countEdges(graph);
   516       block_size = edge_num >= BLOCK_NUM * MIN_BLOCK_SIZE ? 
   520       block_size = edge_num >= BLOCK_NUM * MIN_BLOCK_SIZE ?
   517 		   edge_num / BLOCK_NUM : MIN_BLOCK_SIZE;
   521 		   edge_num / BLOCK_NUM : MIN_BLOCK_SIZE;
   518 #endif
   522 #endif
   519 #ifdef CANDIDATE_LIST_PIVOT
   523 #ifdef CANDIDATE_LIST_PIVOT
   520       minor_count = 0;
   524       minor_count = 0;
   521 #endif
   525 #endif