Free cookie consent management tool by TermsFeed Policy Generator

Changeset 3947 for trunk


Ignore:
Timestamp:
06/25/10 15:01:48 (15 years ago)
Author:
svonolfe
Message:

Fixed some problems in the VRP implementation (#1039)

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

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/AlbaMoveOperator.cs

    r3938 r3947  
    4343
    4444      PermutationMoveOperatorParameter.PermutationParameter.ActualName = VRPSolutionParameter.ActualName;
    45       IAtomicOperation op = this.ExecutionContext.CreateOperation(PermutationMoveOperatorParameter);
     45      IAtomicOperation op = this.ExecutionContext.CreateChildOperation(PermutationMoveOperatorParameter);
    4646      op.Operator.Execute((IExecutionContext)op);
    4747
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/ThreeOpt/AlbaTranslocationMoveEvaluator.cs

    r3938 r3947  
    5454        newSolution,
    5555        DueTimeParameter.ActualValue, ServiceTimeParameter.ActualValue, ReadyTimeParameter.ActualValue,
    56         DemandParameter.ActualValue, CapacityParameter.ActualValue, 
    57         FleetUsageFactor.Value, TimeFactor.Value, DistanceFactor.Value, OverloadPenalty.Value, TardinessPenalty.Value,
     56        DemandParameter.ActualValue, CapacityParameter.ActualValue,
     57        FleetUsageFactor.ActualValue, TimeFactor.ActualValue, DistanceFactor.ActualValue, OverloadPenalty.ActualValue, TardinessPenalty.ActualValue,
    5858        CoordinatesParameter.ActualValue, DistanceMatrixParameter, UseDistanceMatrixParameter.ActualValue);
    5959    }
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/ThreeOpt/AlbaTranslocationMoveGenerator.cs

    r3938 r3947  
    2929using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    3030using HeuristicLab.Parameters;
     31using HeuristicLab.Data;
    3132
    3233namespace HeuristicLab.Problems.VehicleRouting.Encodings.Alba {
    3334  [Item("AlbaTranslocationMoveGenerator", "An operator which generates translocation moves for the alba representation.")]
    3435  [StorableClass]
    35   public sealed class AlbaTranslocationMoveGenerator : AlbaMoveOperator, IPermutationTranslocationMoveOperator, IMoveGenerator {
     36  public sealed class AlbaTranslocationMoveGenerator : AlbaMoveOperator, IPermutationTranslocationMoveOperator, IMultiMoveGenerator {
    3637    public IValueLookupParameter<TranslocationMoveGenerator> TranslocationMoveGeneratorParameter {
    3738      get { return (IValueLookupParameter<TranslocationMoveGenerator>)Parameters["TranslocationMoveGenerator"]; }
     
    4041    protected override IPermutationMoveOperator PermutationMoveOperatorParameter {
    4142      get { return TranslocationMoveGeneratorParameter.Value; }
    42       set { TranslocationMoveGeneratorParameter.Value = value as TranslocationMoveGenerator; }
     43      set {
     44        TranslocationMoveGeneratorParameter.Value = value as TranslocationMoveGenerator;
     45        if (TranslocationMoveGeneratorParameter.Value is IMultiMoveGenerator) {
     46          ((IMultiMoveGenerator)TranslocationMoveGeneratorParameter.Value).SampleSizeParameter.ActualName = SampleSizeParameter.Name;
     47        }
     48      }
    4349    }
    4450
     
    6167    }
    6268
     69    public IValueLookupParameter<IntValue> SampleSizeParameter {
     70      get { return (IValueLookupParameter<IntValue>)Parameters["SampleSize"]; }
     71    }
     72
    6373    public AlbaTranslocationMoveGenerator(): base() {
    6474      Parameters.Add(new ValueLookupParameter<TranslocationMoveGenerator>("TranslocationMoveGenerator", "The move generator.",
    6575        new StochasticTranslocationMultiMoveGenerator()));
     76      Parameters.Add(new ValueLookupParameter<IntValue>("SampleSize", "The number of moves to generate."));
     77
     78      ((IMultiMoveGenerator)TranslocationMoveGeneratorParameter.Value).SampleSizeParameter.ActualName = SampleSizeParameter.Name;
    6679    }
    6780
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Evaluators/VRPEvaluator.cs

    r3938 r3947  
    8484      get { return (ILookupParameter<DoubleValue>)Parameters["Capacity"]; }
    8585    }
    86     /*public ILookupParameter<DoubleValue> MaxTravelTimeParameter {
    87       get { return (ILookupParameter<DoubleValue>)Parameters["MaxTravelTime"]; }
    88     } */
    8986    public ILookupParameter<DoubleArray> DemandParameter {
    9087      get { return (ILookupParameter<DoubleArray>)Parameters["Demand"]; }
     
    9996      get { return (ILookupParameter<DoubleArray>)Parameters["ServiceTime"]; }
    10097    }
    101     public IValueParameter<DoubleValue> FleetUsageFactor {
    102       get { return (IValueParameter<DoubleValue>)Parameters["FleetUsageFactor"]; }
    103     }
    104     public IValueParameter<DoubleValue> TimeFactor {
    105       get { return (IValueParameter<DoubleValue>)Parameters["TimeFactor"]; }
    106     }
    107     public IValueParameter<DoubleValue> DistanceFactor {
    108       get { return (IValueParameter<DoubleValue>)Parameters["DistanceFactor"]; }
    109     }
    110     /*public IValueParameter<DoubleValue> TimePenalty {
    111       get { return (IValueParameter<DoubleValue>)Parameters["TimePenalty"]; }
    112     } */
    113     public IValueParameter<DoubleValue> OverloadPenalty {
    114       get { return (IValueParameter<DoubleValue>)Parameters["OverloadPenalty"]; }
    115     }
    116     public IValueParameter<DoubleValue> TardinessPenalty {
    117       get { return (IValueParameter<DoubleValue>)Parameters["TardinessPenalty"]; }
     98    public ILookupParameter<DoubleValue> FleetUsageFactor {
     99      get { return (ILookupParameter<DoubleValue>)Parameters["FleetUsageFactor"]; }
     100    }
     101    public ILookupParameter<DoubleValue> TimeFactor {
     102      get { return (ILookupParameter<DoubleValue>)Parameters["TimeFactor"]; }
     103    }
     104    public ILookupParameter<DoubleValue> DistanceFactor {
     105      get { return (ILookupParameter<DoubleValue>)Parameters["DistanceFactor"]; }
     106    }
     107    public ILookupParameter<DoubleValue> OverloadPenalty {
     108      get { return (ILookupParameter<DoubleValue>)Parameters["OverloadPenalty"]; }
     109    }
     110    public ILookupParameter<DoubleValue> TardinessPenalty {
     111      get { return (ILookupParameter<DoubleValue>)Parameters["TardinessPenalty"]; }
    118112    }
    119113
     
    132126      Parameters.Add(new LookupParameter<IntValue>("Vehicles", "The number of vehicles."));
    133127      Parameters.Add(new LookupParameter<DoubleValue>("Capacity", "The capacity of each vehicle."));
    134       //Parameters.Add(new LookupParameter<DoubleValue>("MaxTravelTime", "The maximum travel time of each route."));
    135128      Parameters.Add(new LookupParameter<DoubleArray>("Demand", "The demand of each customer."));
    136129      Parameters.Add(new LookupParameter<DoubleArray>("ReadyTime", "The ready time of each customer."));
    137130      Parameters.Add(new LookupParameter<DoubleArray>("DueTime", "The due time of each customer."));
    138131      Parameters.Add(new LookupParameter<DoubleArray>("ServiceTime", "The service time of each customer."));
    139       Parameters.Add(new ValueParameter<DoubleValue>("FleetUsageFactor", "The fleet usage factor considered in the evaluation.", new DoubleValue(0)));
    140       Parameters.Add(new ValueParameter<DoubleValue>("TimeFactor", "The time factor considered in the evaluation.", new DoubleValue(0)));
    141       Parameters.Add(new ValueParameter<DoubleValue>("DistanceFactor", "The distance factor considered in the evaluation.", new DoubleValue(1)));
    142       //Parameters.Add(new ValueParameter<DoubleValue>("TimePenalty", "The time penalty considered in the evaluation.", new DoubleValue(10)));
    143       Parameters.Add(new ValueParameter<DoubleValue>("OverloadPenalty", "The overload penalty considered in the evaluation.", new DoubleValue(50)));
    144       Parameters.Add(new ValueParameter<DoubleValue>("TardinessPenalty", "The tardiness penalty considered in the evaluation.", new DoubleValue(50)));
     132      Parameters.Add(new LookupParameter<DoubleValue>("FleetUsageFactor", "The fleet usage factor considered in the evaluation."));
     133      Parameters.Add(new LookupParameter<DoubleValue>("TimeFactor", "The time factor considered in the evaluation."));
     134      Parameters.Add(new LookupParameter<DoubleValue>("DistanceFactor", "The distance factor considered in the evaluation."));
     135      Parameters.Add(new LookupParameter<DoubleValue>("OverloadPenalty", "The overload penalty considered in the evaluation."));
     136      Parameters.Add(new LookupParameter<DoubleValue>("TardinessPenalty", "The tardiness penalty considered in the evaluation."));
    145137    }
    146138
     
    289281      }
    290282
    291       if (sumEval.Quality < sumEval.Distance) {
    292       }
    293 
    294283      return sumEval;
    295284    }
     
    299288
    300289      TourEvaluation sumEval = Evaluate(solution, DueTimeParameter.ActualValue, ServiceTimeParameter.ActualValue, ReadyTimeParameter.ActualValue,
    301         DemandParameter.ActualValue, CapacityParameter.ActualValue, 
    302         FleetUsageFactor.Value, TimeFactor.Value, DistanceFactor.Value, OverloadPenalty.Value, TardinessPenalty.Value,
     290        DemandParameter.ActualValue, CapacityParameter.ActualValue,
     291        FleetUsageFactor.ActualValue, TimeFactor.ActualValue, DistanceFactor.ActualValue, OverloadPenalty.ActualValue, TardinessPenalty.ActualValue,
    303292        CoordinatesParameter.ActualValue, DistanceMatrixParameter, UseDistanceMatrixParameter.ActualValue);
    304293
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Interfaces/IVRPEvaluator.cs

    r3938 r3947  
    4646    ILookupParameter<DoubleValue> OverloadParameter { get; }
    4747    ILookupParameter<DoubleValue> TardinessParameter { get; }
     48
     49    ILookupParameter<DoubleValue> FleetUsageFactor { get; }
     50    ILookupParameter<DoubleValue> TimeFactor { get; }
     51    ILookupParameter<DoubleValue> DistanceFactor { get; }
     52    ILookupParameter<DoubleValue> OverloadPenalty { get; }
     53    ILookupParameter<DoubleValue> TardinessPenalty { get; }
    4854  }
    4955}
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/Interfaces/IVRPMoveEvaluator.cs

    r3938 r3947  
    4545    ILookupParameter<DoubleValue> MoveOverloadParameter { get; }
    4646    ILookupParameter<DoubleValue> MoveTardinessParameter { get; }
     47
     48    ILookupParameter<DoubleValue> FleetUsageFactor { get; }
     49    ILookupParameter<DoubleValue> TimeFactor { get; }
     50    ILookupParameter<DoubleValue> DistanceFactor { get; }
     51    ILookupParameter<DoubleValue> OverloadPenalty { get; }
     52    ILookupParameter<DoubleValue> TardinessPenalty { get; }
    4753  }
    4854}
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/MoveEvaluators/VRPMoveEvaluator.cs

    r3938 r3947  
    6969      get { return (ILookupParameter<DoubleArray>)Parameters["ServiceTime"]; }
    7070    }
    71     public IValueParameter<DoubleValue> FleetUsageFactor {
    72       get { return (IValueParameter<DoubleValue>)Parameters["FleetUsageFactor"]; }
     71    public ILookupParameter<DoubleValue> FleetUsageFactor {
     72      get { return (ILookupParameter<DoubleValue>)Parameters["FleetUsageFactor"]; }
    7373    }
    74     public IValueParameter<DoubleValue> TimeFactor {
    75       get { return (IValueParameter<DoubleValue>)Parameters["TimeFactor"]; }
     74    public ILookupParameter<DoubleValue> TimeFactor {
     75      get { return (ILookupParameter<DoubleValue>)Parameters["TimeFactor"]; }
    7676    }
    77     public IValueParameter<DoubleValue> DistanceFactor {
    78       get { return (IValueParameter<DoubleValue>)Parameters["DistanceFactor"]; }
     77    public ILookupParameter<DoubleValue> DistanceFactor {
     78      get { return (ILookupParameter<DoubleValue>)Parameters["DistanceFactor"]; }
    7979    }
    80     public IValueParameter<DoubleValue> OverloadPenalty {
    81       get { return (IValueParameter<DoubleValue>)Parameters["OverloadPenalty"]; }
     80    public ILookupParameter<DoubleValue> OverloadPenalty {
     81      get { return (ILookupParameter<DoubleValue>)Parameters["OverloadPenalty"]; }
    8282    }
    83     public IValueParameter<DoubleValue> TardinessPenalty {
    84       get { return (IValueParameter<DoubleValue>)Parameters["TardinessPenalty"]; }
     83    public ILookupParameter<DoubleValue> TardinessPenalty {
     84      get { return (ILookupParameter<DoubleValue>)Parameters["TardinessPenalty"]; }
    8585    }
    8686
     
    126126      Parameters.Add(new LookupParameter<DoubleArray>("DueTime", "The due time of each customer."));
    127127      Parameters.Add(new LookupParameter<DoubleArray>("ServiceTime", "The service time of each customer."));
    128       Parameters.Add(new ValueParameter<DoubleValue>("FleetUsageFactor", "The fleet usage factor considered in the evaluation.", new DoubleValue(0)));
    129       Parameters.Add(new ValueParameter<DoubleValue>("TimeFactor", "The time factor considered in the evaluation.", new DoubleValue(0)));
    130       Parameters.Add(new ValueParameter<DoubleValue>("DistanceFactor", "The distance factor considered in the evaluation.", new DoubleValue(1)));
    131       Parameters.Add(new ValueParameter<DoubleValue>("OverloadPenalty", "The overload penalty considered in the evaluation.", new DoubleValue(50)));
    132       Parameters.Add(new ValueParameter<DoubleValue>("TardinessPenalty", "The tardiness penalty considered in the evaluation.", new DoubleValue(50)));
     128      Parameters.Add(new LookupParameter<DoubleValue>("FleetUsageFactor", "The fleet usage factor considered in the evaluation."));
     129      Parameters.Add(new LookupParameter<DoubleValue>("TimeFactor", "The time factor considered in the evaluation."));
     130      Parameters.Add(new LookupParameter<DoubleValue>("DistanceFactor", "The distance factor considered in the evaluation."));
     131      Parameters.Add(new LookupParameter<DoubleValue>("OverloadPenalty", "The overload penalty considered in the evaluation."));
     132      Parameters.Add(new LookupParameter<DoubleValue>("TardinessPenalty", "The tardiness penalty considered in the evaluation."));
    133133    }
    134134
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/SolomonParser.cs

    r3938 r3947  
    145145        readyTime.Add((double)int.Parse(m[4].Value));
    146146        double st = (double)int.Parse(m[6].Value);
    147         dueTime.Add(st + (double)int.Parse(m[5].Value));
     147        dueTime.Add((double)int.Parse(m[5].Value));
    148148        serviceTime.Add(st);
    149149        line = reader.ReadLine();
  • trunk/sources/HeuristicLab.Problems.VehicleRouting/3.3/VehicleRoutingProblem.cs

    r3938 r3947  
    9090      get { return EvaluatorParameter; }
    9191    }
     92    public IValueParameter<DoubleValue> FleetUsageFactor {
     93      get { return (IValueParameter<DoubleValue>)Parameters["FleetUsageFactor"]; }
     94    }
     95    public IValueParameter<DoubleValue> TimeFactor {
     96      get { return (IValueParameter<DoubleValue>)Parameters["TimeFactor"]; }
     97    }
     98    public IValueParameter<DoubleValue> DistanceFactor {
     99      get { return (IValueParameter<DoubleValue>)Parameters["DistanceFactor"]; }
     100    }
     101    public IValueParameter<DoubleValue> OverloadPenalty {
     102      get { return (IValueParameter<DoubleValue>)Parameters["OverloadPenalty"]; }
     103    }
     104    public IValueParameter<DoubleValue> TardinessPenalty {
     105      get { return (IValueParameter<DoubleValue>)Parameters["TardinessPenalty"]; }
     106    }
    92107    public OptionalValueParameter<DoubleValue> BestKnownQualityParameter {
    93108      get { return (OptionalValueParameter<DoubleValue>)Parameters["BestKnownQuality"]; }
     
    181196      Parameters.Add(new ValueParameter<DoubleArray>("ServiceTime", "The service time of each customer.", new DoubleArray()));
    182197      Parameters.Add(new OptionalValueParameter<DoubleValue>("BestKnownQuality", "The quality of the best known solution of this VRP instance."));
     198      Parameters.Add(new ValueParameter<DoubleValue>("FleetUsageFactor", "The fleet usage factor considered in the evaluation.", new DoubleValue(100)));
     199      Parameters.Add(new ValueParameter<DoubleValue>("TimeFactor", "The time factor considered in the evaluation.", new DoubleValue(0)));
     200      Parameters.Add(new ValueParameter<DoubleValue>("DistanceFactor", "The distance factor considered in the evaluation.", new DoubleValue(1)));
     201      Parameters.Add(new ValueParameter<DoubleValue>("OverloadPenalty", "The overload penalty considered in the evaluation.", new DoubleValue(100)));
     202      Parameters.Add(new ValueParameter<DoubleValue>("TardinessPenalty", "The tardiness penalty considered in the evaluation.", new DoubleValue(100)));
    183203
    184204      Parameters.Add(new ValueParameter<IVRPCreator>("SolutionCreator", "The operator which should be used to create new VRP solutions.", creator));
     
    343363      Evaluator.DueTimeParameter.ActualName = DueTimeParameter.Name;
    344364      Evaluator.ServiceTimeParameter.ActualName = ServiceTimeParameter.Name;
     365      Evaluator.FleetUsageFactor.ActualName = FleetUsageFactor.Name;
     366      Evaluator.TimeFactor.ActualName = TimeFactor.Name;
     367      Evaluator.DistanceFactor.ActualName = DistanceFactor.Name;
     368      Evaluator.OverloadPenalty.ActualName = OverloadPenalty.Name;
     369      Evaluator.TardinessPenalty.ActualName = TardinessPenalty.Name;
    345370    }
    346371    private void ParameterizeAnalyzer() {
     
    369394        op.DueTimeParameter.ActualName = DueTimeParameter.Name;
    370395        op.ServiceTimeParameter.ActualName = ServiceTimeParameter.Name;
     396        op.FleetUsageFactor.ActualName = FleetUsageFactor.Name;
     397        op.TimeFactor.ActualName = TimeFactor.Name;
     398        op.DistanceFactor.ActualName = DistanceFactor.Name;
     399        op.OverloadPenalty.ActualName = OverloadPenalty.Name;
     400        op.TardinessPenalty.ActualName = TardinessPenalty.Name;
    371401      }
    372402      string translocationMove = Operators.OfType<IMoveGenerator>().OfType<IPermutationTranslocationMoveOperator>().First().TranslocationMoveParameter.ActualName;
Note: See TracChangeset for help on using the changeset viewer.