Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/19/12 13:17:29 (12 years ago)
Author:
ascheibe
Message:

#1722 fixed more licensing information and source formatting

Location:
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Creators
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Creators/IterativeInsertionCreator.cs

    r6857 r8053  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    2222using System;
    2323using System.Collections.Generic;
     24using HeuristicLab.Common;
    2425using HeuristicLab.Core;
    2526using HeuristicLab.Data;
    26 using HeuristicLab.Encodings.PermutationEncoding;
    2727using HeuristicLab.Optimization;
    2828using HeuristicLab.Parameters;
    2929using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    30 using HeuristicLab.Common;
    3130using HeuristicLab.Problems.VehicleRouting.Interfaces;
    3231using HeuristicLab.Problems.VehicleRouting.ProblemInstances;
     
    8584      PotvinEncoding result = new PotvinEncoding(instance);
    8685
    87       IPickupAndDeliveryProblemInstance pdp = instance as IPickupAndDeliveryProblemInstance; 
     86      IPickupAndDeliveryProblemInstance pdp = instance as IPickupAndDeliveryProblemInstance;
    8887
    8988      List<int> customers = new List<int>();
    9089      for (int i = 1; i <= instance.Cities.Value; i++)
    91         if(pdp == null || pdp.GetDemand(i) >= 0)
     90        if (pdp == null || pdp.GetDemand(i) >= 0)
    9291          customers.Add(i);
    9392
    94       customers.Sort(delegate(int city1, int city2)
    95           {
     93      customers.Sort(delegate(int city1, int city2) {
    9694            double angle1 = CalculateAngleToDepot(instance, city1);
    9795            double angle2 = CalculateAngleToDepot(instance, city2);
     
    108106
    109107        int stopIdx = 0;
    110         if(currentTour.Stops.Count > 0)
     108        if (currentTour.Stops.Count > 0)
    111109          result.FindBestInsertionPlace(currentTour, customers[index]);
    112110        currentTour.Stops.Insert(stopIdx, customers[index]);
     
    118116
    119117        CVRPEvaluation evaluation = instance.EvaluateTour(currentTour, result) as CVRPEvaluation;
    120         if (result.Tours.Count < instance.Vehicles.Value && 
     118        if (result.Tours.Count < instance.Vehicles.Value &&
    121119          ((adhereTimeWindows && !instance.Feasible(evaluation)) || ((!adhereTimeWindows) && evaluation.Overload > double.Epsilon))) {
    122             currentTour.Stops.Remove(customers[index]);
    123             if (pdp != null)
    124               currentTour.Stops.Remove(pdp.GetPickupDeliveryLocation(customers[index]));
     120          currentTour.Stops.Remove(customers[index]);
     121          if (pdp != null)
     122            currentTour.Stops.Remove(pdp.GetPickupDeliveryLocation(customers[index]));
    125123
    126124          if (currentTour.Stops.Count == 0)
     
    128126          currentTour = new Tour();
    129127          result.Tours.Add(currentTour);
    130          
     128
    131129          currentTour.Stops.Add(customers[index]);
    132130          if (pdp != null) {
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Creators/PotvinCreator.cs

    r5127 r8053  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    23 using HeuristicLab.Data;
    24 using HeuristicLab.Operators;
    25 using HeuristicLab.Parameters;
    2624using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     25using HeuristicLab.Problems.VehicleRouting.Encodings.General;
    2726using HeuristicLab.Problems.VehicleRouting.Interfaces;
    28 using HeuristicLab.Problems.VehicleRouting.Encodings.General;
    29 using HeuristicLab.Common;
    3027
    3128namespace HeuristicLab.Problems.VehicleRouting.Encodings.Potvin {
     
    3633      get { return false; }
    3734    }
    38    
     35
    3936    [StorableConstructor]
    4037    protected PotvinCreator(bool deserializing) : base(deserializing) { }
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Creators/PushForwardInsertionCreator.cs

    r6881 r8053  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    2222using System;
    2323using System.Collections.Generic;
     24using HeuristicLab.Common;
    2425using HeuristicLab.Core;
    2526using HeuristicLab.Data;
    26 using HeuristicLab.Encodings.PermutationEncoding;
    2727using HeuristicLab.Optimization;
    2828using HeuristicLab.Parameters;
    2929using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    30 using HeuristicLab.Common;
    3130using HeuristicLab.Problems.VehicleRouting.Interfaces;
    3231using HeuristicLab.Problems.VehicleRouting.ProblemInstances;
     
    116115    }
    117116
    118     private static int GetNearestDepot(IVRPProblemInstance problemInstance, List<int> depots, int customer, 
     117    private static int GetNearestDepot(IVRPProblemInstance problemInstance, List<int> depots, int customer,
    119118      double alpha, double beta, double gamma, out double minCost) {
    120119      int nearest = -1;
     
    132131
    133132        double distance = GetDistance(customer + depotCount - 1, depot, problemInstance);
    134        
     133
    135134        double dueTime = 0;
    136135        if (problemInstance is ITimeWindowedProblemInstance)
     
    158157    }
    159158
    160     private static List<int> SortCustomers(IVRPProblemInstance problemInstance, List<int> customers, List<int> depots, 
    161       Dictionary<int, int> depotAssignment, 
     159    private static List<int> SortCustomers(IVRPProblemInstance problemInstance, List<int> customers, List<int> depots,
     160      Dictionary<int, int> depotAssignment,
    162161      double alpha, double beta, double gamma) {
    163162      List<int> sortedCustomers = new List<int>();
     
    168167      for (int i = 0; i < customers.Count; i++) {
    169168        double cost;
    170         int depot = GetNearestDepot(problemInstance, depots, customers[i], 
     169        int depot = GetNearestDepot(problemInstance, depots, customers[i],
    171170          alpha, beta, gamma,
    172171          out cost);
Note: See TracChangeset for help on using the changeset viewer.