- Timestamp:
- 02/04/15 00:03:14 (10 years ago)
- Location:
- branches/ProgrammableProblem/HeuristicLab.Problems.Programmable/3.3/Operators
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ProgrammableProblem/HeuristicLab.Problems.Programmable/3.3/Operators/MultiObjectiveAnalyzer.cs
r11739 r11880 13 13 [Item("Multi-objective Analyzer", "Calls the Analyze method of the problem definition.")] 14 14 [StorableClass] 15 public class MultiObjectiveAnalyzer : SingleSuccessorOperator, IMultiObjectiveAnalysisOperator {15 public class MultiObjectiveAnalyzer : SingleSuccessorOperator, IMultiObjectiveAnalysisOperator, IStochasticOperator { 16 16 public bool EnabledByDefault { get { return true; } } 17 17 … … 28 28 } 29 29 30 public Action<Individual[], double[][], ResultCollection> AnalyzeAction { get; set; } 30 public ILookupParameter<IRandom> RandomParameter { 31 get { return (ILookupParameter<IRandom>)Parameters["Random"]; } 32 } 33 34 public Action<Individual[], double[][], ResultCollection, IRandom> AnalyzeAction { get; set; } 31 35 32 36 [StorableConstructor] … … 47 51 var encoding = EncodingParameter.ActualValue; 48 52 var results = ResultsParameter.ActualValue; 53 var random = RandomParameter.ActualValue; 49 54 50 55 IEnumerable<IScope> scopes = new[] { ExecutionContext.Scope }; … … 53 58 54 59 var individuals = scopes.Select(encoding.GetIndividual).ToArray(); 55 AnalyzeAction(individuals, QualitiesParameter.ActualValue.Select(x => x.ToArray()).ToArray(), results );60 AnalyzeAction(individuals, QualitiesParameter.ActualValue.Select(x => x.ToArray()).ToArray(), results, random); 56 61 return base.Apply(); 57 62 } -
branches/ProgrammableProblem/HeuristicLab.Problems.Programmable/3.3/Operators/SingleObjectiveAnalyzer.cs
r11739 r11880 13 13 [Item("Single-objective Analyzer", "Calls the script's Analyze method to be able to write into the results collection.")] 14 14 [StorableClass] 15 public sealed class SingleObjectiveAnalyzer : SingleSuccessorOperator, ISingleObjectiveAnalysisOperator, IAnalyzer {15 public sealed class SingleObjectiveAnalyzer : SingleSuccessorOperator, ISingleObjectiveAnalysisOperator, IAnalyzer, IStochasticOperator { 16 16 public bool EnabledByDefault { get { return true; } } 17 17 … … 28 28 } 29 29 30 public Action<Individual[], double[], ResultCollection> AnalyzeAction { get; set; } 30 public ILookupParameter<IRandom> RandomParameter { 31 get { return (ILookupParameter<IRandom>)Parameters["Random"]; } 32 } 33 34 public Action<Individual[], double[], ResultCollection, IRandom> AnalyzeAction { get; set; } 31 35 32 36 [StorableConstructor] … … 37 41 Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Quality", "The quality of the parameter vector.")); 38 42 Parameters.Add(new LookupParameter<ResultCollection>("Results", "The results collection to write to.")); 43 Parameters.Add(new LookupParameter<IRandom>("Random", "The random number generator to use.")); 39 44 } 40 45 … … 46 51 var encoding = EncodingParameter.ActualValue; 47 52 var results = ResultsParameter.ActualValue; 53 var random = RandomParameter.ActualValue; 48 54 49 55 IEnumerable<IScope> scopes = new[] { ExecutionContext.Scope }; … … 52 58 53 59 var individuals = scopes.Select(encoding.GetIndividual).ToArray(); 54 AnalyzeAction(individuals, QualityParameter.ActualValue.Select(x => x.Value).ToArray(), results );60 AnalyzeAction(individuals, QualityParameter.ActualValue.Select(x => x.Value).ToArray(), results, random); 55 61 return base.Apply(); 56 62 } -
branches/ProgrammableProblem/HeuristicLab.Problems.Programmable/3.3/Operators/SingleObjectiveImprover.cs
r11739 r11880 34 34 [Item("Single-objective Improver", "Improves a solution by calling GetNeighbors and Evaluate of the corresponding problem definition.")] 35 35 [StorableClass] 36 public sealed class SingleObjectiveImprover : SingleSuccessorOperator, INeighborBasedOperator, I SingleObjectiveEvaluationOperator, IStochasticOperator {36 public sealed class SingleObjectiveImprover : SingleSuccessorOperator, INeighborBasedOperator, IImprovementOperator, ISingleObjectiveEvaluationOperator, IStochasticOperator { 37 37 public ILookupParameter<IRandom> RandomParameter { 38 38 get { return (ILookupParameter<IRandom>)Parameters["Random"]; }
Note: See TracChangeset
for help on using the changeset viewer.