Changeset 11618
- Timestamp:
- 12/02/14 11:34:19 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Analysis/3.3/BestScopeSolutionAnalyzer.cs
r11615 r11618 38 38 [StorableClass] 39 39 public class BestScopeSolutionAnalyzer : SingleSuccessorOperator, IAnalyzer { 40 private const string BestSolutionResultName = "Best Solution";41 40 42 41 public virtual bool EnabledByDefault { … … 49 48 get { return (ScopeTreeLookupParameter<DoubleValue>)Parameters["Quality"]; } 50 49 } 50 public IFixedValueParameter<StringValue> BestSolutionResultNameParameter { 51 get { return (IFixedValueParameter<StringValue>)Parameters["BestSolution ResultName"]; } 52 } 51 53 public ILookupParameter<DoubleValue> BestKnownQualityParameter { 52 54 get { return (ILookupParameter<DoubleValue>)Parameters["BestKnownQuality"]; } … … 54 56 public IValueLookupParameter<ResultCollection> ResultsParameter { 55 57 get { return (IValueLookupParameter<ResultCollection>)Parameters["Results"]; } 58 } 59 60 public string BestSolutionResultName { 61 get { return BestSolutionResultNameParameter.Value.Value; } 62 set { BestSolutionResultNameParameter.Value.Value = value; } 56 63 } 57 64 … … 63 70 return new BestScopeSolutionAnalyzer(this, cloner); 64 71 } 72 73 [StorableHook(HookType.AfterDeserialization)] 74 private void AfterDeserialization() { 75 if (!Parameters.ContainsKey("BestSolution ResultName")) 76 Parameters.Add(new FixedValueParameter<StringValue>("BestSolution ResultName", "The name of the result for storing the best solution.", new StringValue("Best Solution"))); 77 } 65 78 #endregion 66 79 public BestScopeSolutionAnalyzer() … … 68 81 Parameters.Add(new LookupParameter<BoolValue>("Maximization", "True if the problem is a maximization problem.")); 69 82 Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Quality", "The qualities of the solutions.")); 83 Parameters.Add(new FixedValueParameter<StringValue>("BestSolution ResultName", "The name of the result for storing the best solution.", new StringValue("Best Solution"))); 70 84 Parameters.Add(new LookupParameter<DoubleValue>("BestKnownQuality", "The quality of the best known solution.")); 71 85 Parameters.Add(new ValueLookupParameter<ResultCollection>("Results", "The result collection where the solution should be stored.")); … … 79 93 80 94 if (results.ContainsKey(BestSolutionResultName) && !typeof(IScope).IsAssignableFrom(results[BestSolutionResultName].DataType)) { 81 throw new InvalidOperationException(string.Format("Could not add best solution result, because there is already a result with the name \"{0}\" present in the result collec dtion.", BestSolutionResultName));95 throw new InvalidOperationException(string.Format("Could not add best solution result, because there is already a result with the name \"{0}\" present in the result collection.", BestSolutionResultName)); 82 96 } 83 97
Note: See TracChangeset
for help on using the changeset viewer.