Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/03/14 16:19:44 (11 years ago)
Author:
abeham
Message:

#2182: merged r10858 to stable

Location:
stable
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.Problems.VehicleRouting

  • stable/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Creators/PushForwardInsertionCreator.cs

    r10507 r10928  
    3333
    3434namespace HeuristicLab.Problems.VehicleRouting.Encodings.Potvin {
    35   [Item("PushForwardInsertionCreator", "Creates a randomly initialized VRP solution.")]
     35  [Item("PushForwardInsertionCreator", "The push forward insertion heuristic. It is implemented as described in Sam, and Thangiah, R. (1999). A Hybrid Genetic Algorithms, Simulated Annealing and Tabu Search Heuristic for Vehicle Routing Problems with Time Windows. Practical Handbook of Genetic Algorithms, Volume III, pp 347–381.")]
    3636  [StorableClass]
    3737  public sealed class PushForwardInsertionCreator : PotvinCreator, IStochasticOperator {
     
    138138          dueTime = 0;
    139139
    140         double dist;
    141         if (problemInstance.Coordinates[customer + depotCount - 1, 0] < x0)
    142           dist = -distance;
    143         else
    144           dist = distance;
     140        double x = problemInstance.Coordinates[customer + depotCount - 1, 0];
     141        double y = problemInstance.Coordinates[customer + depotCount - 1, 1];
    145142
    146143        double cost = alpha * distance + // distance 0 <-> City[i]
    147                    -beta * dueTime + // latest arrival time
    148                    -gamma * (Math.Asin((problemInstance.Coordinates[customer + depotCount - 1, 1] - y0) / dist) / 360 * dist); // polar angle
     144                      -beta * dueTime + // latest arrival time
     145                      -gamma * ((Math.Atan2(y - y0, x - x0) + Math.PI) / (2.0 * Math.PI) * distance); // polar angle
    149146
    150147        if (cost < minCost) {
Note: See TracChangeset for help on using the changeset viewer.