Changeset 11595
- Timestamp:
- 11/27/14 11:42:47 (10 years ago)
- Location:
- branches/ProgrammableProblem
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ProgrammableProblem/HeuristicLab.Optimization/3.3/Algorithms/EngineAlgorithm.cs
r11171 r11595 159 159 if ((engine != null) && (operatorGraph.InitialOperator != null)) { 160 160 ExecutionContext context = null; 161 if (Problem != null) context = new ExecutionContext(context, Problem, globalScope); 161 if (Problem != null) { 162 foreach (var item in Problem.ExecutionContextItems) 163 context = new ExecutionContext(context, item, globalScope); 164 } 162 165 context = new ExecutionContext(context, this, globalScope); 163 166 context = new ExecutionContext(context, operatorGraph.InitialOperator, globalScope); -
branches/ProgrammableProblem/HeuristicLab.Optimization/3.3/Interfaces/IProblem.cs
r11171 r11595 31 31 IEnumerable<IItem> Operators { get; } 32 32 33 34 IEnumerable<IParameterizedItem> ExecutionContextItems { get; } 33 35 event EventHandler OperatorsChanged; 34 36 event EventHandler Reset; -
branches/ProgrammableProblem/HeuristicLab.Optimization/3.3/Problems/Problem.cs
r11573 r11595 116 116 IEnumerable<IItem> IProblem.Operators { get { return GetOperators(); } } 117 117 118 protected virtual IEnumerable<IItem> GetOperators() 119 { 118 protected virtual IEnumerable<IItem> GetOperators() { 120 119 return Operators; 120 } 121 122 public virtual IEnumerable<IParameterizedItem> ExecutionContextItems { 123 get { yield return this; } 121 124 } 122 125 #endregion -
branches/ProgrammableProblem/HeuristicLab.Optimization/3.3/Problems/UserDefinedProblem.cs
r11171 r11595 115 115 get { return OperatorsParameter.Value; } 116 116 } 117 118 public IEnumerable<IParameterizedItem> ExecutionContextItems { 119 get { yield return this; } 120 } 117 121 #endregion 118 122 -
branches/ProgrammableProblem/HeuristicLab.Problems.Programmable/3.3/SingleObjectiveProgrammableProblem.cs
r11587 r11595 58 58 } 59 59 60 61 60 public ISingleObjectiveProblemDefinition ProblemDefinition { 62 61 get { return ProblemDefinitionParameter.Value; } … … 64 63 } 65 64 66 [Storable] 67 protected List<IParameter> DynamicEncodingParameters; 68 65 66 public override IEnumerable<IParameterizedItem> ExecutionContextItems { 67 get { return base.ExecutionContextItems.Concat(new[] { ProblemDefinition.Encoding }); } 68 } 69 69 protected override IEnumerable<IItem> GetOperators() { 70 70 return base.GetOperators().Concat(ProblemDefinition.Encoding.Operators); … … 76 76 protected SingleObjectiveProgrammableProblem(SingleObjectiveProgrammableProblem original, Cloner cloner) 77 77 : base(original, cloner) { 78 DynamicEncodingParameters = original.DynamicEncodingParameters.Select(cloner.Clone).ToList();79 78 RegisterEventHandlers(); 80 79 } … … 84 83 Parameters.Add(new ValueParameter<IEncoding>("Encoding", "Describes the configuration of the encoding, what the variables are called, what type they are and their bounds if any.")); 85 84 86 DynamicEncodingParameters = new List<IParameter>();87 85 88 86 Operators.Add(new BestScopeSolutionAnalyzer()); … … 158 156 analyzeOp.ProblemDefinitionParameter.ActualName = ProblemDefinitionParameter.Name; 159 157 analyzeOp.QualityParameter.ActualName = Evaluator.QualityParameter.ActualName; 160 }161 162 foreach (var param in DynamicEncodingParameters)163 if (Parameters.Contains(param)) Parameters.Remove(param);164 DynamicEncodingParameters.Clear();165 166 DynamicEncodingParameters.AddRange(encoding.Parameters);167 foreach (var param in DynamicEncodingParameters) {168 param.Hidden = true;169 Parameters.Add(param);170 158 } 171 159 … … 215 203 } 216 204 } 217 218 219 205 } 220 206 }
Note: See TracChangeset
for help on using the changeset viewer.