Changeset 15083
- Timestamp:
- 06/28/17 22:22:12 (7 years ago)
- Location:
- trunk/sources/HeuristicLab.Problems.Scheduling/3.3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.Scheduling/3.3/Evaluators/SchedulingEvaluator.cs
r14185 r15083 26 26 using HeuristicLab.Encodings.ScheduleEncoding; 27 27 using HeuristicLab.Operators; 28 using HeuristicLab.Optimization; 28 29 using HeuristicLab.Parameters; 29 30 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; … … 32 33 [Item("SchedulingEvaluator", "First applies the decoder operator to obtain a schedule from an encoding and then applies the evaluator to obtain a quality.")] 33 34 [StorableClass] 34 public class SchedulingEvaluator : InstrumentedOperator, ISchedulingEvaluator {35 public class SchedulingEvaluator : InstrumentedOperator, ISchedulingEvaluator, IStochasticOperator { 35 36 36 37 public IValueLookupParameter<IScheduleDecoder> ScheduleDecoderParameter { … … 49 50 get { return (ILookupParameter<DoubleValue>)Parameters["Quality"]; } 50 51 } 52 // ABE: This parameter exists purely, because some IScheduleDecoders are stochastic... 53 // ... which could be solved by letting the algorithm parameterize them ... 54 // ... but they have to use the same RNG as the evaluator (due to parallel execution)... 55 // ... in particular relevant for Island-GA and ALPS (Local- vs GlobalRandom). 56 public ILookupParameter<IRandom> RandomParameter { 57 get { return (ILookupParameter<IRandom>)Parameters["Random"]; } 58 } 51 59 52 60 [StorableConstructor] … … 58 66 Parameters.Add(new ValueLookupParameter<IScheduleEvaluator>("ScheduleEvaluator", "The actual schedule evaluation operator.")); 59 67 Parameters.Add(new LookupParameter<DoubleValue>("Quality", "The quality value aka fitness value of the solution.")); 68 Parameters.Add(new LookupParameter<IRandom>("Random", "The random number generator to use.")); 60 69 QualityParameter.Hidden = true; 61 70 } … … 63 72 public override IDeepCloneable Clone(Cloner cloner) { 64 73 return new SchedulingEvaluator(this, cloner); 74 } 75 76 [StorableHook(HookType.AfterDeserialization)] 77 private void AfterDeserialization() { 78 // BackwardsCompatibility3.3 79 #region Backwards compatible code, remove with 3.4 80 if (!Parameters.ContainsKey("Random")) { 81 Parameters.Add(new LookupParameter<IRandom>("Random", "The random number generator to use.")); 82 } 83 #endregion 65 84 } 66 85 -
trunk/sources/HeuristicLab.Problems.Scheduling/3.3/JobShopSchedulingProblem.cs
r15072 r15083 173 173 #region Events 174 174 protected override void OnSolutionCreatorChanged() { 175 base.OnSolutionCreatorChanged(); 175 176 SolutionCreator.ScheduleEncodingParameter.ActualNameChanged += SolutionCreator_SchedulingEncodingParameter_ActualNameChanged; 176 177 InitializeOperators(); … … 280 281 ScheduleDecoder = null; 281 282 } 282 if (ScheduleDecoder != null) Operators.Add(ScheduleDecoder);283 283 } 284 284
Note: See TracChangeset
for help on using the changeset viewer.