Free cookie consent management tool by TermsFeed Policy Generator

Changeset 14167 for trunk/sources


Ignore:
Timestamp:
07/21/16 21:07:27 (8 years ago)
Author:
gkronber
Message:

#2641:

  • fixed persistence bug
  • added unit test to create BPP sample
  • added BPP sample to start page
  • renaming of properties
Location:
trunk/sources
Files:
2 added
25 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Optimizer/3.3/HeuristicLab.Optimizer-3.3.csproj

    r13567 r14167  
    149149    <EmbeddedResource Include="Documents\ALPSGP_SymReg.hl" />
    150150    <EmbeddedResource Include="Documents\ALPSGA_TSP.hl" />
     151    <EmbeddedResource Include="Documents\TS_BPP.hl" />
    151152    <None Include="Plugin.cs.frame" />
    152153    <Compile Include="OptimizerSingleDocumentMainForm.cs">
  • trunk/sources/HeuristicLab.Optimizer/3.3/StartPage.cs

    r13228 r14167  
    135135      var standardProblems = new List<string> { "ALPSGA_TSP", "ES_Griewank", "GA_Grouping", "GA_TSP", "GA_VRP", "GE_ArtificialAnt",
    136136                "IslandGA_TSP", "LS_Knapsack", "PSO_Schwefel", "RAPGA_JSSP",
    137                 "SA_Rastrigin", "SGP_SantaFe","GP_Multiplexer", "SS_VRP", "TS_TSP", "TS_VRP", "VNS_OP", "VNS_TSP"
     137                "SA_Rastrigin", "SGP_SantaFe","GP_Multiplexer", "SS_VRP", "TS_TSP", "TS_VRP", "VNS_OP", "VNS_TSP", "TS_BPP"
    138138        };
    139139      groupLookup[standardProblemsGroup] = standardProblems;
  • trunk/sources/HeuristicLab.Problems.BinPacking.Views/3.3/PackingPlan2DView.cs

    r14162 r14167  
    5757    private void UpdateState(PackingPlan<BinPacking2D.PackingPosition, PackingShape, PackingItem> plan) {
    5858      int currentBin = (binSelection != null && binSelection.SelectedItem != null) ? (int)(binSelection.SelectedItem) : 0;
    59       container2DView.Packing = plan.BinPackings[currentBin];
     59      container2DView.Packing = plan.Bins[currentBin];
    6060    }
    6161
  • trunk/sources/HeuristicLab.Problems.BinPacking.Views/3.3/PackingPlan3DView.cs

    r14162 r14167  
    4747      } else {
    4848        int i = 0;
    49         foreach (var bp in Content.BinPackings)
     49        foreach (var bp in Content.Bins)
    5050          binSelection.Items.Add(i++ + " (" + Math.Round(bp.PackingDensity * 100, 2) + "%)");
    5151
     
    5757    private void ShowSelectedPacking() {
    5858      int currentBin = (binSelection != null) ? (int)(binSelection.SelectedIndex) : 0;
    59       packingPlan3D.Packing = Content.BinPackings[currentBin];
     59      packingPlan3D.Packing = Content.Bins[currentBin];
    6060    }
    6161
     
    6666      // add items of this container
    6767      int currentBin = (binSelection != null) ? (int)(binSelection.SelectedIndex) : 0;
    68       var packing = Content.BinPackings[currentBin];
     68      var packing = Content.Bins[currentBin];
    6969      foreach (var item in packing.Items) {
    7070        itemSelection.Items.Add(item.Key);
  • trunk/sources/HeuristicLab.Problems.BinPacking/3.3/2D/Evaluators/BinUtilizationEvaluator.cs

    r14162 r14167  
    5353
    5454      for (int i = 0; i < nrOfBins; i++) {
    55         totalUsableSpace += solution.BinPackings[i].BinShape.Volume;
    56         totalUsedSpace += solution.BinPackings[i].Items.Sum(kvp => kvp.Value.Volume);
     55        totalUsableSpace += solution.Bins[i].BinShape.Volume;
     56        totalUsedSpace += solution.Bins[i].Items.Sum(kvp => kvp.Value.Volume);
    5757      }
    5858
  • trunk/sources/HeuristicLab.Problems.BinPacking/3.3/2D/Evaluators/PackingRatioEvaluator.cs

    r14162 r14167  
    6060      const double k = 2;
    6161      for (int i = 0; i < nrOfBins; i++) {
    62         double f = solution.BinPackings[i].Items.Sum(kvp => kvp.Value.Volume);
    63         double c = solution.BinPackings[i].BinShape.Volume;
     62        double f = solution.Bins[i].Items.Sum(kvp => kvp.Value.Volume);
     63        double c = solution.Bins[i].BinShape.Volume;
    6464        result += Math.Pow(f / c, k);
    6565      }
  • trunk/sources/HeuristicLab.Problems.BinPacking/3.3/2D/IntegerVectorEncoding/BottomLeftIntegerVectorDecoder.cs

    r14162 r14167  
    5353      Solution partialSolution,
    5454      ref IList<int> remainingIDs, IList<PackingItem> items) {
    55       var bp = new BinPacking2D(partialSolution.BinMeasures);
     55      var bp = new BinPacking2D(partialSolution.BinShape);
    5656      bp.SlidingBasedPacking(ref remainingIDs, items);
    5757      return bp;
  • trunk/sources/HeuristicLab.Problems.BinPacking/3.3/2D/IntegerVectorEncoding/ExtremePointIntegerVectorDecoder.cs

    r14162 r14167  
    5353      Solution partialSolution,
    5454      ref IList<int> remainingIDs, IList<PackingItem> items) {
    55       var bp = new BinPacking2D(partialSolution.BinMeasures);
     55      var bp = new BinPacking2D(partialSolution.BinShape);
    5656      bp.ExtremePointBasedPacking(ref remainingIDs, items, stackingConstraints: false);
    5757      return bp;
  • trunk/sources/HeuristicLab.Problems.BinPacking/3.3/2D/IntegerVectorEncoding/IntegerVectorDecoderBase.cs

    r14162 r14167  
    4747      foreach (var sequence in sequenceMatrix) {
    4848        remainingIDs = remainingIDs.Concat(sequence).ToList();
    49         result.BinPackings.Add(CreatePacking(result, ref remainingIDs, items));
     49        result.Bins.Add(CreatePacking(result, ref remainingIDs, items));
    5050      }
    5151      result.UpdateBinPackings();
     
    5454      var temp = new List<int>(remainingIDs);
    5555      foreach (int id in temp) {
    56         foreach (BinPacking2D bp in result.BinPackings) {
     56        foreach (BinPacking2D bp in result.Bins) {
    5757          var position = FindPositionForItem(bp, items[id]);
    5858          if (position != null) {
     
    6666      //Put still remaining items in new bins
    6767      while (remainingIDs.Count > 0) {
    68         result.BinPackings.Add(CreatePacking(result, ref remainingIDs, items));
     68        result.Bins.Add(CreatePacking(result, ref remainingIDs, items));
    6969      }
    7070      result.UpdateBinPackings();
  • trunk/sources/HeuristicLab.Problems.BinPacking/3.3/2D/PermutationEncoding/BottomLeftPermutationDecoder.cs

    r14162 r14167  
    4747        var bp = new BinPacking2D(binShape);
    4848        bp.SlidingBasedPacking(ref remainingIDs, items);
    49         result.BinPackings.Add(bp);
     49        result.Bins.Add(bp);
    5050      }
    5151      result.UpdateBinPackings();
  • trunk/sources/HeuristicLab.Problems.BinPacking/3.3/2D/PermutationEncoding/ExtremePointPermutationDecoder.cs

    r14162 r14167  
    4747        var bp = new BinPacking2D(binShape);
    4848        bp.ExtremePointBasedPacking(ref remainingIDs, items, stackingConstraints: false);
    49         result.BinPackings.Add(bp);
     49        result.Bins.Add(bp);
    5050      }
    5151      result.UpdateBinPackings();
  • trunk/sources/HeuristicLab.Problems.BinPacking/3.3/2D/Solution.cs

    r14162 r14167  
    2929  [StorableClass]
    3030  public class Solution : PackingPlan<PackingPosition, PackingShape, PackingItem> {
    31     public Solution(PackingShape binMeasures) : this(binMeasures, false, false) { }
    32     public Solution(PackingShape binMeasures, bool useExtremePoints, bool stackingConstraints) : base(binMeasures, useExtremePoints, stackingConstraints) { }
     31    public Solution(PackingShape binShape) : this(binShape, false, false) { }
     32    public Solution(PackingShape binShape, bool useExtremePoints, bool stackingConstraints) : base(binShape, useExtremePoints, stackingConstraints) { }
    3333    [StorableConstructor]
    3434    protected Solution(bool deserializing) : base(deserializing) { }
  • trunk/sources/HeuristicLab.Problems.BinPacking/3.3/3D/Evaluators/BinUtilizationEvaluator.cs

    r14162 r14167  
    5454
    5555      for (int i = 0; i < nrOfBins; i++) {
    56         totalUsableSpace += solution.BinPackings[i].BinShape.Volume;
    57         totalUsedSpace += solution.BinPackings[i].Items.Sum(kvp => kvp.Value.Volume);
     56        totalUsableSpace += solution.Bins[i].BinShape.Volume;
     57        totalUsedSpace += solution.Bins[i].Items.Sum(kvp => kvp.Value.Volume);
    5858      }
    5959
  • trunk/sources/HeuristicLab.Problems.BinPacking/3.3/3D/Evaluators/PackingRatioEvaluator.cs

    r14162 r14167  
    6161      const double k = 2;
    6262      for (int i = 0; i < nrOfBins; i++) {
    63         double f = solution.BinPackings[i].Items.Sum(kvp => kvp.Value.Volume);
    64         double c = solution.BinPackings[i].BinShape.Volume;
     63        double f = solution.Bins[i].Items.Sum(kvp => kvp.Value.Volume);
     64        double c = solution.Bins[i].BinShape.Volume;
    6565        result += Math.Pow(f / c, k);
    6666      }
  • trunk/sources/HeuristicLab.Problems.BinPacking/3.3/3D/IntegerVectorEncoding/BottomLeftIntegerVectorDecoder.cs

    r14162 r14167  
    6060      Solution partialSolution,
    6161      ref IList<int> remainingIDs, IList<PackingItem> items, bool useStackingConstraints) {
    62       var bp = new BinPacking3D(partialSolution.BinMeasures);
     62      var bp = new BinPacking3D(partialSolution.BinShape);
    6363      bp.SlidingBasedPacking(ref remainingIDs, items);
    6464      return bp;
  • trunk/sources/HeuristicLab.Problems.BinPacking/3.3/3D/IntegerVectorEncoding/ExtremePointIntegerVectorDecoder.cs

    r14162 r14167  
    5353      Solution partialSolution,
    5454      ref IList<int> remainingIDs, IList<PackingItem> items, bool useStackingConstraints) {
    55       var bp = new BinPacking3D(partialSolution.BinMeasures);
     55      var bp = new BinPacking3D(partialSolution.BinShape);
    5656      bp.ExtremePointBasedPacking(ref remainingIDs, items, useStackingConstraints);
    5757      return bp;
  • trunk/sources/HeuristicLab.Problems.BinPacking/3.3/3D/IntegerVectorEncoding/IntegerVectorDecoderBase.cs

    r14162 r14167  
    4747      foreach (var sequence in sequenceMatrix) {
    4848        remainingIDs = remainingIDs.Concat(sequence).ToList();
    49         result.BinPackings.Add(CreatePacking(result, ref remainingIDs, items, useStackingConstraints));
     49        result.Bins.Add(CreatePacking(result, ref remainingIDs, items, useStackingConstraints));
    5050      }
    5151      result.UpdateBinPackings();
     
    5454      var temp = new List<int>(remainingIDs);
    5555      foreach (int id in temp) {
    56         foreach (BinPacking3D bp in result.BinPackings) {
     56        foreach (BinPacking3D bp in result.Bins) {
    5757          var position = FindPositionForItem(bp, items[id], useStackingConstraints);
    5858          if (position != null) {
     
    6666      //Put still remaining items in new bins
    6767      while (remainingIDs.Count > 0) {
    68         result.BinPackings.Add(CreatePacking(result, ref remainingIDs, items, useStackingConstraints));
     68        result.Bins.Add(CreatePacking(result, ref remainingIDs, items, useStackingConstraints));
    6969      }
    7070      result.UpdateBinPackings();
  • trunk/sources/HeuristicLab.Problems.BinPacking/3.3/3D/IntegerVectorEncoding/IntegerVectorProblem.cs

    r14162 r14167  
    3535  [Creatable(Category = CreatableAttribute.Categories.CombinatorialProblems, Priority = 330)]
    3636  public sealed class IntegerVectorProblem : ProblemBase<IntegerVectorEncoding, IntegerVector> {
    37     // persistence
    3837    [StorableConstructor]
    3938    private IntegerVectorProblem(bool deserializing) : base(deserializing) { }
  • trunk/sources/HeuristicLab.Problems.BinPacking/3.3/3D/PermutationEncoding/BottomLeftPermutationDecoder.cs

    r14162 r14167  
    4747        var bp = new BinPacking3D(binShape);
    4848        bp.SlidingBasedPacking(ref remainingIDs, items);
    49         result.BinPackings.Add(bp);
     49        result.Bins.Add(bp);
    5050      }
    5151      result.UpdateBinPackings();
  • trunk/sources/HeuristicLab.Problems.BinPacking/3.3/3D/PermutationEncoding/ExtremePointPermutationDecoder.cs

    r14162 r14167  
    4747        var bp = new BinPacking3D(binShape);
    4848        bp.ExtremePointBasedPacking(ref remainingIDs, items, stackingConstraints: useStackingConstraints);
    49         result.BinPackings.Add(bp);
     49        result.Bins.Add(bp);
    5050      }
    5151      result.UpdateBinPackings();
  • trunk/sources/HeuristicLab.Problems.BinPacking/3.3/3D/PermutationEncoding/PermutationProblem.cs

    r14162 r14167  
    3434  [Creatable(Category = CreatableAttribute.Categories.CombinatorialProblems, Priority = 320)]
    3535  public sealed class PermutationProblem : ProblemBase<PermutationEncoding, Permutation> {
    36     // persistence
    3736    [StorableConstructor]
    3837    private PermutationProblem(bool deserializing) : base(deserializing) { }
  • trunk/sources/HeuristicLab.Problems.BinPacking/3.3/3D/Solution.cs

    r14162 r14167  
    88  [StorableClass]
    99  public class Solution : PackingPlan<PackingPosition, PackingShape, PackingItem> {
    10     public Solution(PackingShape binMeasures) : this(binMeasures, false, false) { }
    11     public Solution(PackingShape binMeasures, bool useExtremePoints, bool stackingConstraints) : base(binMeasures, useExtremePoints, stackingConstraints) { }
     10    public Solution(PackingShape binShape) : this(binShape, false, false) { }
     11    public Solution(PackingShape binShape, bool useExtremePoints, bool stackingConstraints) : base(binShape, useExtremePoints, stackingConstraints) { }
    1212    [StorableConstructor]
    1313    protected Solution(bool deserializing) : base(deserializing) { }
  • trunk/sources/HeuristicLab.Problems.BinPacking/3.3/PackingPlan.cs

    r14162 r14167  
    3838    public int NrOfBins {
    3939      get {
    40         if (BinPackings != null)
    41           return BinPackings.Count;
     40        if (Bins != null)
     41          return Bins.Count;
    4242        else return 0;
    4343      }
     
    4949
    5050    [Storable]
    51     public B BinMeasures { get; private set; }
     51    public B BinShape { get; private set; }
    5252
    5353    [Storable]
    54     public ObservableList<BinPacking<D, B, I>> BinPackings { get; set; }
     54    public ObservableList<BinPacking<D, B, I>> Bins { get; set; }
    5555
    5656    [Storable]
     
    6969    #endregion
    7070
    71     protected PackingPlan(B binMeasures, bool useExtremePoints, bool stackingConstraints)
     71    protected PackingPlan(B binShape, bool useExtremePoints, bool stackingConstraints)
    7272      : base() {
    73       BinMeasures = (B)binMeasures.Clone();
     73      BinShape = (B)binShape.Clone();
    7474      StackingConstraints = stackingConstraints;
    7575      UseExtremePoints = useExtremePoints;
    76       BinPackings = new ObservableList<BinPacking<D, B, I>>();
     76      Bins = new ObservableList<BinPacking<D, B, I>>();
    7777    }
    7878
     
    8181    protected PackingPlan(PackingPlan<D, B, I> original, Cloner cloner)
    8282      : base(original, cloner) {
    83       this.BinPackings = new ObservableList<BinPacking<D, B, I>>(original.BinPackings.Select(p => cloner.Clone(p)));
     83      this.Bins = new ObservableList<BinPacking<D, B, I>>(original.Bins.Select(p => cloner.Clone(p)));
    8484      UseExtremePoints = original.UseExtremePoints;
    8585      StackingConstraints = original.StackingConstraints;
    86       BinMeasures = cloner.Clone(original.BinMeasures);
     86      BinShape = cloner.Clone(original.BinShape);
    8787      Quality = cloner.Clone(original.Quality);
    8888    }
     
    9090
    9191    public void UpdateBinPackings() {
    92       BinPackings.RemoveAll(x => x.Positions.Count == 0);
    93       BinPackings = new ObservableList<BinPacking<D, B, I>>(BinPackings.OrderByDescending(bp => bp.PackingDensity));
     92      Bins.RemoveAll(x => x.Positions.Count == 0);
     93      Bins = new ObservableList<BinPacking<D, B, I>>(Bins.OrderByDescending(bp => bp.PackingDensity));
    9494    }
    9595
     
    110110      OnQualityChanged();
    111111    }
    112 
    113     public event EventHandler BinPackingsChanged;
    114112    #endregion
    115113  }
  • trunk/sources/HeuristicLab.Problems.BinPacking/3.3/PackingShape.cs

    r14162 r14167  
    7878    public abstract int CompareTo(object obj);
    7979
     80    [Storable]
    8081    public IKeyedItemCollection<string, IParameter> Parameters { get; private set; }
    8182  }
  • trunk/sources/HeuristicLab.Tests/HeuristicLab.Tests.csproj

    r14121 r14167  
    270270      <SpecificVersion>False</SpecificVersion>
    271271      <HintPath>..\bin\HeuristicLab.Problems.Binary-3.3.dll</HintPath>
     272      <Private>False</Private>
     273    </Reference>
     274    <Reference Include="HeuristicLab.Problems.BinPacking-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     275      <SpecificVersion>False</SpecificVersion>
     276      <HintPath>..\bin\HeuristicLab.Problems.BinPacking-3.3.dll</HintPath>
    272277      <Private>False</Private>
    273278    </Reference>
     
    451456    <Compile Include="HeuristicLab-3.3\PluginLoader.cs" />
    452457    <Compile Include="HeuristicLab-3.3\Samples\AlpsSampleTest.cs" />
     458    <Compile Include="HeuristicLab-3.3\Samples\TabuSearch3dBinPackingSampleTest.cs" />
    453459    <Compile Include="HeuristicLab-3.3\Samples\GPRobocodeSampleTest.cs" />
    454460    <Compile Include="HeuristicLab-3.3\Samples\OSESGriewankSampleTest.cs" />
Note: See TracChangeset for help on using the changeset viewer.