Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/19/10 11:12:40 (13 years ago)
Author:
svonolfe
Message:

Implemented review comments (#1236)

Location:
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3
Files:
3 edited

Legend:

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

    r4722 r4847  
    116116      DoubleArray serviceTimeArray, DoubleArray readyTimeArray, DoubleArray demandArray, DoubleValue capacity,
    117117      DoubleValue fleetUsageFactor, DoubleValue timeFactor, DoubleValue distanceFactor, DoubleValue overloadPenalty, DoubleValue tardinessPenalty,
    118       DoubleMatrix coordinates, ILookupParameter<DoubleMatrix> distanceMatrix, BoolValue useDistanceMatrix) {
     118      DoubleMatrix coordinates, IParameter distanceMatrix, BoolValue useDistanceMatrix) {
    119119      TourEvaluation eval = new TourEvaluation();
    120120
     
    190190      DoubleArray serviceTimeArray, DoubleArray readyTimeArray, DoubleArray demandArray, DoubleValue capacity,
    191191      DoubleValue fleetUsageFactor, DoubleValue timeFactor, DoubleValue distanceFactor, DoubleValue overloadPenalty, DoubleValue tardinessPenalty,
    192       DoubleMatrix coordinates, ILookupParameter<DoubleMatrix> distanceMatrix, BoolValue useDistanceMatrix) {
     192      DoubleMatrix coordinates, IParameter distanceMatrix, BoolValue useDistanceMatrix) {
    193193      TourEvaluation sumEval = new TourEvaluation();
    194194      sumEval.Distance = 0;
     
    199199      sumEval.Tardiness = 0;
    200200
    201       foreach (Tour tour in solution.GetTours(distanceMatrix)) {
     201      foreach (Tour tour in solution.GetTours(distanceMatrix as ILookupParameter<DoubleMatrix>)) {
    202202        TourEvaluation eval = EvaluateTour(tour, dueTimeArray, serviceTimeArray, readyTimeArray, demandArray, capacity,
    203203          fleetUsageFactor, timeFactor, distanceFactor, overloadPenalty, tardinessPenalty,
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/VRPUtilities.cs

    r4722 r4847  
    5757
    5858      if (useDistanceMatrix.Value) {
    59         if (distanceMatrix is IValueLookupParameter<DoubleMatrix>) {
    60           if ((distanceMatrix as IValueLookupParameter<DoubleMatrix>).Value == null) {
    61             (distanceMatrix as IValueLookupParameter<DoubleMatrix>).Value = CreateDistanceMatrix(coordinates);
     59        if (distanceMatrix is IValueParameter<DoubleMatrix>) {
     60          if ((distanceMatrix as IValueParameter<DoubleMatrix>).Value == null) {
     61            (distanceMatrix as IValueParameter<DoubleMatrix>).Value = CreateDistanceMatrix(coordinates);
    6262          }
    6363         
    64           distance = (distanceMatrix as IValueLookupParameter<DoubleMatrix>).Value[start, end];
     64          distance = (distanceMatrix as IValueParameter<DoubleMatrix>).Value[start, end];
    6565        } else {
    6666          if (distanceMatrix.ActualValue == null) {
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/VehicleRoutingProblem.cs

    r4722 r4847  
    620620      this.Name = parser.ProblemName;
    621621
     622      BestKnownSolution = null;
    622623      Coordinates = new DoubleMatrix(parser.Coordinates);
    623624      Vehicles.Value = parser.Vehicles;
     
    636637
    637638      this.Name = parser.Name;
    638 
    639639      int problemSize = parser.Demands.Length;
    640640
     641      BestKnownSolution = null;
    641642      Coordinates = new DoubleMatrix(parser.Vertices);
    642643      if (parser.Vehicles != -1)
     
    661662
    662663      if (parser.Depot != 1)
    663         throw new Exception("Invalid depot specification");
     664        ErrorHandling.ShowErrorDialog(new Exception("Invalid depot specification"));
    664665
    665666      if (parser.WeightType != TSPLIBParser.TSPLIBEdgeWeightType.EUC_2D)
    666         throw new Exception("Invalid weight type");
     667        ErrorHandling.ShowErrorDialog(new Exception("Invalid weight type"));
    667668
    668669      OnReset();
     
    672673      if (BestKnownSolution != null) {
    673674        //call evaluator
    674         IValueLookupParameter<DoubleMatrix> distMatrix = new ValueLookupParameter<DoubleMatrix>("DistMatrix",
     675        IValueParameter<DoubleMatrix> distMatrix = new ValueParameter<DoubleMatrix>("DistMatrix",
    675676          DistanceMatrix);
    676677
     
    716717
    717718      if (cities != Coordinates.Rows - 1)
    718         throw new Exception("Invalid solution");
    719 
    720       BestKnownSolutionParameter.Value = encoding;
     719        ErrorHandling.ShowErrorDialog(new Exception("Invalid solution"));
     720      else
     721        BestKnownSolutionParameter.Value = encoding;
    721722    }
    722723
     
    728729      int problemSize = parser.Demands.Length;
    729730
     731      BestKnownSolution = null;
    730732      Coordinates = new DoubleMatrix(parser.Vertices);
    731733      Vehicles.Value = problemSize - 1;
Note: See TracChangeset for help on using the changeset viewer.