Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed pruning conditions in different implementations. #32

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CSA.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ void main_loop(int arrival_station) {
if(connection.arrival_station == arrival_station) {
earliest = Math.min(earliest, connection.arrival_timestamp);
}
} else if(connection.arrival_timestamp > earliest) {
} else if(connection.departure_timestamp >= earliest) {
return;
}
}
Expand Down
2 changes: 1 addition & 1 deletion csa.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ void compute_route(array_of(connection) *timetable, request *rq)
if(c->to == rq->to) {
earliest = MIN(earliest, c->end);
}
} else if(c->end > earliest) {
} else if(c->start >= earliest) {
break;
}
}
Expand Down
2 changes: 1 addition & 1 deletion csa.cc
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ struct CSA {
if(connection.arrival_station == arrival_station) {
earliest = std::min(earliest, connection.arrival_timestamp);
}
} else if(connection.arrival_timestamp > earliest) {
} else if(connection.departure_timestamp >= earliest) {
return;
}
}
Expand Down
2 changes: 1 addition & 1 deletion csa.hs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ augmentTimetable earliestArrival timetable@(Timetable arrivalTimes inConnections
newTimetable = Timetable newArrivalTimes newInConnections
in augmentTimetable (min arrivalTime earliestArrival) newTimetable connections
else
if arrivalTime > earliestArrival
if departureTime >= earliestArrival
then
timetable
else
Expand Down
2 changes: 1 addition & 1 deletion csa.lua
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function find(connections, earliest_arr, in_conn, arr)
if cas == arr then
earliest = math.min(earliest, cat)
end
elseif cat > earliest then
elseif cdt >= earliest then
return
end
end
Expand Down
2 changes: 1 addition & 1 deletion csa.pas
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ procedure mainLoop(arrivalStation: Longword);
if (timetable[i].arrivalStation = arrivalStation) then
earliest := min(timetable[i].arrivalTime, earliest);
end
else if (timetable[i].arrivalTime > earliest) then
else if (timetable[i].departureTime >= earliest) then
Exit;
end;
end;
Expand Down
2 changes: 1 addition & 1 deletion csa.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def main_loop(self, arrival_station):

if c.arrival_station == arrival_station:
earliest = min(earliest, c.arrival_timestamp)
elif c.arrival_timestamp > earliest:
elif c.departure_timestamp >= earliest:
return

def print_result(self, arrival_station):
Expand Down
2 changes: 1 addition & 1 deletion csa.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def main_loop(arrival_station)
if c.arrival_station == arrival_station
earliest = [earliest, c.arrival_timestamp].min
end
elsif c.arrival_timestamp > earliest
elsif c.departure_timestamp >= earliest
return
end
end
Expand Down
2 changes: 1 addition & 1 deletion csa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ fn csa_main_loop(timetable: &[Connection], arrival_station: usize, earliest_arri
if connection.arrival_station == arrival_station && connection.arrival_timestamp < earliest {
earliest = connection.arrival_timestamp;
}
} else if connection.arrival_timestamp > earliest {
} else if connection.departure_timestamp >= earliest {
break;
}
}
Expand Down