forked from Project-OSRM/osrm-backend
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Refactor station finder to support via Telenav search and v…
…ia local search issue: #270
- Loading branch information
1 parent
f6be7b0
commit 5f1b272
Showing
33 changed files
with
702 additions
and
471 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
47 changes: 0 additions & 47 deletions
47
integration/service/oasis/stationfinder/dest_station_finder_test.go
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,36 @@ | ||
// Package stationfinder provide functionality to find nearby charge stations and | ||
// related algorithm. | ||
// Finders: | ||
// - origStationFinder holds logic for how to find reachable charge stations | ||
// based on current energy level. | ||
// - destStationFinder holds logic for how to find reachable charge stations | ||
// based on safe energy level and distance to nearest charge station(todo). | ||
// - lowEnergyLocationStationFinder holds logic for how to find reachable | ||
// charge station near certain location. | ||
// - orig_iterator and dest_iterator wraps single point of orig/dest which could | ||
// be used for algorithms | ||
/* | ||
// Algorithm: | ||
// - Each finder provide iterator to iterate charge station candidates. | ||
// - The choice of channel as response makes algorithm could be asynchronous func. | ||
// - FindOverlapBetweenStations provide functionality to find overlap | ||
// between two iterator. | ||
// - CalcWeightBetweenChargeStationsPair provide functionality to calculate | ||
// cost between two group of charge stations which could construct a new | ||
// graph as edges. | ||
Package stationfinder provide functionality to find nearby charge stations and | ||
related algorithm. | ||
It's find functionality could be achieved by: | ||
- TNSearchFinder, which is implemented by Telenav's search web service. | ||
+ The data source is from professional data | ||
+ Based on Lucence and hilbert value | ||
+ Could potentially supports dynamic information | ||
- LocalIndexerFinder | ||
+ Support any kind of data sources as long as following format defined in https://github.com/Telenav/osrm-backend/issues/237#issue-585201041 | ||
+ For Telenav usage, uses the same source with Telenav search service | ||
+ Spatial index is build based on google s2 | ||
Finders: | ||
- origStationFinder holds logic for how to find reachable charge stations | ||
based on current energy level. | ||
- destStationFinder holds logic for how to find reachable charge stations | ||
based on safe energy level and distance to nearest charge station(todo). | ||
- lowEnergyLocationStationFinder holds logic for how to find reachable | ||
charge station near certain location. | ||
- orig_iterator and dest_iterator wraps single point of orig/dest which could | ||
be used for algorithms | ||
Algorithm: | ||
- Each finder provide iterator to iterate charge station candidates. | ||
- The choice of channel as response makes algorithm could be asynchronous func. | ||
- FindOverlapBetweenStations provide functionality to find overlap | ||
between two iterator. | ||
- CalcWeightBetweenChargeStationsPair provide functionality to calculate | ||
cost between two group of charge stations which could construct a new | ||
graph as edges. | ||
*/ | ||
package stationfinder |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package stationfinder | ||
|
||
import ( | ||
"github.com/Telenav/osrm-backend/integration/pkg/api/nav" | ||
"github.com/Telenav/osrm-backend/integration/pkg/api/oasis" | ||
"github.com/Telenav/osrm-backend/integration/service/oasis/osrmconnector" | ||
"github.com/Telenav/osrm-backend/integration/service/oasis/stationfinder/stationfindertype" | ||
) | ||
|
||
// StationFinder creates finders for different purpose, all finders must implement NearbyStationsIterator interface | ||
type StationFinder interface { | ||
// NewOrigStationFinder creates finder to search for nearby charge stations near orig | ||
NewOrigStationFinder(oasisReq *oasis.Request) stationfindertype.NearbyStationsIterator | ||
|
||
// NewDestStationFinder creates finder to search for nearby charge stations near destination | ||
NewDestStationFinder(oasisReq *oasis.Request) stationfindertype.NearbyStationsIterator | ||
|
||
// NewLowEnergyLocationStationFinder creates finder to search for nearby charge stations when energy is low | ||
NewLowEnergyLocationStationFinder(location *nav.Location) stationfindertype.NearbyStationsIterator | ||
} | ||
|
||
// Algorithm contains algorithm implemented based on NearbyStationsIterator | ||
type Algorithm interface { | ||
// FindOverlapBetweenStations finds overlap charge stations based on two iterator | ||
FindOverlapBetweenStations(iterF stationfindertype.NearbyStationsIterator, | ||
iterS stationfindertype.NearbyStationsIterator) []stationfindertype.ChargeStationInfo | ||
|
||
// CalcWeightBetweenChargeStationsPair accepts two iterators and calculates weights between each pair of iterators | ||
CalcWeightBetweenChargeStationsPair(from stationfindertype.NearbyStationsIterator, | ||
to stationfindertype.NearbyStationsIterator, | ||
table osrmconnector.TableRequster) ([]stationfindertype.NeighborInfo, error) | ||
|
||
// CalculateWeightBetweenNeighbors accepts locations array, which will search for nearby | ||
// charge stations and then calculate weight between stations, the result is used to | ||
// construct graph. | ||
CalculateWeightBetweenNeighbors(locations []*nav.Location, | ||
oc *osrmconnector.OSRMConnector, | ||
finder StationFinder) chan stationfindertype.WeightBetweenNeighbors | ||
} |
Oops, something went wrong.