source: branches/HeuristicLab.Problems.BioBoost/HeuristicLab.Problems.BioBoost/3.3/Operators/Mutation/PlantSupplierRandomizer.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 PlantSupplierRandomizer : PlantBasedUtilizationModifier {
11
12    #region Construction & Cloning
13    [StorableConstructor]
14    public PlantSupplierRandomizer(bool isDeserializing) {}
15    public PlantSupplierRandomizer(PlantSupplierRandomizer orig, Cloner cloner) : base(orig, cloner) {}
16    public PlantSupplierRandomizer() {}
17    public override IDeepCloneable Clone(Cloner cloner) {
18      return new PlantSupplierRandomizer(this, cloner);
19    }
20    #endregion
21
22    public override void Redistribute(RealVector utilizations, List<int> supplierIndices) {
23      foreach (var i in supplierIndices) {
24        utilizations[i] = EnforceBounds(utilizations[i] * Util.Sqr(Random.NextDouble() + 0.5), i);
25      }
26    }
27
28
29  }
30}
Note: See TracBrowser for help on using the repository browser.