Last change
on this file since 15157 was
8520,
checked in by spimming, 12 years ago
|
#1894:
- extended datasource interface to get routing graph for a specific vehicle type
- use ICostCalculator to calculate edge weights
- moved common enums in own file
- removed method to estimate cost from graph; use ICostCalculator
|
File size:
1.1 KB
|
Rev | Line | |
---|
[8520] | 1 | using HeuristicLab.Problems.RoutePlanning.Data.Core;
|
---|
[8516] | 2 | using HeuristicLab.Problems.RoutePlanning.Interfaces;
|
---|
[8520] | 3 | using HeuristicLab.Problems.RoutePlanning.Utilities;
|
---|
[8516] | 4 |
|
---|
| 5 | namespace HeuristicLab.Problems.RoutePlanning.RoutingGraph {
|
---|
| 6 | public class EarthDistanceCostCalculator : ICostCalculator {
|
---|
| 7 | #region ICostCalculator Members
|
---|
| 8 |
|
---|
| 9 | public float Costs(Edge<Vertex> edge) {
|
---|
| 10 | return edge.Weight;
|
---|
| 11 | }
|
---|
| 12 |
|
---|
[8520] | 13 | public float CalculateCosts(Vertex source, Vertex destination, HighwayType category) {
|
---|
| 14 | double distanceKms = Utils.LocationDistance(source.Logitude, source.Latitude,
|
---|
| 15 | destination.Logitude, destination.Latitude);
|
---|
| 16 | double weight = distanceKms;
|
---|
| 17 | return (float)weight;
|
---|
| 18 | }
|
---|
| 19 |
|
---|
[8516] | 20 | public float EstimatedCosts(Vertex source, Vertex destination) {
|
---|
[8520] | 21 | double distanceKms = Utils.LocationDistance(source.Logitude, source.Latitude,
|
---|
| 22 | destination.Logitude, destination.Latitude);
|
---|
| 23 | double weight = distanceKms;
|
---|
| 24 | return (float)weight;
|
---|
[8516] | 25 | }
|
---|
| 26 |
|
---|
| 27 | #endregion
|
---|
| 28 | }
|
---|
| 29 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.