Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/04/20 07:06:39 (4 years ago)
Author:
abeham
Message:

#2521: working on VRP

Location:
branches/2521_ProblemRefactoring/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • branches/2521_ProblemRefactoring/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Creators/PushForwardInsertionCreator.cs

    r17698 r17712  
    2222using System;
    2323using System.Collections.Generic;
     24using HEAL.Attic;
    2425using HeuristicLab.Common;
    2526using HeuristicLab.Core;
     
    2728using HeuristicLab.Optimization;
    2829using HeuristicLab.Parameters;
    29 using HEAL.Attic;
    3030using HeuristicLab.Problems.VehicleRouting.Interfaces;
    3131using HeuristicLab.Problems.VehicleRouting.ProblemInstances;
     
    299299            } else {
    300300              double cost = tourCost;
    301               bool feasible = problemInstance.Feasible(eval);
    302               if (cost < minimumCost && feasible) {
     301              if (cost < minimumCost && eval.IsFeasible) {
    303302                customer = unrouted;
    304303                minimumCost = cost;
  • branches/2521_ProblemRefactoring/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Crossovers/PotvinCrossover.cs

    r17698 r17712  
    2121
    2222using System.Collections.Generic;
     23using HEAL.Attic;
    2324using HeuristicLab.Common;
    2425using HeuristicLab.Core;
     
    2627using HeuristicLab.Optimization;
    2728using HeuristicLab.Parameters;
    28 using HEAL.Attic;
    2929using HeuristicLab.Problems.VehicleRouting.Encodings.General;
    3030using HeuristicLab.Problems.VehicleRouting.Interfaces;
     
    134134        solution.Tours.Remove(tour);
    135135      }
    136 
    137       if (newTour.Stops.Count > 0 && !allowInfeasible && !instance.TourFeasible(newTour, solution))
     136      var tourEval = instance.EvaluateTour(newTour, solution);
     137      if (newTour.Stops.Count > 0 && !allowInfeasible && !tourEval.IsFeasible)
    138138        return false;
    139139
  • branches/2521_ProblemRefactoring/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Crossovers/PotvinInsertionBasedCrossover.cs

    r17698 r17712  
    2020#endregion
    2121
     22using System;
     23using System.Collections.Generic;
     24using HEAL.Attic;
    2225using HeuristicLab.Common;
    2326using HeuristicLab.Core;
    24 using HEAL.Attic;
    25 using System.Collections.Generic;
    2627using HeuristicLab.Data;
    27 using System;
    2828using HeuristicLab.Parameters;
     29using HeuristicLab.Problems.VehicleRouting.Interfaces;
    2930using HeuristicLab.Problems.VehicleRouting.ProblemInstances;
    30 using HeuristicLab.Problems.VehicleRouting.Interfaces;
    3131
    3232namespace HeuristicLab.Problems.VehicleRouting.Encodings.Potvin {
     
    165165      double minDetour = 0;
    166166      VRPEvaluation eval = ProblemInstance.EvaluateTour(tour, individual);
    167       bool originalFeasible = ProblemInstance.Feasible(eval);
    168167
    169168      for (int i = 0; i <= tour.Stops.Count; i++) {
  • branches/2521_ProblemRefactoring/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Manipulators/PotvinLocalSearchManipulator.cs

    r17698 r17712  
    2121
    2222using System.Collections.Generic;
     23using HEAL.Attic;
    2324using HeuristicLab.Common;
    2425using HeuristicLab.Core;
    2526using HeuristicLab.Data;
    2627using HeuristicLab.Parameters;
    27 using HEAL.Attic;
    2828using HeuristicLab.Problems.VehicleRouting.Interfaces;
    2929
     
    7070          distance = individual.GetTourLength(individual.Tours[currentTour]);
    7171          individual.Tours[currentTour].Stops.InsertRange(currentCity, toBeDeleted);
    72           if (instance.TourFeasible(individual.Tours[currentTour], individual)) {
     72          var tourEval = instance.EvaluateTour(individual.Tours[currentTour], individual);
     73          if (tourEval.IsFeasible) {
    7374            double lengthIncrease =
    7475              individual.GetTourLength(individual.Tours[currentTour]) - distance;
     
    9495    public static void ApplyManipulation(IRandom random, PotvinEncodedSolution individual, IVRPProblemInstance instance, int maxIterations) {
    9596      //only apply to feasible individuals
    96       if (instance.Feasible(individual)) {
     97      var eval = instance.Evaluate(individual);
     98      if (eval.IsFeasible) {
    9799        bool insertionFound;
    98100        int iterations = 0;
  • branches/2521_ProblemRefactoring/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Manipulators/PotvinPairwiseOneLevelExchangeManipulator.cs

    r17698 r17712  
    2020#endregion
    2121
     22using HEAL.Attic;
    2223using HeuristicLab.Common;
    2324using HeuristicLab.Core;
    24 using HEAL.Attic;
     25using HeuristicLab.Problems.VehicleRouting.Interfaces;
    2526using HeuristicLab.Problems.VehicleRouting.ProblemInstances;
    2627using HeuristicLab.Problems.VehicleRouting.Variants;
    27 using HeuristicLab.Problems.VehicleRouting.Interfaces;
    2828
    2929namespace HeuristicLab.Problems.VehicleRouting.Encodings.Potvin {
     
    8888
    8989            if (delta < bestQuality &&
    90                (instance.Feasible(evalNew) || allowInfeasible)) {
     90               (evalNew.IsFeasible || allowInfeasible)) {
    9191              bestQuality = delta;
    9292              bestTour = tourIdx;
  • branches/2521_ProblemRefactoring/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Manipulators/PotvinPairwiseTwoLevelExchangeManipulator.cs

    r17698 r17712  
    2020#endregion
    2121
     22using HEAL.Attic;
    2223using HeuristicLab.Common;
    2324using HeuristicLab.Core;
    2425using HeuristicLab.Encodings.PermutationEncoding;
    25 using HEAL.Attic;
     26using HeuristicLab.Problems.VehicleRouting.Interfaces;
    2627using HeuristicLab.Problems.VehicleRouting.ProblemInstances;
    2728using HeuristicLab.Problems.VehicleRouting.Variants;
    28 using HeuristicLab.Problems.VehicleRouting.Interfaces;
    2929
    3030namespace HeuristicLab.Problems.VehicleRouting.Encodings.Potvin {
     
    7777
    7878      replacedSourceTour.Stops[replacedSourceTour.Stops.IndexOf(replacedSource)] = replacingSource;
    79       if (!allowInfeasible && !instance.TourFeasible(replacedSourceTour, individual))
     79      var evalSourceTour = instance.EvaluateTour(replacedSourceTour, individual);
     80      if (!allowInfeasible && !evalSourceTour.IsFeasible)
    8081        return null;
    8182
     83      var evalTargetTour = instance.EvaluateTour(replacedTargetTour, individual);
    8284      replacedTargetTour.Stops[replacedTargetTour.Stops.IndexOf(replacedTarget)] = replacingTarget;
    83       if (!allowInfeasible && !instance.TourFeasible(replacedTargetTour, individual))
     85      if (!allowInfeasible && !evalTargetTour.IsFeasible)
    8486        return null;
    8587
     
    101103
    102104          if (delta < bestQuality &&
    103               (instance.Feasible(evalNew) || allowInfeasible)) {
     105              (evalNew.IsFeasible || allowInfeasible)) {
    104106            bestQuality = delta;
    105107            bestTour = tourIdx;
  • branches/2521_ProblemRefactoring/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/Manipulators/PotvinTwoLevelExchangeManipulator.cs

    r17698 r17712  
    2020#endregion
    2121
     22using HEAL.Attic;
    2223using HeuristicLab.Common;
    2324using HeuristicLab.Core;
    24 using HEAL.Attic;
    2525using HeuristicLab.Problems.VehicleRouting.Interfaces;
    2626
     
    6262                route1.Stops.RemoveAt(customer1Position);
    6363
    64                 if (instance.TourFeasible(tour, individual)) {
     64                var tourEval = instance.EvaluateTour(tour, individual);
     65                if (tourEval.IsFeasible) {
    6566                  int routeIdx, place;
    6667                  if (FindInsertionPlace(individual,
  • branches/2521_ProblemRefactoring/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/Potvin/PotvinEncodedSolution.cs

    r17698 r17712  
    219219
    220220      VRPEvaluation eval = ProblemInstance.Evaluate(this);
    221       bool originalFeasible = ProblemInstance.Feasible(eval);
    222221
    223222      for (int tour = 0; tour < Tours.Count; tour++) {
Note: See TracChangeset for help on using the changeset viewer.