Changeset 11484 for branches/ProgrammableProblem/HeuristicLab.Problems.Programmable/3.3/Operators/MultiObjectiveAnalyzer.cs
- Timestamp:
- 10/21/14 18:49:05 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ProgrammableProblem/HeuristicLab.Problems.Programmable/3.3/Operators/MultiObjectiveAnalyzer.cs
r11400 r11484 11 11 12 12 namespace HeuristicLab.Problems.Programmable { 13 [Item("Multi-objective Analyzer", "Calls the script's Analyze method to be able to write into the results collection.")]13 [Item("Multi-objective Analyzer", "Calls the Analyze method of the problem definition.")] 14 14 [StorableClass] 15 15 public class MultiObjectiveAnalyzer : SingleSuccessorOperator, IMultiObjectiveProgrammableProblemAnalyzer { 16 16 public bool EnabledByDefault { get { return true; } } 17 17 18 public ILookupParameter<IMultiObjectiveProblemDefinition Host> ProblemDefinitionParameter {19 get { return (ILookupParameter<IMultiObjectiveProblemDefinition Host>)Parameters["ProblemDefinition"]; }18 public ILookupParameter<IMultiObjectiveProblemDefinition> ProblemDefinitionParameter { 19 get { return (ILookupParameter<IMultiObjectiveProblemDefinition>)Parameters["ProblemDefinition"]; } 20 20 } 21 21 22 public ILookupParameter< Configuration> ConfigurationParameter {23 get { return (ILookupParameter< Configuration>)Parameters["Configuration"]; }22 public ILookupParameter<Encoding> EncodingParameter { 23 get { return (ILookupParameter<Encoding>)Parameters["Encoding"]; } 24 24 } 25 25 … … 37 37 public MultiObjectiveAnalyzer() { 38 38 Parameters.Add(new LookupParameter<IRandom>("Random", "The random number generator to use.")); 39 Parameters.Add(new LookupParameter<IMultiObjectiveProblemDefinition Host>("ProblemDefinition", "The host that holds the problem definition."));40 Parameters.Add(new LookupParameter< Configuration>("Configuration", "An item that holds the problem's configuration."));39 Parameters.Add(new LookupParameter<IMultiObjectiveProblemDefinition>("ProblemDefinition", "The host that holds the problem definition.")); 40 Parameters.Add(new LookupParameter<Encoding>("Encoding", "An item that holds the problem's encoding.")); 41 41 Parameters.Add(new ScopeTreeLookupParameter<DoubleArray>("Qualities", "The qualities of the parameter vector.")); 42 42 Parameters.Add(new LookupParameter<ResultCollection>("Results", "The results collection to write to.")); … … 48 48 49 49 public override IOperation Apply() { 50 var host= ProblemDefinitionParameter.ActualValue;51 if ( host.Instance == null) throw new InvalidOperationException("Script instance is null, maybe the code doesn't compile.");52 var config = ConfigurationParameter.ActualValue;50 var definition = ProblemDefinitionParameter.ActualValue; 51 if (definition == null) throw new InvalidOperationException("Problem definition is null."); 52 var config = EncodingParameter.ActualValue; 53 53 var results = ResultsParameter.ActualValue; 54 54 … … 58 58 59 59 var vectors = scopes.Select(scope => Helper.Extract(scope, config)).ToArray(); 60 host.Instance.Analyze(vectors, QualitiesParameter.ActualValue.Select(x => x.ToArray()).ToArray(), results);60 definition.Analyze(vectors, QualitiesParameter.ActualValue.Select(x => x.ToArray()).ToArray(), results); 61 61 return base.Apply(); 62 62 }
Note: See TracChangeset
for help on using the changeset viewer.