Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/19/10 14:26:38 (13 years ago)
Author:
svonolfe
Message:

partly reverted r4851 (#1236)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/VehicleRoutingProblem.cs

    r4851 r4852  
    114114      get { return BestKnownQualityParameter; }
    115115    }
    116     public OptionalValueParameter<VRPSolution> BestKnownSolutionParameter {
    117       get { return (OptionalValueParameter<VRPSolution>)Parameters["BestKnownSolution"]; }
     116    public OptionalValueParameter<IVRPEncoding> BestKnownSolutionParameter {
     117      get { return (OptionalValueParameter<IVRPEncoding>)Parameters["BestKnownSolution"]; }
    118118    }
    119119    #endregion
     
    160160      set { BestKnownQualityParameter.Value = value; }
    161161    }
    162     public VRPSolution BestKnownSolution {
     162    public IVRPEncoding BestKnownSolution {
    163163      get { return BestKnownSolutionParameter.Value; }
    164164      set { BestKnownSolutionParameter.Value = value; }
     
    219219      Parameters.Add(new ValueParameter<DoubleArray>("ServiceTime", "The service time of each customer.", new DoubleArray()));
    220220      Parameters.Add(new OptionalValueParameter<DoubleValue>("BestKnownQuality", "The quality of the best known solution of this VRP instance."));
    221       Parameters.Add(new OptionalValueParameter<VRPSolution>("BestKnownSolution", "The best known solution of this VRP instance."));
     221      Parameters.Add(new OptionalValueParameter<IVRPEncoding>("BestKnownSolution", "The best known solution of this TSP instance."));
    222222      Parameters.Add(new ValueParameter<DoubleValue>("EvalFleetUsageFactor", "The fleet usage factor considered in the evaluation.", new DoubleValue(100)));
    223223      Parameters.Add(new ValueParameter<DoubleValue>("EvalTimeFactor", "The time factor considered in the evaluation.", new DoubleValue(0)));
     
    440440      #region Backwards Compatibility
    441441      if (!Parameters.ContainsKey("BestKnownSolution")) {
    442         Parameters.Add(new OptionalValueParameter<VRPSolution>("BestKnownSolution", "The best known solution of this TSP instance."));
     442        Parameters.Add(new OptionalValueParameter<IVRPEncoding>("BestKnownSolution", "The best known solution of this TSP instance."));
    443443      }
    444444      #endregion
     
    673673      if (BestKnownSolution != null) {
    674674        //call evaluator
    675         IValueLookupParameter<DoubleMatrix> distMatrix = new ValueLookupParameter<DoubleMatrix>("DistMatrix",
     675        IValueParameter<DoubleMatrix> distMatrix = new ValueLookupParameter<DoubleMatrix>("DistMatrix",
    676676          DistanceMatrix);
    677677
    678678        TourEvaluation eval = VRPEvaluator.Evaluate(
    679           BestKnownSolution.Solution,
     679          BestKnownSolution,
    680680          Vehicles,
    681681          DueTime,
     
    695695        DistanceMatrix = distMatrix.Value;
    696696
    697         BestKnownSolution.DistanceMatrix = DistanceMatrix;
    698         BestKnownSolution.Distance = new DoubleValue(eval.Distance);
    699         BestKnownSolution.Overload = new DoubleValue(eval.Overload);
    700         BestKnownSolution.Quality = new DoubleValue(eval.Quality);
    701         BestKnownSolution.Tardiness = new DoubleValue(eval.Tardiness);
    702         BestKnownSolution.TravelTime = new DoubleValue(eval.TravelTime);
    703         BestKnownSolution.VehicleUtilization = new DoubleValue(eval.VehcilesUtilized);
    704 
    705697        BestKnownQuality = new DoubleValue(eval.Quality);
    706698      } else {
     
    725717
    726718      if (cities != Coordinates.Rows - 1)
    727         ErrorHandling.ShowErrorDialog(new Exception("The optimal solution does not seem to correspond  with the problem data."));
    728       else {
    729         VRPSolution solution = new VRPSolution();
    730         solution.Solution = encoding;
    731         solution.Coordinates = Coordinates;
    732         solution.DistanceMatrix = DistanceMatrix;
    733         solution.ReadyTime = ReadyTime;
    734         solution.DueTime = DueTime;
    735         solution.ServiceTime = ServiceTime;
    736         solution.UseDistanceMatrix = UseDistanceMatrix;
    737 
    738         BestKnownSolutionParameter.Value = solution;
    739       }
     719        ErrorHandling.ShowErrorDialog(new Exception("Invalid solution"));
     720      else
     721        BestKnownSolutionParameter.Value = encoding;
    740722    }
    741723
Note: See TracChangeset for help on using the changeset viewer.