Changeset 14717 for branches/symbreg-factors-2650/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisProblem.cs
- Timestamp:
- 03/06/17 16:40:33 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/symbreg-factors-2650/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/SymbolicDataAnalysisProblem.cs
r14249 r14717 159 159 [StorableHook(HookType.AfterDeserialization)] 160 160 private void AfterDeserialization() { 161 if 161 if(!Parameters.ContainsKey(ApplyLinearScalingParameterName)) { 162 162 Parameters.Add(new FixedValueParameter<BoolValue>(ApplyLinearScalingParameterName, ApplyLinearScalingParameterDescription, new BoolValue(false))); 163 163 ApplyLinearScalingParameter.Hidden = true; … … 165 165 //it is assumed that for all symbolic regression algorithms linear scaling was set to true 166 166 //there is no possibility to determine the previous value of the parameter as it was stored in the evaluator 167 if 167 if(GetType().Name.Contains("SymbolicRegression")) 168 168 ApplyLinearScaling.Value = true; 169 169 } … … 213 213 grammar.MaximumFunctionArguments = MaximumFunctionArguments.Value; 214 214 grammar.MaximumFunctionDefinitions = MaximumFunctionDefinitions.Value; 215 foreach 216 if 215 foreach(var varSymbol in grammar.Symbols.OfType<HeuristicLab.Problems.DataAnalysis.Symbolic.VariableBase>()) { 216 if(!varSymbol.Fixed) { 217 217 varSymbol.AllVariableNames = problemData.InputVariables.Select(x => x.Value).Where(x => ds.VariableHasType<double>(x)); 218 218 varSymbol.VariableNames = problemData.AllowedInputVariables.Where(x => ds.VariableHasType<double>(x)); 219 219 } 220 220 } 221 foreach 222 if 221 foreach(var factorSymbol in grammar.Symbols.OfType<BinaryFactorVariable>()) { 222 if(!factorSymbol.Fixed) { 223 223 factorSymbol.AllVariableNames = problemData.InputVariables.Select(x => x.Value).Where(x => ds.VariableHasType<string>(x)); 224 224 factorSymbol.VariableNames = problemData.AllowedInputVariables.Where(x => ds.VariableHasType<string>(x)); … … 226 226 .ToDictionary(varName => varName, varName => ds.GetStringValues(varName).Distinct().ToList()); 227 227 } 228 } foreach (var factorSymbol in grammar.Symbols.OfType<FactorVariable>()) { 229 if (!factorSymbol.Fixed) { 228 } 229 foreach(var factorSymbol in grammar.Symbols.OfType<FactorVariable>()) { 230 if(!factorSymbol.Fixed) { 230 231 factorSymbol.AllVariableNames = problemData.InputVariables.Select(x => x.Value).Where(x => ds.VariableHasType<string>(x)); 231 232 factorSymbol.VariableNames = problemData.AllowedInputVariables.Where(x => ds.VariableHasType<string>(x)); 232 233 factorSymbol.VariableValues = factorSymbol.VariableNames 233 .ToDictionary(varName => varName, varName => ds.GetStringValues(varName).Distinct().ToList()); 234 .ToDictionary(varName => varName, 235 varName => ds.GetStringValues(varName).Distinct() 236 .Select((n, i) => Tuple.Create(n, i)) 237 .ToDictionary(tup => tup.Item1, tup => tup.Item2)); 234 238 } 235 239 } … … 276 280 277 281 private void MaximumSymbolicExpressionTreeDepth_ValueChanged(object sender, EventArgs e) { 278 if 282 if(MaximumSymbolicExpressionTreeDepth != null && MaximumSymbolicExpressionTreeDepth.Value < 3) 279 283 MaximumSymbolicExpressionTreeDepth.Value = 3; 280 284 } … … 304 308 305 309 var handler = ProblemDataChanged; 306 if 310 if(handler != null) handler(this, EventArgs.Empty); 307 311 308 312 OnReset(); … … 313 317 var operators = Parameters.OfType<IValueParameter>().Select(p => p.Value).OfType<IOperator>().Union(Operators).ToList(); 314 318 315 foreach 319 foreach(var op in operators.OfType<ISymbolicExpressionTreeGrammarBasedOperator>()) { 316 320 op.SymbolicExpressionTreeGrammarParameter.ActualName = SymbolicExpressionTreeGrammarParameter.Name; 317 321 } 318 foreach 322 foreach(var op in operators.OfType<ISymbolicExpressionTreeSizeConstraintOperator>()) { 319 323 op.MaximumSymbolicExpressionTreeDepthParameter.ActualName = MaximumSymbolicExpressionTreeDepthParameter.Name; 320 324 op.MaximumSymbolicExpressionTreeLengthParameter.ActualName = MaximumSymbolicExpressionTreeLengthParameter.Name; 321 325 } 322 foreach 326 foreach(var op in operators.OfType<ISymbolicExpressionTreeArchitectureAlteringOperator>()) { 323 327 op.MaximumFunctionArgumentsParameter.ActualName = MaximumFunctionArgumentsParameter.Name; 324 328 op.MaximumFunctionDefinitionsParameter.ActualName = MaximumFunctionDefinitionsParameter.Name; 325 329 } 326 foreach 330 foreach(var op in operators.OfType<ISymbolicDataAnalysisEvaluator<T>>()) { 327 331 op.ProblemDataParameter.ActualName = ProblemDataParameterName; 328 332 op.SymbolicExpressionTreeParameter.ActualName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName; … … 331 335 op.ApplyLinearScalingParameter.ActualName = ApplyLinearScalingParameter.Name; 332 336 } 333 foreach 337 foreach(var op in operators.OfType<ISymbolicExpressionTreeCrossover>()) { 334 338 op.ParentsParameter.ActualName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName; 335 339 op.SymbolicExpressionTreeParameter.ActualName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName; 336 340 } 337 foreach 338 op.SymbolicExpressionTreeParameter.ActualName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName; 339 } 340 foreach 341 op.SymbolicExpressionTreeParameter.ActualName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName; 342 } 343 foreach 341 foreach(var op in operators.OfType<ISymbolicExpressionTreeManipulator>()) { 342 op.SymbolicExpressionTreeParameter.ActualName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName; 343 } 344 foreach(var op in operators.OfType<ISymbolicExpressionTreeAnalyzer>()) { 345 op.SymbolicExpressionTreeParameter.ActualName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName; 346 } 347 foreach(var op in operators.OfType<ISymbolicDataAnalysisSingleObjectiveAnalyzer>()) { 344 348 op.ApplyLinearScalingParameter.ActualName = ApplyLinearScalingParameter.Name; 345 349 } 346 foreach 350 foreach(var op in operators.OfType<ISymbolicDataAnalysisMultiObjectiveAnalyzer>()) { 347 351 op.ApplyLinearScalingParameter.ActualName = ApplyLinearScalingParameter.Name; 348 352 } 349 foreach 350 op.SymbolicExpressionTreeParameter.ActualName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName; 351 } 352 foreach 353 foreach(var op in operators.OfType<ISymbolicDataAnalysisAnalyzer>()) { 354 op.SymbolicExpressionTreeParameter.ActualName = SolutionCreator.SymbolicExpressionTreeParameter.ActualName; 355 } 356 foreach(var op in operators.OfType<ISymbolicDataAnalysisValidationAnalyzer<U, T>>()) { 353 357 op.RelativeNumberOfEvaluatedSamplesParameter.ActualName = RelativeNumberOfEvaluatedSamplesParameter.Name; 354 358 op.ValidationPartitionParameter.ActualName = ValidationPartitionParameter.Name; 355 359 } 356 foreach 360 foreach(var op in operators.OfType<ISymbolicDataAnalysisInterpreterOperator>()) { 357 361 op.SymbolicDataAnalysisTreeInterpreterParameter.ActualName = SymbolicExpressionTreeInterpreterParameter.Name; 358 362 } 359 foreach 363 foreach(var op in operators.OfType<ISymbolicDataAnalysisExpressionCrossover<T>>()) { 360 364 op.EvaluationPartitionParameter.ActualName = FitnessCalculationPartitionParameter.Name; 361 365 op.ProblemDataParameter.ActualName = ProblemDataParameter.Name;
Note: See TracChangeset
for help on using the changeset viewer.