source: branches/HeuristicLab.Problems.BioBoost/HeuristicLab.Problems.BioBoost/3.3/Operators/Mutation/PlantScalingMutator.cs @ 13069

Last change on this file since 13069 was 13069, checked in by gkronber, 7 years ago

#2499: imported source code for HeuristicLab.BioBoost from private repository with some changes

File size: 1.0 KB
Line 
1using System.Collections.Generic;
2using HeuristicLab.BioBoost.Utils;
3using HeuristicLab.Common;
4using HeuristicLab.Encodings.RealVectorEncoding;
5using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
6
7namespace HeuristicLab.BioBoost.Operators.Mutation {
8
9  [StorableClass]
10  public class PlantScalingMutator : PlantBasedUtilizationModifier {
11
12    #region Construction & Cloning
13    [StorableConstructor]
14    public PlantScalingMutator(bool isDeserializing) {}
15    public PlantScalingMutator(PlantScalingMutator orig, Cloner cloner) : base(orig, cloner) {}
16    public PlantScalingMutator() {}
17    public override IDeepCloneable Clone(Cloner cloner) {
18      return new PlantScalingMutator(this, cloner);
19    }
20    #endregion
21
22    public override void Redistribute(RealVector utilizations, List<int> supplierIndices) {
23      var scale = Util.Sqr(Random.NextDouble() + 0.5); // 25% - 225%
24      foreach (var i in supplierIndices) {
25        utilizations[i] = EnforceBounds(utilizations[i] * scale, i);
26      }
27    }
28
29
30  }
31}
Note: See TracBrowser for help on using the repository browser.