- Timestamp:
- 04/22/11 10:56:48 (14 years ago)
- Location:
- branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Evaluators/AlgorithmRunsAnalyzer.cs
r6018 r6038 59 59 [StorableConstructor] 60 60 protected AlgorithmRunsAnalyzer(bool deserializing) : base(deserializing) { } 61 public AlgorithmRunsAnalyzer() : base() { 61 public AlgorithmRunsAnalyzer() 62 : base() { 62 63 Parameters.Add(new LookupParameter<IRandom>("Random", "The pseudo random number generator which should be used to initialize the new random permutation.")); 63 64 Parameters.Add(new LookupParameter<DoubleValue>("Quality", "The evaluated quality of the ParameterVector.")); … … 134 135 parameterConfiguration.AverageQualities = new DoubleArray(qualities.Select(q => q.Average()).ToArray()); 135 136 136 if (maximization)137 if (maximization) 137 138 parameterConfiguration.BestQualities = new DoubleArray(qualities.Select(q => q.Max()).ToArray()); 138 139 else 139 140 parameterConfiguration.BestQualities = new DoubleArray(qualities.Select(q => q.Min()).ToArray()); 140 141 141 142 if (maximization) 142 143 parameterConfiguration.WorstQualities = new DoubleArray(qualities.Select(q => q.Min()).ToArray()); … … 148 149 parameterConfiguration.Runs = runs; 149 150 150 this.QualityParameter.ActualValue = new DoubleValue(MetaOptimizationUtil.Normalize(parameterConfiguration, referenceQualityAverages, referenceQualityDeviations, referenceEvaluatedSolutionAverages, 1, 1, 1, maximization));151 this.QualityParameter.ActualValue = new DoubleValue(MetaOptimizationUtil.Normalize(parameterConfiguration, referenceQualityAverages, referenceQualityDeviations, referenceEvaluatedSolutionAverages, 1, 0.1, 1, maximization)); 151 152 } else { 152 153 // something terrible happened -> most probably due to invalid parameters. 153 154 // penalty with worst quality from latest generation! 154 155 double penaltyValue = results.ContainsKey("CurrentWorstQuality") ? ((DoubleValue)results["CurrentWorstQuality"]).Value : referenceQualityAverages.Max(); // todo: respect min/max 155 double penaltyValue; 156 if (maximization) 157 penaltyValue = results.ContainsKey("CurrentWorstQuality") ? ((DoubleValue)results["CurrentWorstQuality"]).Value : referenceQualityAverages.Min(); 158 else 159 penaltyValue = results.ContainsKey("CurrentWorstQuality") ? ((DoubleValue)results["CurrentWorstQuality"]).Value : referenceQualityAverages.Max(); 156 160 this.QualityParameter.ActualValue = new DoubleValue(penaltyValue); 157 161 } -
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Operators/Crossovers/DoubleValue/NormalDoubleValueCrossover.cs
r6017 r6038 1 1 using System; 2 using System.Collections.Generic;3 using System.Linq;4 using System.Text;2 using HeuristicLab.Common; 3 using HeuristicLab.Core; 4 using HeuristicLab.Data; 5 5 using HeuristicLab.Operators; 6 6 using HeuristicLab.Optimization; 7 using HeuristicLab.Parameters; 7 8 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 8 using HeuristicLab.Core;9 using HeuristicLab.Parameters;10 using HeuristicLab.Common;11 using HeuristicLab.Data;12 9 using HeuristicLab.Random; 13 10 … … 19 16 } 20 17 21 public NormalDoubleValueCrossover() : base() { 18 public NormalDoubleValueCrossover() 19 : base() { 22 20 } 23 21 [StorableConstructor] … … 35 33 36 34 public static DoubleValue ApplyStatic(IRandom random, DoubleValue better, DoubleValue worse, DoubleValueRange range) { 37 NormalDistributedRandom N = new NormalDistributedRandom(random, better.Value, Math.Abs(better.Value - worse.Value) );35 NormalDistributedRandom N = new NormalDistributedRandom(random, better.Value, Math.Abs(better.Value - worse.Value) / 3); 38 36 var offspring = new DoubleValue(); 39 37 do { -
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Operators/Crossovers/IntValue/NormalIntValueCrossover.cs
r6017 r6038 1 1 using System; 2 using System.Collections.Generic;3 using System.Linq;4 using System.Text;2 using HeuristicLab.Common; 3 using HeuristicLab.Core; 4 using HeuristicLab.Data; 5 5 using HeuristicLab.Operators; 6 6 using HeuristicLab.Optimization; 7 using HeuristicLab.Parameters; 7 8 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 8 using HeuristicLab.Core;9 using HeuristicLab.Parameters;10 using HeuristicLab.Common;11 using HeuristicLab.Data;12 9 using HeuristicLab.Random; 13 10 … … 34 31 35 32 public static IntValue ApplyStatic(IRandom random, IntValue better, IntValue worse, IntValueRange range) { 36 NormalDistributedRandom N = new NormalDistributedRandom(random, better.Value, Math.Abs(better.Value - worse.Value) );33 NormalDistributedRandom N = new NormalDistributedRandom(random, better.Value, Math.Abs(better.Value - worse.Value) / 3); 37 34 var offspring = new IntValue(); 38 35 do { -
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Operators/Manipulators/DoubleValue/NormalDoubleValueManipulator.cs
r6017 r6038 1 using System;2 using System.Collections.Generic;3 using System.Linq;4 using System.Text;1 using HeuristicLab.Common; 2 using HeuristicLab.Core; 3 using HeuristicLab.Data; 4 using HeuristicLab.Encodings.RealVectorEncoding; 5 5 using HeuristicLab.Operators; 6 6 using HeuristicLab.Optimization; 7 using HeuristicLab.Parameters; 7 8 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 8 using HeuristicLab.Core;9 using HeuristicLab.Parameters;10 using HeuristicLab.Common;11 using HeuristicLab.Encodings.RealVectorEncoding;12 using HeuristicLab.Data;13 9 14 10 namespace HeuristicLab.Problems.MetaOptimization { … … 36 32 37 33 public static void ApplyStatic(IRandom random, DoubleValue value, DoubleValueRange range) { 38 bool ok = false;39 34 var strategy = new RealVector(new double[] { (range.UpperBound.Value - range.LowerBound.Value) / 10}); // todo: add strategy parameter 40 35 var vector = new RealVector(1); 41 36 double val = value.Value; 42 37 43 while (!ok){38 do { 44 39 vector[0] = val; 45 40 NormalAllPositionsManipulator.Apply(random, vector, strategy); 46 41 value.Value = vector[0]; 47 42 value.Value = range.ApplyStepSize(value.Value); 48 ok = range.IsInRange(value.Value); 49 } 43 } while(!range.IsInRange(value.Value)); 50 44 } 51 45 } -
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Operators/Manipulators/DoubleValue/UniformDoubleValueManipulator.cs
r6017 r6038 1 using System;2 using System.Collections.Generic;3 using System.Linq;4 using System.Text;1 using HeuristicLab.Common; 2 using HeuristicLab.Core; 3 using HeuristicLab.Data; 4 using HeuristicLab.Encodings.RealVectorEncoding; 5 5 using HeuristicLab.Operators; 6 6 using HeuristicLab.Optimization; 7 using HeuristicLab.Parameters; 7 8 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 8 using HeuristicLab.Core;9 using HeuristicLab.Parameters;10 using HeuristicLab.Common;11 using HeuristicLab.Encodings.RealVectorEncoding;12 using HeuristicLab.Data;13 9 14 10 namespace HeuristicLab.Problems.MetaOptimization { … … 36 32 37 33 public static void ApplyStatic(IRandom random, DoubleValue value, DoubleValueRange range) { 38 bool ok = false;39 34 var vector = new RealVector(1); 40 35 var bounds = new DoubleMatrix(1, 2); … … 43 38 double val = value.Value; 44 39 45 while (!ok){40 do { 46 41 vector[0] = val; 47 42 UniformOnePositionManipulator.Apply(random, vector, bounds); 48 43 value.Value = vector[0]; 49 44 value.Value = range.ApplyStepSize(value.Value); 50 ok = range.IsInRange(value.Value); 51 } 45 } while (!range.IsInRange(value.Value)); 52 46 } 53 47 } -
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Operators/Manipulators/IntValue/NormalIntValueManipulator.cs
r6017 r6038 1 using System;2 using System.Collections.Generic;3 using System.Linq;4 using System.Text;1 using HeuristicLab.Common; 2 using HeuristicLab.Core; 3 using HeuristicLab.Data; 4 using HeuristicLab.Encodings.RealVectorEncoding; 5 5 using HeuristicLab.Operators; 6 6 using HeuristicLab.Optimization; 7 using HeuristicLab.Parameters; 7 8 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 8 using HeuristicLab.Core;9 using HeuristicLab.Parameters;10 using HeuristicLab.Common;11 using HeuristicLab.Encodings.IntegerVectorEncoding;12 using HeuristicLab.Data;13 using HeuristicLab.Encodings.RealVectorEncoding;14 9 15 10 namespace HeuristicLab.Problems.MetaOptimization { … … 38 33 39 34 public static void ApplyStatic(IRandom random, IntValue value, IntValueRange range) { 40 bool ok = false;41 35 var strategy = new RealVector(new double[] { (range.UpperBound.Value - range.LowerBound.Value) / 10 }); // todo: add strategy parameter 42 36 var vector = new RealVector(new double[] { value.Value }); 43 37 int val = value.Value; 44 38 45 while (!ok){39 do { 46 40 vector[0] = val; 47 41 NormalAllPositionsManipulator.Apply(random, vector, strategy); 48 42 value.Value = (int)vector[0]; 49 43 value.Value = range.ApplyStepSize(value.Value); 50 ok = range.IsInRange(value.Value); 51 } 44 } while (!range.IsInRange(value.Value)); 52 45 } 53 46 } -
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Operators/Manipulators/IntValue/UniformIntValueManipulator.cs
r6017 r6038 1 using System;2 using System.Collections.Generic;3 using System.Linq;4 using System.Text;1 using HeuristicLab.Common; 2 using HeuristicLab.Core; 3 using HeuristicLab.Data; 4 using HeuristicLab.Encodings.IntegerVectorEncoding; 5 5 using HeuristicLab.Operators; 6 6 using HeuristicLab.Optimization; 7 using HeuristicLab.Parameters; 7 8 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 8 using HeuristicLab.Core;9 using HeuristicLab.Parameters;10 using HeuristicLab.Common;11 using HeuristicLab.Encodings.IntegerVectorEncoding;12 using HeuristicLab.Data;13 9 14 10 namespace HeuristicLab.Problems.MetaOptimization { … … 37 33 38 34 public static void ApplyStatic(IRandom random, IntValue value, IntValueRange range) { 39 bool ok = false;40 35 var vector = new IntegerVector(new int[] { value.Value }); 41 36 int val = value.Value; 42 37 43 while (!ok){38 do { 44 39 vector[0] = val; 45 40 UniformOnePositionManipulator.Apply(random, vector, range.LowerBound, new IntValue(range.UpperBound.Value + 1)); 46 41 value.Value = vector[0]; 47 42 value.Value = range.ApplyStepSize(value.Value); 48 ok = range.IsInRange(value.Value); 49 } 43 } while (!range.IsInRange(value.Value)); 50 44 } 51 45 }
Note: See TracChangeset
for help on using the changeset viewer.