Line | |
---|
1 | using System.Collections.Generic;
|
---|
2 | using HeuristicLab.BioBoost.Utils;
|
---|
3 | using HeuristicLab.Common;
|
---|
4 | using HeuristicLab.Encodings.RealVectorEncoding;
|
---|
5 | using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
|
---|
6 |
|
---|
7 | namespace 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.