Bst& MeChart:: findMapParse() { if(printDebug() > 8) { prDp(); cerr << "In findMapParse" << endl; } Item* s = topS(); assert(s); fillInHeads(); int s1Int = s->term()->toInt(); FullHist s1Fh(s1Int,NULL); s1Fh.cb = this; Bst& bst = bestParse(s, &s1Fh,NULL,NULL,0); return bst; }
// {{{ 早さ最適化経路 void bfsFast(void) { int i; end = 0; top = 0; int *dp; dp = malloc((n + 1) * sizeof(int)); for (i = 0; i < n; i++) dp[i] = INF; push(startStation, startTime, 0); while(top != end) { int s = topS(); int t = topT(); int c = topC(); pop(); for (i = 0; i < nextTransLast[s]; i++) { int currentS = nextTrans[s][i]; int currentC = c; int currentT = t; if (s != currentS) currentC++; if (dp[currentS] > currentT) { dp[currentS] = currentT; way_copy(currentS, s); way_pb(currentS, currentS, currentT); if (currentS != goal) push(currentS, currentT, currentC); } int reachS = nextGo[currentS]; if (reachS == - 1) continue; int reachC = currentC; int reachT = findTime(currentS, currentT); //timeArriveをかえす if (dp[reachS] > reachT) { dp[reachS] = reachT; way_copy(reachS, s); way_pb(reachS, currentS, currentT); way_pb(reachS, reachS, reachT); push(reachS, reachT, reachC); } } } }