Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/11/14 15:05:55 (11 years ago)
Author:
abeham
Message:

#2146: merged r10407,r10465,r10466,r10474,r10503,r10504,r10646 into stable

Location:
stable
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.Problems.VehicleRouting

  • stable/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/General/Crossovers/BiasedMultiVRPSolutionCrossover.cs

    r10507 r10743  
    3030using HeuristicLab.Parameters;
    3131using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     32using HeuristicLab.Random;
    3233
    3334namespace HeuristicLab.Problems.VehicleRouting.Encodings.General {
     
    140141      if (checkedOperators.Count() > 0) {
    141142        // select a random operator from the checked operators
    142         double sum = (from indexedItem in checkedOperators select probabilities[indexedItem.Index]).Sum();
    143         if (sum == 0) throw new InvalidOperationException(Name + ": All selected operators have zero probability.");
    144         double r = random.NextDouble() * sum;
    145         sum = 0;
    146         foreach (var indexedItem in checkedOperators) {
    147           sum += probabilities[indexedItem.Index];
    148           if (sum > r) {
    149             successor = indexedItem.Value;
    150             break;
    151           }
    152         }
     143        successor = checkedOperators.SampleProportional(random, 1, probabilities, false, false).First().Value;
    153144      }
    154145
  • stable/HeuristicLab.Problems.VehicleRouting/3.4/Encodings/General/Manipulators/BiasedMultiVRPSolutionManipulator.cs

    r10507 r10743  
    3030using HeuristicLab.Parameters;
    3131using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     32using HeuristicLab.Random;
    3233
    3334namespace HeuristicLab.Problems.VehicleRouting.Encodings.General {
     
    140141      if (checkedOperators.Count() > 0) {
    141142        // select a random operator from the checked operators
    142         double sum = (from indexedItem in checkedOperators select probabilities[indexedItem.Index]).Sum();
    143         if (sum == 0) throw new InvalidOperationException(Name + ": All selected operators have zero probability.");
    144         double r = random.NextDouble() * sum;
    145         sum = 0;
    146         foreach (var indexedItem in checkedOperators) {
    147           sum += probabilities[indexedItem.Index];
    148           if (sum > r) {
    149             successor = indexedItem.Value;
    150             break;
    151           }
    152         }
     143        successor =
     144          checkedOperators.SampleProportional(random, 1, probabilities, false, false).First().Value;
    153145      }
    154146
  • stable/HeuristicLab.Problems.VehicleRouting/3.4/HeuristicLab.Problems.VehicleRouting-3.4.csproj

    r8894 r10743  
    465465      <Private>False</Private>
    466466    </ProjectReference>
     467    <ProjectReference Include="..\..\HeuristicLab.Random\3.3\HeuristicLab.Random-3.3.csproj">
     468      <Project>{F4539FB6-4708-40C9-BE64-0A1390AEA197}</Project>
     469      <Name>HeuristicLab.Random-3.3</Name>
     470    </ProjectReference>
    467471  </ItemGroup>
    468472  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  • stable/HeuristicLab.Problems.VehicleRouting/3.4/Plugin.cs.frame

    r10032 r10743  
    4141  [PluginDependency("HeuristicLab.Persistence", "3.3")]
    4242  [PluginDependency("HeuristicLab.Problems.Instances", "3.3")]
     43  [PluginDependency("HeuristicLab.Random", "3.3")]
    4344  public class HeuristicLabProblemsVehicleRoutingPlugin : PluginBase {
    4445  }
Note: See TracChangeset for help on using the changeset viewer.