Free cookie consent management tool by TermsFeed Policy Generator

Changeset 9696 for branches


Ignore:
Timestamp:
07/04/13 18:05:17 (11 years ago)
Author:
gkronber
Message:

#2026 simplified symb-reg example, cleaned ATG file (whitespace), removed obsolete files

Location:
branches/HeuristicLab.Problems.GPDL
Files:
1 deleted
5 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Problems.GPDL/GpdlCompiler/GpdlCompiler.csproj

    r9528 r9696  
    3535    <Reference Include="ALGLIB-3.7.0">
    3636      <HintPath>..\..\..\trunk\sources\bin\ALGLIB-3.7.0.dll</HintPath>
     37      <Private>True</Private>
    3738    </Reference>
    3839    <Reference Include="HeuristicLab.Algorithms.GeneticAlgorithm-3.3">
    3940      <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Algorithms.GeneticAlgorithm-3.3.dll</HintPath>
     41      <Private>True</Private>
    4042    </Reference>
    4143    <Reference Include="HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm-3.3">
    4244      <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm-3.3.dll</HintPath>
     45      <Private>True</Private>
    4346    </Reference>
    4447    <Reference Include="HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4">
    4548      <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4.dll</HintPath>
     49      <Private>True</Private>
    4650    </Reference>
    4751    <Reference Include="HeuristicLab.Optimization.Operators-3.3">
    4852      <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Optimization.Operators-3.3.dll</HintPath>
     53      <Private>True</Private>
    4954    </Reference>
    5055    <Reference Include="HeuristicLab.ParallelEngine-3.3">
    5156      <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.ParallelEngine-3.3.dll</HintPath>
     57      <Private>True</Private>
    5258    </Reference>
    5359    <Reference Include="HeuristicLab.Problems.DataAnalysis-3.4">
    5460      <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Problems.DataAnalysis-3.4.dll</HintPath>
     61      <Private>True</Private>
    5562    </Reference>
    5663    <Reference Include="HeuristicLab.Problems.Instances-3.3">
    5764      <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Problems.Instances-3.3.dll</HintPath>
     65      <Private>True</Private>
    5866    </Reference>
    5967    <Reference Include="HeuristicLab.Problems.Instances.DataAnalysis-3.3">
    6068      <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Problems.Instances.DataAnalysis-3.3.dll</HintPath>
     69      <Private>True</Private>
    6170    </Reference>
    6271    <Reference Include="HeuristicLab.Random-3.3">
    6372      <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Random-3.3.dll</HintPath>
     73      <Private>True</Private>
    6474    </Reference>
    6575    <Reference Include="HeuristicLab.Selection-3.3">
    6676      <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Selection-3.3.dll</HintPath>
     77      <Private>True</Private>
    6778    </Reference>
    6879    <Reference Include="HeuristicLab.SequentialEngine-3.3">
    6980      <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.SequentialEngine-3.3.dll</HintPath>
     81      <Private>True</Private>
    7082    </Reference>
    7183    <Reference Include="System" />
     
    8597      <Project>{e4ee5afb-d552-447b-8a16-6cbe7938af32}</Project>
    8698      <Name>HeuristicLab.Problems.GPDL-3.4</Name>
     99      <Private>True</Private>
    87100    </ProjectReference>
    88101  </ItemGroup>
  • branches/HeuristicLab.Problems.GPDL/HeuristicLab.Problems.GPDL.Views/3.4/Resources/symbreg HEAL.txt

    r9519 r9696  
    22
    33CODE <<
    4   double[,] inputValues;
    5   double[] targetValues;
     4  double[,] x;
     5  double[] y;
    66  string[] variableNames;
    77  Dictionary<string,int> nameToCol;
     
    1515      }
    1616    }
    17     return data[row, nameToCol[varName]];
     17    return x[row, nameToCol[varName]];
    1818  }
    1919
     
    2424     else return 0.0;
    2525  }
    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   }
    4326>>
    4427
    4528INIT <<
    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  }
    4745>>
    4846
     
    7573    | Division<<row, out val>>
    7674    | 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); >>
    7876    | Const<<out val>>
    7977  .
     
    9492MAXIMIZE                                                   /* could also use the keyword MINIMIZE here */
    9593  <<
    96     var rows = System.Linq.Enumerable.Range(0, inputValues.GetLength(0));
     94    var rows = System.Linq.Enumerable.Range(0, x.GetLength(0));
    9795    var predicted = rows.Select(r => {
    9896      double result;
     
    10098      return result;
    10199    });
    102     return RSquared(predicted, targetValues);
     100    return RSquared(predicted, y);
    103101  >>
    104102END SymbReg.
  • branches/HeuristicLab.Problems.GPDL/HeuristicLab.Problems.GPDL.Views/3.4/Resources/symbreg Koza.txt

    r9519 r9696  
    11PROBLEM SymbRegKoza
    22CODE <<
    3   double[,] inputValues;
    4   double[] targetValues;
     3  double[,] x;
     4  double[] y;
    55  string[] variableNames;
    66  Dictionary<string,int> nameToCol;
     
    1414      }
    1515    }
    16     return data[row, nameToCol[varName]];
     16    return x[row, nameToCol[varName]];
    1717  }
    1818
     
    2323     else return 0.0;
    2424  }
    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   }
    4225>>
    4326
    4427INIT <<
    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  }
    4644>>
    4745
     
    7472    | Division<<row, out val>>
    7573    | Multiplication<<row, out val>>
    76     | Var<<out varName>>                                   SEM << val = GetValue(inputValues, varName, row); >>
     74    | Var<<out varName>>                                   SEM << val = GetValue(x, varName, row); >>
    7775    | ERC<<out val>>
    7876  .
     
    9391MAXIMIZE                                                   /* could also use the keyword MINIMIZE here */
    9492  <<
    95     var rows = System.Linq.Enumerable.Range(0, inputValues.GetLength(0));
     93    var rows = System.Linq.Enumerable.Range(0, x.GetLength(0));
    9694    var predicted = rows.Select(r => {
    9795      double result;
     
    9997      return result;
    10098    });
    101     return RSquared(predicted, targetValues);
     99    return RSquared(predicted, y);
    102100  >>
    103101END SymbRegKoza.
  • branches/HeuristicLab.Problems.GPDL/HeuristicLab.Problems.GPDL.sln

    r9528 r9696  
    2525  EndProjectSection
    2626EndProject
    27 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "examples", "examples", "{B1F65B90-B1B7-45AF-9A16-DD8709B76C32}"
    28   ProjectSection(SolutionItems) = preProject
    29     examples\Artificial Ant.txt = examples\Artificial Ant.txt
    30     examples\Factorial.txt = examples\Factorial.txt
    31     examples\Fib.txt = examples\Fib.txt
    32     examples\multi-output-multiplier.txt = examples\multi-output-multiplier.txt
    33     examples\symbreg HEAL.txt = examples\symbreg HEAL.txt
    34     examples\symbreg Koza.txt = examples\symbreg Koza.txt
    35   EndProjectSection
    36 EndProject
    3727Project("{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}"
    3828EndProject
     
    4232  GlobalSection(SolutionConfigurationPlatforms) = preSolution
    4333    Debug|Any CPU = Debug|Any CPU
    44     Debug|x64 = Debug|x64
    45     Debug|x86 = Debug|x86
    4634    Release|Any CPU = Release|Any CPU
    47     Release|x64 = Release|x64
    48     Release|x86 = Release|x86
    4935  EndGlobalSection
    5036  GlobalSection(ProjectConfigurationPlatforms) = postSolution
    5137    {E4EE5AFB-D552-447B-8A16-6CBE7938AF32}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
    5238    {E4EE5AFB-D552-447B-8A16-6CBE7938AF32}.Debug|Any CPU.Build.0 = Debug|Any CPU
    53     {E4EE5AFB-D552-447B-8A16-6CBE7938AF32}.Debug|x64.ActiveCfg = Debug|x64
    54     {E4EE5AFB-D552-447B-8A16-6CBE7938AF32}.Debug|x64.Build.0 = Debug|x64
    55     {E4EE5AFB-D552-447B-8A16-6CBE7938AF32}.Debug|x86.ActiveCfg = Debug|x86
    56     {E4EE5AFB-D552-447B-8A16-6CBE7938AF32}.Debug|x86.Build.0 = Debug|x86
    5739    {E4EE5AFB-D552-447B-8A16-6CBE7938AF32}.Release|Any CPU.ActiveCfg = Release|Any CPU
    5840    {E4EE5AFB-D552-447B-8A16-6CBE7938AF32}.Release|Any CPU.Build.0 = Release|Any CPU
    59     {E4EE5AFB-D552-447B-8A16-6CBE7938AF32}.Release|x64.ActiveCfg = Release|x64
    60     {E4EE5AFB-D552-447B-8A16-6CBE7938AF32}.Release|x64.Build.0 = Release|x64
    61     {E4EE5AFB-D552-447B-8A16-6CBE7938AF32}.Release|x86.ActiveCfg = Release|x86
    62     {E4EE5AFB-D552-447B-8A16-6CBE7938AF32}.Release|x86.Build.0 = Release|x86
    6341    {729B818F-E1D0-4C9D-915A-775B2A4B1D27}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
    6442    {729B818F-E1D0-4C9D-915A-775B2A4B1D27}.Debug|Any CPU.Build.0 = Debug|Any CPU
    65     {729B818F-E1D0-4C9D-915A-775B2A4B1D27}.Debug|x64.ActiveCfg = Debug|Any CPU
    66     {729B818F-E1D0-4C9D-915A-775B2A4B1D27}.Debug|x86.ActiveCfg = Debug|Any CPU
    6743    {729B818F-E1D0-4C9D-915A-775B2A4B1D27}.Release|Any CPU.ActiveCfg = Release|Any CPU
    6844    {729B818F-E1D0-4C9D-915A-775B2A4B1D27}.Release|Any CPU.Build.0 = Release|Any CPU
    69     {729B818F-E1D0-4C9D-915A-775B2A4B1D27}.Release|x64.ActiveCfg = Release|Any CPU
    70     {729B818F-E1D0-4C9D-915A-775B2A4B1D27}.Release|x86.ActiveCfg = Release|Any CPU
    7145    {3F9E665A-3DCB-49C3-8806-0E47FC48EA52}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
    7246    {3F9E665A-3DCB-49C3-8806-0E47FC48EA52}.Debug|Any CPU.Build.0 = Debug|Any CPU
    73     {3F9E665A-3DCB-49C3-8806-0E47FC48EA52}.Debug|x64.ActiveCfg = Debug|x64
    74     {3F9E665A-3DCB-49C3-8806-0E47FC48EA52}.Debug|x64.Build.0 = Debug|x64
    75     {3F9E665A-3DCB-49C3-8806-0E47FC48EA52}.Debug|x86.ActiveCfg = Debug|x86
    76     {3F9E665A-3DCB-49C3-8806-0E47FC48EA52}.Debug|x86.Build.0 = Debug|x86
    7747    {3F9E665A-3DCB-49C3-8806-0E47FC48EA52}.Release|Any CPU.ActiveCfg = Release|Any CPU
    7848    {3F9E665A-3DCB-49C3-8806-0E47FC48EA52}.Release|Any CPU.Build.0 = Release|Any CPU
    79     {3F9E665A-3DCB-49C3-8806-0E47FC48EA52}.Release|x64.ActiveCfg = Release|x64
    80     {3F9E665A-3DCB-49C3-8806-0E47FC48EA52}.Release|x64.Build.0 = Release|x64
    81     {3F9E665A-3DCB-49C3-8806-0E47FC48EA52}.Release|x86.ActiveCfg = Release|x86
    82     {3F9E665A-3DCB-49C3-8806-0E47FC48EA52}.Release|x86.Build.0 = Release|x86
    8349    {C3A2E1C9-9677-4992-A1B7-7B38CDB82FEF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
    8450    {C3A2E1C9-9677-4992-A1B7-7B38CDB82FEF}.Debug|Any CPU.Build.0 = Debug|Any CPU
    85     {C3A2E1C9-9677-4992-A1B7-7B38CDB82FEF}.Debug|x64.ActiveCfg = Debug|Any CPU
    86     {C3A2E1C9-9677-4992-A1B7-7B38CDB82FEF}.Debug|x86.ActiveCfg = Debug|Any CPU
    8751    {C3A2E1C9-9677-4992-A1B7-7B38CDB82FEF}.Release|Any CPU.ActiveCfg = Release|Any CPU
    8852    {C3A2E1C9-9677-4992-A1B7-7B38CDB82FEF}.Release|Any CPU.Build.0 = Release|Any CPU
    89     {C3A2E1C9-9677-4992-A1B7-7B38CDB82FEF}.Release|x64.ActiveCfg = Release|Any CPU
    90     {C3A2E1C9-9677-4992-A1B7-7B38CDB82FEF}.Release|x86.ActiveCfg = Release|Any CPU
    9153  EndGlobalSection
    9254  GlobalSection(SolutionProperties) = preSolution
     
    9557  GlobalSection(NestedProjects) = preSolution
    9658    {582440C3-BB33-4683-A5EC-673AB51A7AB3} = {3768D612-38EB-47D8-9E79-75D8E5AB00A8}
    97     {B1F65B90-B1B7-45AF-9A16-DD8709B76C32} = {3768D612-38EB-47D8-9E79-75D8E5AB00A8}
    9859  EndGlobalSection
    9960EndGlobal
  • branches/HeuristicLab.Problems.GPDL/SyntaxAnalyzer/GPDef.atg

    r9430 r9696  
    55  digit = '0'..'9'.
    66  whiteSpace = CHR(9) + EOL IGNORE. /* ' ' ignored by default */
    7  
     7
    88COMMENTS
    99  FROM '/*' TO '*/' NESTED.
     
    1414  'SEM'. 'MAXIMIZE'. 'MINIMIZE'. 'TERMINALS'. 'CONSTRAINTS'. 'INIT'. 'CODE'.
    1515  'IN'. 'SET'. 'RANGE'.
    16  
     16
    1717TOKENS
    1818  '='. '|'. '.'. '('. ')'. '['. ']'. '{'. '}'. '>>'. '..'.
    19  
     19
    2020TOKEN CLASSES
    2121  ident = letter {letter | digit}.
    22  
     22
    2323PRAGMAS
    2424  source       = '<<' SEM <<for (; ; ) {
     
    4646                              }
    4747                            }>>
    48   . 
     48  .
    4949NONTERMINALS
    5050  GPDefSyntaxAnalyzer.   
     
    5252  RuleDef. SynExpr. SynTerm. SynFact. TerminalDecl.
    5353  ConstraintDef. ConstraintRule. SetDefinition.
    54  
     54
    5555RULES
    5656  GPDefSyntaxAnalyzer =
    5757    'PROBLEM' ident
    58   ['CODE' /* SourceText */]
    59   ['INIT' /* SourceText */]
     58  ['CODE' /* SourceText */]
     59  ['INIT' /* SourceText */]
    6060    'NONTERMINALS' { NonterminalDecl }
    6161    'TERMINALS' { TerminalDecl }
    6262    'RULES' { RuleDef }
    63     ('MAXIMIZE' | 'MINIMIZE') /* SourceText */ 
     63    ('MAXIMIZE' | 'MINIMIZE') /* SourceText */
    6464    'END' ident '.'.
    65  
    66  
    67   SemDecl = 'LOCAL' /* SourceText */                                               
     65
     66
     67  SemDecl = 'LOCAL' /* SourceText */
    6868  .
    69  
    70   SemAction = 'SEM' /* SourceText */                                               
     69
     70  SemAction = 'SEM' /* SourceText */
    7171  .
    72  
    73   NonterminalDecl = ident /* FormalAttrList */ '.'                                 
    74                                                                                    
    75                                        
    76                                                                                    
     72
     73  NonterminalDecl = ident /* FormalAttrList */ '.'
    7774  .
    78  
    79   TerminalDecl = ident /* FormalAttrList */   
     75
     76  TerminalDecl = ident /* FormalAttrList */
    8077    [ 'CONSTRAINTS' ConstraintDef ]
    81     '.'     
     78    '.'
    8279  .
    83  
     80
    8481  ConstraintDef = { ConstraintRule }.
    8582  ConstraintRule = ident 'IN' SetDefinition .
    8683  SetDefinition =
    8784    'SET' /* SourceText */
    88   | 'RANGE' /* SourceText */ '..' /* SourceText */
     85    | 'RANGE' /* SourceText */ '..' /* SourceText */
    8986  .
    90  
    91   RuleDef = ident /* FormalAttrList */ '=' [SemDecl] SynExpr '.'                   
     87
     88  RuleDef = ident /* FormalAttrList */ '=' [SemDecl] SynExpr '.'
    9289  .
    93  
    94   SynExpr = SynTerm {'|' SynTerm}                                                 
     90
     91  SynExpr = SynTerm {'|' SynTerm}
    9592  .
    96  
    97   SynTerm = SynFact {SynFact}                                                     
     93
     94  SynTerm = SynFact {SynFact}
    9895  .
    99  
     96
    10097  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
    107104  .
    108105
Note: See TracChangeset for help on using the changeset viewer.