Rev | Line | |
---|
[13069] | 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 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.