Last change
on this file was
16996,
checked in by gkronber, 5 years ago
|
#2520 Update plugin dependencies and references for HL.MetaOptimization for new persistence
|
File size:
1.3 KB
|
Rev | Line | |
---|
[16996] | 1 | using HeuristicLab.Operators;
|
---|
[6017] | 2 | using HeuristicLab.Optimization;
|
---|
| 3 | using HeuristicLab.Core;
|
---|
| 4 | using HeuristicLab.Parameters;
|
---|
| 5 | using HeuristicLab.Common;
|
---|
| 6 | using HeuristicLab.Data;
|
---|
[16574] | 7 | using HEAL.Attic;
|
---|
[6017] | 8 |
|
---|
| 9 | namespace HeuristicLab.Problems.MetaOptimization {
|
---|
[16574] | 10 | [StorableType("FF6DCDF5-434C-4D47-8D67-5BD52BAB2D01")]
|
---|
[6017] | 11 | public class AverageIntValueCrossover : SingleSuccessorOperator, IIntValueCrossover, IStochasticOperator {
|
---|
| 12 | public ILookupParameter<IRandom> RandomParameter {
|
---|
| 13 | get { return (LookupParameter<IRandom>)Parameters["Random"]; }
|
---|
| 14 | }
|
---|
| 15 |
|
---|
| 16 | public AverageIntValueCrossover() { }
|
---|
| 17 | [StorableConstructor]
|
---|
[16574] | 18 | protected AverageIntValueCrossover(StorableConstructorFlag _) : base(_) { }
|
---|
[6017] | 19 | protected AverageIntValueCrossover(AverageIntValueCrossover original, Cloner cloner)
|
---|
| 20 | : base(original, cloner) {
|
---|
| 21 | }
|
---|
| 22 | public override IDeepCloneable Clone(Cloner cloner) {
|
---|
| 23 | return new AverageIntValueCrossover(this, cloner);
|
---|
| 24 | }
|
---|
| 25 |
|
---|
| 26 | public void Apply(IRandom random, IntValue value, IntValue other, IntValueRange range) {
|
---|
| 27 | ApplyStatic(random, value, other, range);
|
---|
| 28 | }
|
---|
| 29 |
|
---|
| 30 | public static void ApplyStatic(IRandom random, IntValue value, IntValue other, IntValueRange range) {
|
---|
| 31 | value.Value = (value.Value + other.Value) / 2;
|
---|
| 32 | }
|
---|
| 33 | }
|
---|
| 34 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.