Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/24/20 00:58:42 (4 years ago)
Author:
abeham
Message:

#2521: working on VRP (WIP)

Location:
branches/2521_ProblemRefactoring/HeuristicLab.Problems.VehicleRouting/3.4/Analyzer/BestSolution
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/2521_ProblemRefactoring/HeuristicLab.Problems.VehicleRouting/3.4/Analyzer/BestSolution/BestVRPSolutionAnalyzer.cs

    r17226 r17698  
    4242      get { return (ILookupParameter<IVRPProblemInstance>)Parameters["ProblemInstance"]; }
    4343    }
    44     public ScopeTreeLookupParameter<IVRPEncoding> VRPToursParameter {
    45       get { return (ScopeTreeLookupParameter<IVRPEncoding>)Parameters["VRPTours"]; }
     44    public ScopeTreeLookupParameter<IVRPEncodedSolution> VRPToursParameter {
     45      get { return (ScopeTreeLookupParameter<IVRPEncodedSolution>)Parameters["VRPTours"]; }
    4646    }
    4747
     
    8383      : base() {
    8484      Parameters.Add(new LookupParameter<IVRPProblemInstance>("ProblemInstance", "The problem instance."));
    85       Parameters.Add(new ScopeTreeLookupParameter<IVRPEncoding>("VRPTours", "The VRP tours which should be evaluated."));
     85      Parameters.Add(new ScopeTreeLookupParameter<IVRPEncodedSolution>("VRPTours", "The VRP tours which should be evaluated."));
    8686
    8787      Parameters.Add(new LookupParameter<DoubleValue>("BestKnownQuality", "The quality of the best known solution of this VRP instance."));
     
    119119    public override IOperation Apply() {
    120120      IVRPProblemInstance problemInstance = ProblemInstanceParameter.ActualValue;
    121       ItemArray<IVRPEncoding> solutions = VRPToursParameter.ActualValue;
     121      ItemArray<IVRPEncodedSolution> solutions = VRPToursParameter.ActualValue;
    122122      ResultCollection results = ResultsParameter.ActualValue;
    123123
     
    127127
    128128      int i = qualities.Select((x, index) => new { index, x.Value }).OrderBy(x => x.Value).First().index;
    129       IVRPEncoding best = solutions[i].Clone() as IVRPEncoding;
     129      IVRPEncodedSolution best = solutions[i].Clone() as IVRPEncodedSolution;
    130130      VRPSolution solution = BestSolutionParameter.ActualValue;
    131131      if (solution == null) {
    132         solution = new VRPSolution(problemInstance, best.Clone() as IVRPEncoding, new DoubleValue(qualities[i].Value));
     132        solution = new VRPSolution(problemInstance, best.Clone() as IVRPEncodedSolution, new DoubleValue(qualities[i].Value));
    133133        BestSolutionParameter.ActualValue = solution;
    134134        results.Add(new Result("Best VRP Solution", solution));
     
    140140        if (qualities[i].Value <= eval.Quality) {
    141141          solution.ProblemInstance = problemInstance;
    142           solution.Solution = best.Clone() as IVRPEncoding;
     142          solution.Solution = best.Clone() as IVRPEncodedSolution;
    143143          solution.Quality.Value = qualities[i].Value;
    144144          (results["Best VRP Solution Distance"].Value as DoubleValue).Value = distances[i].Value;
     
    150150      if (idx != null) {
    151151        int j = idx.index;
    152         IVRPEncoding bestFeasible = solutions[j].Clone() as IVRPEncoding;
     152        IVRPEncodedSolution bestFeasible = solutions[j].Clone() as IVRPEncodedSolution;
    153153        VRPSolution validSolution = BestValidSolutionParameter.ActualValue;
    154154        if (validSolution == null) {
    155           validSolution = new VRPSolution(problemInstance, best.Clone() as IVRPEncoding, new DoubleValue(qualities[j].Value));
     155          validSolution = new VRPSolution(problemInstance, best.Clone() as IVRPEncodedSolution, new DoubleValue(qualities[j].Value));
    156156          BestValidSolutionParameter.ActualValue = validSolution;
    157157          if (results.ContainsKey("Best valid VRP Solution"))
     
    166166            if (ProblemInstanceParameter.ActualValue.Feasible(best)) {
    167167              validSolution.ProblemInstance = problemInstance;
    168               validSolution.Solution = best.Clone() as IVRPEncoding;
     168              validSolution.Solution = best.Clone() as IVRPEncodedSolution;
    169169              validSolution.Quality.Value = qualities[j].Value;
    170170              (results["Best valid VRP Solution Distance"].Value as DoubleValue).Value = distances[j].Value;
  • branches/2521_ProblemRefactoring/HeuristicLab.Problems.VehicleRouting/3.4/Analyzer/BestSolution/Capacitated/BestCapacitatedVRPSolutionAnalyzer.cs

    r17226 r17698  
    4242      get { return (ILookupParameter<IVRPProblemInstance>)Parameters["ProblemInstance"]; }
    4343    }
    44     public ScopeTreeLookupParameter<IVRPEncoding> VRPToursParameter {
    45       get { return (ScopeTreeLookupParameter<IVRPEncoding>)Parameters["VRPTours"]; }
     44    public ScopeTreeLookupParameter<IVRPEncodedSolution> VRPToursParameter {
     45      get { return (ScopeTreeLookupParameter<IVRPEncodedSolution>)Parameters["VRPTours"]; }
    4646    }
    4747    public ScopeTreeLookupParameter<DoubleValue> QualityParameter {
     
    7070      : base() {
    7171      Parameters.Add(new LookupParameter<IVRPProblemInstance>("ProblemInstance", "The problem instance."));
    72       Parameters.Add(new ScopeTreeLookupParameter<IVRPEncoding>("VRPTours", "The VRP tours which should be evaluated."));
     72      Parameters.Add(new ScopeTreeLookupParameter<IVRPEncodedSolution>("VRPTours", "The VRP tours which should be evaluated."));
    7373      Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Quality", "The qualities of the VRP solutions which should be analyzed."));
    7474
     
    8989    public override IOperation Apply() {
    9090      IVRPProblemInstance problemInstance = ProblemInstanceParameter.ActualValue;
    91       ItemArray<IVRPEncoding> solutions = VRPToursParameter.ActualValue;
     91      ItemArray<IVRPEncodedSolution> solutions = VRPToursParameter.ActualValue;
    9292      ResultCollection results = ResultsParameter.ActualValue;
    9393
  • branches/2521_ProblemRefactoring/HeuristicLab.Problems.VehicleRouting/3.4/Analyzer/BestSolution/PickupAndDelivery/BestPickupAndDeliveryVRPSolutionAnalyzer.cs

    r17226 r17698  
    4242      get { return (ILookupParameter<IVRPProblemInstance>)Parameters["ProblemInstance"]; }
    4343    }
    44     public ScopeTreeLookupParameter<IVRPEncoding> VRPToursParameter {
    45       get { return (ScopeTreeLookupParameter<IVRPEncoding>)Parameters["VRPTours"]; }
     44    public ScopeTreeLookupParameter<IVRPEncodedSolution> VRPToursParameter {
     45      get { return (ScopeTreeLookupParameter<IVRPEncodedSolution>)Parameters["VRPTours"]; }
    4646    }
    4747    public ScopeTreeLookupParameter<DoubleValue> QualityParameter {
     
    7070      : base() {
    7171      Parameters.Add(new LookupParameter<IVRPProblemInstance>("ProblemInstance", "The problem instance."));
    72       Parameters.Add(new ScopeTreeLookupParameter<IVRPEncoding>("VRPTours", "The VRP tours which should be evaluated."));
     72      Parameters.Add(new ScopeTreeLookupParameter<IVRPEncodedSolution>("VRPTours", "The VRP tours which should be evaluated."));
    7373      Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Quality", "The qualities of the VRP solutions which should be analyzed."));
    7474
     
    8989    public override IOperation Apply() {
    9090      IVRPProblemInstance problemInstance = ProblemInstanceParameter.ActualValue;
    91       ItemArray<IVRPEncoding> solutions = VRPToursParameter.ActualValue;
     91      ItemArray<IVRPEncodedSolution> solutions = VRPToursParameter.ActualValue;
    9292      ResultCollection results = ResultsParameter.ActualValue;
    9393
     
    9797      int i = qualities.Select((x, index) => new { index, x.Value }).OrderBy(x => x.Value).First().index;
    9898
    99       IVRPEncoding best = solutions[i] as IVRPEncoding;
     99      IVRPEncodedSolution best = solutions[i] as IVRPEncodedSolution;
    100100      VRPSolution solution = BestSolutionParameter.ActualValue;
    101101      if (solution != null) {
  • branches/2521_ProblemRefactoring/HeuristicLab.Problems.VehicleRouting/3.4/Analyzer/BestSolution/TimeWindowed/BestTimeWindowedVRPSolutionAnalyzer.cs

    r17226 r17698  
    4242      get { return (ILookupParameter<IVRPProblemInstance>)Parameters["ProblemInstance"]; }
    4343    }
    44     public ScopeTreeLookupParameter<IVRPEncoding> VRPToursParameter {
    45       get { return (ScopeTreeLookupParameter<IVRPEncoding>)Parameters["VRPTours"]; }
     44    public ScopeTreeLookupParameter<IVRPEncodedSolution> VRPToursParameter {
     45      get { return (ScopeTreeLookupParameter<IVRPEncodedSolution>)Parameters["VRPTours"]; }
    4646    }
    4747    public ScopeTreeLookupParameter<DoubleValue> QualityParameter {
     
    7373      : base() {
    7474      Parameters.Add(new LookupParameter<IVRPProblemInstance>("ProblemInstance", "The problem instance."));
    75       Parameters.Add(new ScopeTreeLookupParameter<IVRPEncoding>("VRPTours", "The VRP tours which should be evaluated."));
     75      Parameters.Add(new ScopeTreeLookupParameter<IVRPEncodedSolution>("VRPTours", "The VRP tours which should be evaluated."));
    7676      Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Quality", "The qualities of the VRP solutions which should be analyzed."));
    7777
     
    9393    public override IOperation Apply() {
    9494      IVRPProblemInstance problemInstance = ProblemInstanceParameter.ActualValue;
    95       ItemArray<IVRPEncoding> solutions = VRPToursParameter.ActualValue;
     95      ItemArray<IVRPEncodedSolution> solutions = VRPToursParameter.ActualValue;
    9696      ResultCollection results = ResultsParameter.ActualValue;
    9797
Note: See TracChangeset for help on using the changeset viewer.