Changeset 8714


Ignore:
Timestamp:
10/02/12 09:27:40 (7 years ago)
Author:
svonolfe
Message:

Added support for dynamic dial a ride

Location:
branches/DynamicVehicleRouting/HeuristicLab.PDPSimulation/3.3
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • branches/DynamicVehicleRouting/HeuristicLab.PDPSimulation/3.3/HeuristicLab.PDPSimulation-3.3.csproj

    r8674 r8714  
    181181    <Compile Include="DistanceMeasures\EuclideanDistanceMeasure.cs" />
    182182    <Compile Include="DomainModel\SimulationObject.cs" />
     183    <Compile Include="Operators\DialARideEvaluator.cs" />
    183184    <Compile Include="Operators\DynPDPEvaluator.cs" />
    184185    <Compile Include="Operators\DynPushForwardInsertionCreator.cs" />
  • branches/DynamicVehicleRouting/HeuristicLab.PDPSimulation/3.3/Operators/DynPDPProblemInstance.cs

    r8670 r8714  
    212212      TardinessPenalty.Value = scenario.TardinessPenaltyParameter.Value.Value;
    213213      FleetUsageFactor.Value = scenario.FleetUsageFactorParameter.Value.Value;
     214      DistanceFactor.Value = scenario.DistanceFactorParameter.Value.Value;
    214215    }
    215216  }
  • branches/DynamicVehicleRouting/HeuristicLab.PDPSimulation/3.3/PickupDeliveryAnalyzer.cs

    r8670 r8714  
    108108        data.Rows.Add(new DataRow("InvalidActions"));
    109109        data.Rows.Add(new DataRow("Tardiness"));
     110        data.Rows.Add(new DataRow("CapacityUtilization"));
    110111
    111112        results.Add(new Result("UsedVehicles", new IntValue()));
     
    120121      double distance = Math.Round(simulation.Vehicles.Sum(v => v.Distance) * 100.0) / 100.0;
    121122      int invalidActions = simulation.Vehicles.Sum(v => v.InvalidActions);
    122       double tardiness = Math.Round(simulation.Vehicles.Sum(v => v.Tardiness) * 100.0) / 100.0;
     123      double tardiness = Math.Round(simulation.Vehicles.Sum(v => v.Tardiness) * 100.0) / 100.0;     
     124      var used = simulation.Vehicles.Where(v => v.Distance > 0);
     125      double capacityUtilization = 0;
     126      if(used.Count() > 0)
     127        capacityUtilization = Math.Round(used.Average(v => 1.0 - (v.Capacity / v.TotalCapacity)) * 100.0) / 100.0;
    123128
    124129      vehicleStatistics.Rows["UsedVehicles"].Values.Add(usedVehicles);
     
    126131      vehicleStatistics.Rows["InvalidActions"].Values.Add(invalidActions);
    127132      vehicleStatistics.Rows["Tardiness"].Values.Add(tardiness);
     133      vehicleStatistics.Rows["CapacityUtilization"].Values.Add(capacityUtilization);
    128134
    129135      (results["UsedVehicles"].Value as IntValue).Value = usedVehicles;
     
    183189    }
    184190
     191    protected virtual void UpdateTimeHistogram(PickupDeliverySimulation simulation, PickupDeliveryScenario scenario, ResultCollection results) {
     192      if (!results.ContainsKey("TimeHistogram")) {
     193        DataTable data = new DataTable("TimeHistogram");
     194        results.Add(new Result("TimeHistogram", data));
     195
     196        DataRow row = new DataRow("WaitingTime");
     197        row.VisualProperties.ChartType = DataRowVisualProperties.DataRowChartType.Histogram;
     198        data.Rows.Add(row);
     199
     200        row = new DataRow("TransferTime");
     201        row.VisualProperties.ChartType = DataRowVisualProperties.DataRowChartType.Histogram;
     202        data.Rows.Add(row);
     203
     204        row = new DataRow("Slack");
     205        row.VisualProperties.ChartType = DataRowVisualProperties.DataRowChartType.Histogram;
     206        data.Rows.Add(row);
     207
     208        row = new DataRow("LeadTime");
     209        row.VisualProperties.ChartType = DataRowVisualProperties.DataRowChartType.Histogram;
     210        data.Rows.Add(row);
     211      }
     212
     213      DataTable timeHistogram = results["TimeHistogram"].Value.Clone() as DataTable;
     214
     215      //waiting time
     216      var values = timeHistogram.Rows["WaitingTime"].Values;
     217      values.Clear();
     218      foreach (Order order in simulation.Orders.Where(o => o.PickupTime > 0)) {
     219        values.Add(order.PickupTime - order.PickupReadyTime);
     220      }
     221
     222      //transfer time
     223      values = timeHistogram.Rows["TransferTime"].Values;
     224      values.Clear();
     225      foreach (Order order in simulation.Orders.Where(o => o.OrderState == OrderState.Delivered)) {
     226        values.Add(order.DeliveryTime - order.PickupTime - order.PickupServiceTime);
     227      }
     228
     229      //slack
     230      values = timeHistogram.Rows["Slack"].Values;
     231      values.Clear();
     232      foreach (Order order in simulation.Orders.Where(o => o.PickupTime > 0)) {
     233        values.Add(order.PickupDueTime - order.PickupTime);
     234      }
     235
     236      //lead time
     237      values = timeHistogram.Rows["LeadTime"].Values;
     238      values.Clear();
     239      foreach (Order order in simulation.Orders.Where(o => o.OrderState == OrderState.Delivered)) {
     240        values.Add(order.DeliveryTime + order.DeliveryServiceTime - order.PickupReadyTime);
     241      }
     242
     243      results["TimeHistogram"].Value = timeHistogram;
     244    }
     245
    185246    public virtual void Analyze(PickupDeliverySimulation simulation, PickupDeliveryScenario scenario, ResultCollection results) {
    186247      UpdateOrderResults(simulation, scenario, results);
     
    188249      UpdateConstraintViolationResults(simulation, scenario, results);
    189250      UpdateVehicleHistoryResults(simulation, scenario, results);
     251      UpdateTimeHistogram(simulation, scenario, results);
    190252    }
    191253
  • branches/DynamicVehicleRouting/HeuristicLab.PDPSimulation/3.3/PickupDeliveryScenario.cs

    r8670 r8714  
    7373    }
    7474
     75    public IValueParameter<DoubleValue> DistanceFactorParameter {
     76      get { return (IValueParameter<DoubleValue>)Parameters["DistanceFactor"]; }
     77    }
     78
    7579    public IValueParameter<DoubleValue> FleetUsageFactorParameter {
    7680      get { return (IValueParameter<DoubleValue>)Parameters["FleetUsageFactor"]; }
     
    142146      Parameters.Add(new ValueParameter<DoubleArray>("VehicleReadyTimes", new DoubleArray()));
    143147      Parameters.Add(new ValueParameter<DoubleArray>("VehicleDueTimes", new DoubleArray()));
     148      Parameters.Add(new ValueParameter<DoubleValue>("DistanceFactor", "The distance factor considered in the evaluation.", new DoubleValue(1)));
    144149      Parameters.Add(new ValueParameter<DoubleValue>("FleetUsageFactor", "The fleet usage factor considered in the evaluation.", new DoubleValue(3000)));
    145150      Parameters.Add(new ValueParameter<DoubleValue>("OverloadPenalty", "The overload penalty considered in the evaluation.", new DoubleValue(10000)));
Note: See TracChangeset for help on using the changeset viewer.