Changeset 11405
- Timestamp:
- 09/29/14 17:39:19 (10 years ago)
- Location:
- branches/ProgrammableProblem/HeuristicLab.Problems.Programmable/3.3
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ProgrammableProblem/HeuristicLab.Problems.Programmable/3.3/Helper.cs
r11396 r11405 64 64 permutations: permDict.Count > 0 ? permDict : null); 65 65 } 66 67 internal static void Write(IScope scope, ParameterVector vector) { 68 foreach (var param in vector.BinaryNames) { 69 if (scope.Variables.ContainsKey(param)) 70 scope.Variables[param].Value = vector.BinaryVector(param); 71 else scope.Variables.Add(new Variable(param, vector.BinaryVector(param))); 72 } 73 foreach (var param in vector.IntegerNames) { 74 if (scope.Variables.ContainsKey(param)) 75 scope.Variables[param].Value = vector.IntegerVector(param); 76 else scope.Variables.Add(new Variable(param, vector.IntegerVector(param))); 77 } 78 foreach (var param in vector.RealNames) { 79 if (scope.Variables.ContainsKey(param)) 80 scope.Variables[param].Value = vector.RealVector(param); 81 else scope.Variables.Add(new Variable(param, vector.RealVector(param))); 82 } 83 foreach (var param in vector.PermutationNames) { 84 if (scope.Variables.ContainsKey(param)) 85 scope.Variables[param].Value = vector.Permutation(param); 86 else scope.Variables.Add(new Variable(param, vector.Permutation(param))); 87 } 88 } 66 89 } 67 90 } -
branches/ProgrammableProblem/HeuristicLab.Problems.Programmable/3.3/HeuristicLab.Problems.Programmable-3.3.csproj
r11400 r11405 159 159 <Compile Include="Interfaces\IProblemDefinition.cs" /> 160 160 <Compile Include="Interfaces\ISingleObjectiveProblemDefinition.cs" /> 161 <Compile Include="Operators\SingleObjectiveParameterVectorImprover.cs" /> 161 162 <Compile Include="ProblemDefinition.cs" /> 162 163 <Compile Include="ProblemDefinitionScript.cs" /> -
branches/ProgrammableProblem/HeuristicLab.Problems.Programmable/3.3/Operators/SingleObjectiveAnalyzer.cs
r11396 r11405 49 49 public override IOperation Apply() { 50 50 var host = ProblemDefinitionParameter.ActualValue; 51 if (host.Instance == null) throw new InvalidOperationException(" Script instance is null, maybe the code doesn't compile.");51 if (host.Instance == null) throw new InvalidOperationException("Problem definition is not available."); 52 52 var config = ConfigurationParameter.ActualValue; 53 53 var results = ResultsParameter.ActualValue; -
branches/ProgrammableProblem/HeuristicLab.Problems.Programmable/3.3/Operators/SingleObjectiveEvaluator.cs
r11396 r11405 67 67 var random = RandomParameter.ActualValue; 68 68 var host = ProblemDefinitionParameter.ActualValue; 69 if (host.Instance == null) throw new InvalidOperationException(" Script instance is null, maybe the code doesn't compile.");69 if (host.Instance == null) throw new InvalidOperationException("Problem definition is not available."); 70 70 var config = ConfigurationParameter.ActualValue; 71 71 var vector = Helper.Extract(ExecutionContext.Scope, config); -
branches/ProgrammableProblem/HeuristicLab.Problems.Programmable/3.3/SingleObjectiveProgrammableProblem.cs
r11399 r11405 171 171 UpdateMultiVectorEncodingOperators(solutionCreators, configuration); 172 172 } 173 UpdateImprovementOperators(); 173 174 UpdateMoveOperators(); 174 175 } … … 852 853 } 853 854 855 protected virtual void UpdateImprovementOperators() { 856 if (!Operators.Any(x => x is SingleObjectiveParameterVectorImprover)) 857 Operators.Add(new SingleObjectiveParameterVectorImprover()); 858 foreach (var improver in Operators.OfType<SingleObjectiveParameterVectorImprover>()) { 859 improver.ConfigurationParameter.ActualName = ConfigurationParameter.Name; 860 improver.MaximizationParameter.ActualName = MaximizationParameter.Name; 861 improver.ProblemDefinitionParameter.ActualName = ProblemDefinitionParameter.Name; 862 improver.QualityParameter.ActualName = Evaluator.QualityParameter.ActualName; 863 } 864 } 865 854 866 protected virtual void UpdateMoveOperators() { 855 867 Operators.RemoveAll(x => x is IParameterVectorMoveOperator);
Note: See TracChangeset
for help on using the changeset viewer.