- Timestamp:
- 07/04/13 18:05:17 (11 years ago)
- Location:
- branches/HeuristicLab.Problems.GPDL
- Files:
-
- 1 deleted
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Problems.GPDL/GpdlCompiler/GpdlCompiler.csproj
r9528 r9696 35 35 <Reference Include="ALGLIB-3.7.0"> 36 36 <HintPath>..\..\..\trunk\sources\bin\ALGLIB-3.7.0.dll</HintPath> 37 <Private>True</Private> 37 38 </Reference> 38 39 <Reference Include="HeuristicLab.Algorithms.GeneticAlgorithm-3.3"> 39 40 <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Algorithms.GeneticAlgorithm-3.3.dll</HintPath> 41 <Private>True</Private> 40 42 </Reference> 41 43 <Reference Include="HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm-3.3"> 42 44 <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm-3.3.dll</HintPath> 45 <Private>True</Private> 43 46 </Reference> 44 47 <Reference Include="HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4"> 45 48 <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4.dll</HintPath> 49 <Private>True</Private> 46 50 </Reference> 47 51 <Reference Include="HeuristicLab.Optimization.Operators-3.3"> 48 52 <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Optimization.Operators-3.3.dll</HintPath> 53 <Private>True</Private> 49 54 </Reference> 50 55 <Reference Include="HeuristicLab.ParallelEngine-3.3"> 51 56 <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.ParallelEngine-3.3.dll</HintPath> 57 <Private>True</Private> 52 58 </Reference> 53 59 <Reference Include="HeuristicLab.Problems.DataAnalysis-3.4"> 54 60 <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Problems.DataAnalysis-3.4.dll</HintPath> 61 <Private>True</Private> 55 62 </Reference> 56 63 <Reference Include="HeuristicLab.Problems.Instances-3.3"> 57 64 <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Problems.Instances-3.3.dll</HintPath> 65 <Private>True</Private> 58 66 </Reference> 59 67 <Reference Include="HeuristicLab.Problems.Instances.DataAnalysis-3.3"> 60 68 <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Problems.Instances.DataAnalysis-3.3.dll</HintPath> 69 <Private>True</Private> 61 70 </Reference> 62 71 <Reference Include="HeuristicLab.Random-3.3"> 63 72 <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Random-3.3.dll</HintPath> 73 <Private>True</Private> 64 74 </Reference> 65 75 <Reference Include="HeuristicLab.Selection-3.3"> 66 76 <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Selection-3.3.dll</HintPath> 77 <Private>True</Private> 67 78 </Reference> 68 79 <Reference Include="HeuristicLab.SequentialEngine-3.3"> 69 80 <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.SequentialEngine-3.3.dll</HintPath> 81 <Private>True</Private> 70 82 </Reference> 71 83 <Reference Include="System" /> … … 85 97 <Project>{e4ee5afb-d552-447b-8a16-6cbe7938af32}</Project> 86 98 <Name>HeuristicLab.Problems.GPDL-3.4</Name> 99 <Private>True</Private> 87 100 </ProjectReference> 88 101 </ItemGroup> -
branches/HeuristicLab.Problems.GPDL/HeuristicLab.Problems.GPDL.Views/3.4/Resources/symbreg HEAL.txt
r9519 r9696 2 2 3 3 CODE << 4 double[,] inputValues;5 double[] targetValues;4 double[,] x; 5 double[] y; 6 6 string[] variableNames; 7 7 Dictionary<string,int> nameToCol; … … 15 15 } 16 16 } 17 return data[row, nameToCol[varName]];17 return x[row, nameToCol[varName]]; 18 18 } 19 19 … … 24 24 else return 0.0; 25 25 } 26 27 28 void LoadData(string fileName, out double[,] inputValues, out string[] variableNames, out double[] target) {29 var prov = new HeuristicLab.Problems.Instances.DataAnalysis.RegressionRealWorldInstanceProvider();30 var dd = prov.GetDataDescriptors().OfType<HeuristicLab.Problems.Instances.DataAnalysis.Housing>().Single();31 var problemData = prov.LoadData(dd);32 33 inputValues = new double[problemData.TrainingIndices.Count(), problemData.AllowedInputVariables.Count()];34 foreach(var r in problemData.TrainingIndices) {35 int i=0;36 foreach(var v in problemData.AllowedInputVariables) {37 inputValues[r, i++] = problemData.Dataset.GetDoubleValue(v, r);38 }39 }40 variableNames = problemData.AllowedInputVariables.ToArray();41 target = problemData.Dataset.GetDoubleValues(problemData.TargetVariable, problemData.TrainingIndices).ToArray();42 }43 26 >> 44 27 45 28 INIT << 46 LoadData("filename.csv", out inputValues, out variableNames, out targetValues); 29 // generate 500 case of poly-10 benchmark function 30 int n = 500; 31 variableNames = new string[] {"x1", "x2", "x3", "x4", "x5", "x6", "x7", "x8", "x9", "x10" }; 32 var rand = new System.Random(); 33 x = new double[n, 10]; 34 y = new double[n]; 35 for(int row = 0; row < 500; row++) { 36 for(int col = 0; col < 10; col++) { 37 x[row, col] = rand.NextDouble() * 2.0 - 1.0; 38 } 39 y[row] = x[row, 0] * x[row, 1] + 40 x[row, 2] * x[row, 3] + 41 x[row, 4] * x[row, 5] + 42 x[row, 0] * x[row, 6] + x[row, 8] + 43 x[row, 2] * x[row, 5] + x[row, 9]; 44 } 47 45 >> 48 46 … … 75 73 | Division<<row, out val>> 76 74 | Multiplication<<row, out val>> 77 | Var<<out varName, out w>> SEM << val = w * GetValue( inputValues, varName, row); >>75 | Var<<out varName, out w>> SEM << val = w * GetValue(x, varName, row); >> 78 76 | Const<<out val>> 79 77 . … … 94 92 MAXIMIZE /* could also use the keyword MINIMIZE here */ 95 93 << 96 var rows = System.Linq.Enumerable.Range(0, inputValues.GetLength(0));94 var rows = System.Linq.Enumerable.Range(0, x.GetLength(0)); 97 95 var predicted = rows.Select(r => { 98 96 double result; … … 100 98 return result; 101 99 }); 102 return RSquared(predicted, targetValues);100 return RSquared(predicted, y); 103 101 >> 104 102 END SymbReg. -
branches/HeuristicLab.Problems.GPDL/HeuristicLab.Problems.GPDL.Views/3.4/Resources/symbreg Koza.txt
r9519 r9696 1 1 PROBLEM SymbRegKoza 2 2 CODE << 3 double[,] inputValues;4 double[] targetValues;3 double[,] x; 4 double[] y; 5 5 string[] variableNames; 6 6 Dictionary<string,int> nameToCol; … … 14 14 } 15 15 } 16 return data[row, nameToCol[varName]];16 return x[row, nameToCol[varName]]; 17 17 } 18 18 … … 23 23 else return 0.0; 24 24 } 25 26 27 void LoadData(string fileName, out double[,] inputValues, out string[] variableNames, out double[] target) {28 var prov = new HeuristicLab.Problems.Instances.DataAnalysis.RegressionRealWorldInstanceProvider();29 var dd = prov.GetDataDescriptors().OfType<HeuristicLab.Problems.Instances.DataAnalysis.Housing>().Single();30 var problemData = prov.LoadData(dd);31 32 inputValues = new double[problemData.TrainingIndices.Count(), problemData.AllowedInputVariables.Count()];33 foreach(var r in problemData.TrainingIndices) {34 int i=0;35 foreach(var v in problemData.AllowedInputVariables) {36 inputValues[r, i++] = problemData.Dataset.GetDoubleValue(v, r);37 }38 }39 variableNames = problemData.AllowedInputVariables.ToArray();40 target = problemData.Dataset.GetDoubleValues(problemData.TargetVariable, problemData.TrainingIndices).ToArray();41 }42 25 >> 43 26 44 27 INIT << 45 LoadData("filename.csv", out inputValues, out variableNames, out targetValues); 28 // generate 500 case of poly-10 benchmark function 29 int n = 500; 30 variableNames = new string[] {"x1", "x2", "x3", "x4", "x5", "x6", "x7", "x8", "x9", "x10" }; 31 var rand = new System.Random(); 32 x = new double[n, 10]; 33 y = new double[n]; 34 for(int row = 0; row < 500; row++) { 35 for(int col = 0; col < 10; col++) { 36 x[row, col] = rand.NextDouble() * 2.0 - 1.0; 37 } 38 y[row] = x[row, 0] * x[row, 1] + 39 x[row, 2] * x[row, 3] + 40 x[row, 4] * x[row, 5] + 41 x[row, 0] * x[row, 6] + x[row, 8] + 42 x[row, 2] * x[row, 5] + x[row, 9]; 43 } 46 44 >> 47 45 … … 74 72 | Division<<row, out val>> 75 73 | Multiplication<<row, out val>> 76 | Var<<out varName>> SEM << val = GetValue( inputValues, varName, row); >>74 | Var<<out varName>> SEM << val = GetValue(x, varName, row); >> 77 75 | ERC<<out val>> 78 76 . … … 93 91 MAXIMIZE /* could also use the keyword MINIMIZE here */ 94 92 << 95 var rows = System.Linq.Enumerable.Range(0, inputValues.GetLength(0));93 var rows = System.Linq.Enumerable.Range(0, x.GetLength(0)); 96 94 var predicted = rows.Select(r => { 97 95 double result; … … 99 97 return result; 100 98 }); 101 return RSquared(predicted, targetValues);99 return RSquared(predicted, y); 102 100 >> 103 101 END SymbRegKoza. -
branches/HeuristicLab.Problems.GPDL/HeuristicLab.Problems.GPDL.sln
r9528 r9696 25 25 EndProjectSection 26 26 EndProject 27 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "examples", "examples", "{B1F65B90-B1B7-45AF-9A16-DD8709B76C32}"28 ProjectSection(SolutionItems) = preProject29 examples\Artificial Ant.txt = examples\Artificial Ant.txt30 examples\Factorial.txt = examples\Factorial.txt31 examples\Fib.txt = examples\Fib.txt32 examples\multi-output-multiplier.txt = examples\multi-output-multiplier.txt33 examples\symbreg HEAL.txt = examples\symbreg HEAL.txt34 examples\symbreg Koza.txt = examples\symbreg Koza.txt35 EndProjectSection36 EndProject37 27 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Problems.GPDL.Views-3.4", "HeuristicLab.Problems.GPDL.Views\3.4\HeuristicLab.Problems.GPDL.Views-3.4.csproj", "{3F9E665A-3DCB-49C3-8806-0E47FC48EA52}" 38 28 EndProject … … 42 32 GlobalSection(SolutionConfigurationPlatforms) = preSolution 43 33 Debug|Any CPU = Debug|Any CPU 44 Debug|x64 = Debug|x6445 Debug|x86 = Debug|x8646 34 Release|Any CPU = Release|Any CPU 47 Release|x64 = Release|x6448 Release|x86 = Release|x8649 35 EndGlobalSection 50 36 GlobalSection(ProjectConfigurationPlatforms) = postSolution 51 37 {E4EE5AFB-D552-447B-8A16-6CBE7938AF32}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 52 38 {E4EE5AFB-D552-447B-8A16-6CBE7938AF32}.Debug|Any CPU.Build.0 = Debug|Any CPU 53 {E4EE5AFB-D552-447B-8A16-6CBE7938AF32}.Debug|x64.ActiveCfg = Debug|x6454 {E4EE5AFB-D552-447B-8A16-6CBE7938AF32}.Debug|x64.Build.0 = Debug|x6455 {E4EE5AFB-D552-447B-8A16-6CBE7938AF32}.Debug|x86.ActiveCfg = Debug|x8656 {E4EE5AFB-D552-447B-8A16-6CBE7938AF32}.Debug|x86.Build.0 = Debug|x8657 39 {E4EE5AFB-D552-447B-8A16-6CBE7938AF32}.Release|Any CPU.ActiveCfg = Release|Any CPU 58 40 {E4EE5AFB-D552-447B-8A16-6CBE7938AF32}.Release|Any CPU.Build.0 = Release|Any CPU 59 {E4EE5AFB-D552-447B-8A16-6CBE7938AF32}.Release|x64.ActiveCfg = Release|x6460 {E4EE5AFB-D552-447B-8A16-6CBE7938AF32}.Release|x64.Build.0 = Release|x6461 {E4EE5AFB-D552-447B-8A16-6CBE7938AF32}.Release|x86.ActiveCfg = Release|x8662 {E4EE5AFB-D552-447B-8A16-6CBE7938AF32}.Release|x86.Build.0 = Release|x8663 41 {729B818F-E1D0-4C9D-915A-775B2A4B1D27}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 64 42 {729B818F-E1D0-4C9D-915A-775B2A4B1D27}.Debug|Any CPU.Build.0 = Debug|Any CPU 65 {729B818F-E1D0-4C9D-915A-775B2A4B1D27}.Debug|x64.ActiveCfg = Debug|Any CPU66 {729B818F-E1D0-4C9D-915A-775B2A4B1D27}.Debug|x86.ActiveCfg = Debug|Any CPU67 43 {729B818F-E1D0-4C9D-915A-775B2A4B1D27}.Release|Any CPU.ActiveCfg = Release|Any CPU 68 44 {729B818F-E1D0-4C9D-915A-775B2A4B1D27}.Release|Any CPU.Build.0 = Release|Any CPU 69 {729B818F-E1D0-4C9D-915A-775B2A4B1D27}.Release|x64.ActiveCfg = Release|Any CPU70 {729B818F-E1D0-4C9D-915A-775B2A4B1D27}.Release|x86.ActiveCfg = Release|Any CPU71 45 {3F9E665A-3DCB-49C3-8806-0E47FC48EA52}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 72 46 {3F9E665A-3DCB-49C3-8806-0E47FC48EA52}.Debug|Any CPU.Build.0 = Debug|Any CPU 73 {3F9E665A-3DCB-49C3-8806-0E47FC48EA52}.Debug|x64.ActiveCfg = Debug|x6474 {3F9E665A-3DCB-49C3-8806-0E47FC48EA52}.Debug|x64.Build.0 = Debug|x6475 {3F9E665A-3DCB-49C3-8806-0E47FC48EA52}.Debug|x86.ActiveCfg = Debug|x8676 {3F9E665A-3DCB-49C3-8806-0E47FC48EA52}.Debug|x86.Build.0 = Debug|x8677 47 {3F9E665A-3DCB-49C3-8806-0E47FC48EA52}.Release|Any CPU.ActiveCfg = Release|Any CPU 78 48 {3F9E665A-3DCB-49C3-8806-0E47FC48EA52}.Release|Any CPU.Build.0 = Release|Any CPU 79 {3F9E665A-3DCB-49C3-8806-0E47FC48EA52}.Release|x64.ActiveCfg = Release|x6480 {3F9E665A-3DCB-49C3-8806-0E47FC48EA52}.Release|x64.Build.0 = Release|x6481 {3F9E665A-3DCB-49C3-8806-0E47FC48EA52}.Release|x86.ActiveCfg = Release|x8682 {3F9E665A-3DCB-49C3-8806-0E47FC48EA52}.Release|x86.Build.0 = Release|x8683 49 {C3A2E1C9-9677-4992-A1B7-7B38CDB82FEF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 84 50 {C3A2E1C9-9677-4992-A1B7-7B38CDB82FEF}.Debug|Any CPU.Build.0 = Debug|Any CPU 85 {C3A2E1C9-9677-4992-A1B7-7B38CDB82FEF}.Debug|x64.ActiveCfg = Debug|Any CPU86 {C3A2E1C9-9677-4992-A1B7-7B38CDB82FEF}.Debug|x86.ActiveCfg = Debug|Any CPU87 51 {C3A2E1C9-9677-4992-A1B7-7B38CDB82FEF}.Release|Any CPU.ActiveCfg = Release|Any CPU 88 52 {C3A2E1C9-9677-4992-A1B7-7B38CDB82FEF}.Release|Any CPU.Build.0 = Release|Any CPU 89 {C3A2E1C9-9677-4992-A1B7-7B38CDB82FEF}.Release|x64.ActiveCfg = Release|Any CPU90 {C3A2E1C9-9677-4992-A1B7-7B38CDB82FEF}.Release|x86.ActiveCfg = Release|Any CPU91 53 EndGlobalSection 92 54 GlobalSection(SolutionProperties) = preSolution … … 95 57 GlobalSection(NestedProjects) = preSolution 96 58 {582440C3-BB33-4683-A5EC-673AB51A7AB3} = {3768D612-38EB-47D8-9E79-75D8E5AB00A8} 97 {B1F65B90-B1B7-45AF-9A16-DD8709B76C32} = {3768D612-38EB-47D8-9E79-75D8E5AB00A8}98 59 EndGlobalSection 99 60 EndGlobal -
branches/HeuristicLab.Problems.GPDL/SyntaxAnalyzer/GPDef.atg
r9430 r9696 5 5 digit = '0'..'9'. 6 6 whiteSpace = CHR(9) + EOL IGNORE. /* ' ' ignored by default */ 7 7 8 8 COMMENTS 9 9 FROM '/*' TO '*/' NESTED. … … 14 14 'SEM'. 'MAXIMIZE'. 'MINIMIZE'. 'TERMINALS'. 'CONSTRAINTS'. 'INIT'. 'CODE'. 15 15 'IN'. 'SET'. 'RANGE'. 16 16 17 17 TOKENS 18 18 '='. '|'. '.'. '('. ')'. '['. ']'. '{'. '}'. '>>'. '..'. 19 19 20 20 TOKEN CLASSES 21 21 ident = letter {letter | digit}. 22 22 23 23 PRAGMAS 24 24 source = '<<' SEM <<for (; ; ) { … … 46 46 } 47 47 }>> 48 . 48 . 49 49 NONTERMINALS 50 50 GPDefSyntaxAnalyzer. … … 52 52 RuleDef. SynExpr. SynTerm. SynFact. TerminalDecl. 53 53 ConstraintDef. ConstraintRule. SetDefinition. 54 54 55 55 RULES 56 56 GPDefSyntaxAnalyzer = 57 57 'PROBLEM' ident 58 59 58 ['CODE' /* SourceText */] 59 ['INIT' /* SourceText */] 60 60 'NONTERMINALS' { NonterminalDecl } 61 61 'TERMINALS' { TerminalDecl } 62 62 'RULES' { RuleDef } 63 ('MAXIMIZE' | 'MINIMIZE') /* SourceText */ 63 ('MAXIMIZE' | 'MINIMIZE') /* SourceText */ 64 64 'END' ident '.'. 65 66 67 SemDecl = 'LOCAL' /* SourceText */ 65 66 67 SemDecl = 'LOCAL' /* SourceText */ 68 68 . 69 70 SemAction = 'SEM' /* SourceText */ 69 70 SemAction = 'SEM' /* SourceText */ 71 71 . 72 73 NonterminalDecl = ident /* FormalAttrList */ '.' 74 75 76 72 73 NonterminalDecl = ident /* FormalAttrList */ '.' 77 74 . 78 79 TerminalDecl = ident /* FormalAttrList */ 75 76 TerminalDecl = ident /* FormalAttrList */ 80 77 [ 'CONSTRAINTS' ConstraintDef ] 81 '.' 78 '.' 82 79 . 83 80 84 81 ConstraintDef = { ConstraintRule }. 85 82 ConstraintRule = ident 'IN' SetDefinition . 86 83 SetDefinition = 87 84 'SET' /* SourceText */ 88 85 | 'RANGE' /* SourceText */ '..' /* SourceText */ 89 86 . 90 91 RuleDef = ident /* FormalAttrList */ '=' [SemDecl] SynExpr '.' 87 88 RuleDef = ident /* FormalAttrList */ '=' [SemDecl] SynExpr '.' 92 89 . 93 94 SynExpr = SynTerm {'|' SynTerm} 90 91 SynExpr = SynTerm {'|' SynTerm} 95 92 . 96 97 SynTerm = SynFact {SynFact} 93 94 SynTerm = SynFact {SynFact} 98 95 . 99 96 100 97 SynFact = 101 ident /* ActualAttrList */ 102 | 'EPS' 103 | '(' SynExpr ')' 104 | '[' SynExpr ']' 105 | '{' SynExpr '}' 106 | SemAction 98 ident /* ActualAttrList */ 99 | 'EPS' 100 | '(' SynExpr ')' 101 | '[' SynExpr ']' 102 | '{' SynExpr '}' 103 | SemAction 107 104 . 108 105
Note: See TracChangeset
for help on using the changeset viewer.