Changeset 5303 for branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding
- Timestamp:
- 01/17/11 01:04:30 (14 years ago)
- Location:
- branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding/Manipulators/ParameterConfigurationManipulator.cs
r5277 r5303 14 14 // todo: item name/descr... 15 15 [StorableClass] 16 public class ParameterConfigurationManipulator : SingleSuccessorOperator, IParameterConfigurationManipulator, IStochasticOperator {16 public abstract class ParameterConfigurationManipulator : SingleSuccessorOperator, IParameterConfigurationManipulator, IStochasticOperator { 17 17 public override bool CanChangeName { 18 18 get { return false; } … … 44 44 : base(original, cloner) { 45 45 } 46 public override IDeepCloneable Clone(Cloner cloner) {47 return new ParameterConfigurationManipulator(this, cloner);48 }49 46 50 public sealedoverride IOperation Apply() {47 public override IOperation Apply() { 51 48 Apply(RandomParameter.ActualValue, ParameterConfigurationTreeParameter.ActualValue, IntValueManipulatorParameter.ActualValue, DoubleValueManipulatorParameter.ActualValue); 52 49 return base.Apply(); … … 57 54 } 58 55 59 pr ivatestatic void Mutate(IRandom random, IOptimizable configuration, IIntValueManipulator intValueManipulator, IDoubleValueManipulator doubleValueManipulator) {56 protected static void Mutate(IRandom random, IOptimizable configuration, IIntValueManipulator intValueManipulator, IDoubleValueManipulator doubleValueManipulator) { 60 57 var vc = configuration as IValueConfiguration; 61 58 var pc = configuration as IParameterConfiguration; -
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding/ParameterConfigurationTree.cs
r5212 r5303 213 213 return cnt; 214 214 } 215 216 public IOptimizable GetRandomOptimizable(IRandom random) { 217 List<IOptimizable> allOptimizables = GetAllOptimizables(); 218 return allOptimizables[random.Next(allOptimizables.Count)]; 219 } 215 220 } 216 221 } -
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding/ParameterConfigurations/ParameterConfiguration.cs
r5277 r5303 455 455 } 456 456 457 public List<IOptimizable> GetAllOptimizables() { 458 var list = new List<IOptimizable>(); 459 foreach (var vc in ValueConfigurations) { 460 if (vc.Optimize) { 461 list.Add(vc); 462 list.AddRange(vc.GetAllOptimizables()); 463 } 464 } 465 return list; 466 } 457 467 } 458 468 } -
branches/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization/3.3/Encoding/ValueConfigurations/ValueConfiguration.cs
r5277 r5303 269 269 } 270 270 } 271 272 public List<IOptimizable> GetAllOptimizables() { 273 var list = new List<IOptimizable>(); 274 foreach (var pc in ParameterConfigurations) { 275 if(pc.Optimize) { 276 if(pc.ValueConfigurations.CheckedItems.Count() > 1) list.Add(pc); // only add if there are more than 1 choices. otherwise it makes no sense to optimize which VC is selected 277 list.AddRange(pc.GetAllOptimizables()); 278 } 279 } 280 return list; 281 } 271 282 } 272 283 }
Note: See TracChangeset
for help on using the changeset viewer.