示例#1
0
void Conn::printPathList(PathList& paths, Fleet::Ptr _fleet)
{
  
  
 // cout << "\n\nPrinting path list \n\n";
  while(!paths.empty())
	{

    Cost cost(0);
  	Time time(0);
    bool exp = true;
    Path p = paths.front();
		Path::iterator it = p.begin();

    for(; it != p.end(); it++)
		{
		  Segment* seg = *it;
			cost = cost + seg->cost(_fleet);
      time = time + seg->time(_fleet);
			if(!seg->expediteSupport()) exp = false;
		}
    cout << cost.string() << " " << time.string() << " " << (exp?"yes; ":"no; ");
	  Conn::printPath(paths.front());
		cout << "\n";
	  paths.pop();
	}
	
}
示例#2
0
// Run BFS to fill current gap 
void GapFiller::BFS(size_t left_index, size_t right_index, int gap, GapInfo* gapinfo) {
	int dis = gap + (_K-1+3*_DELTA) +30; //gap constraints

    PathList pathlist;
    BFS(_uniq_graph, left_index, right_index, dis, _STEP, 1000, pathlist);
    if (pathlist.empty()) {
        const std::string& lsequence = _uniq_graph._indexer[left_index].seq;
        const std::string& rsequence = _uniq_graph._indexer[right_index].seq;
        BFS(_all_graph, lsequence, rsequence, dis, _STEP, 2000, pathlist);
    }

    if (!pathlist.empty()) {
        if (pathlist.size() <= MAX_CHOICE) {
            if (gapinfo != NULL) {
                gapinfo->graph = 0;
                gapinfo->pathlist = pathlist;
            }
        } else {
            if (gapinfo != NULL) {
                gapinfo->graph = -1;
            }
        }
    }
}