Free cookie consent management tool by TermsFeed Policy Generator

Changeset 12807


Ignore:
Timestamp:
07/27/15 21:39:33 (9 years ago)
Author:
bburlacu
Message:

#2442: Added new interpreter as described above. The new function symbol accepts lambdas in the constructor and gets intitialized with a fixed arity. The MethodInfo of the provided lambda is stored internally and used by the interpreter. The MethodInfo field should be [Storable] but this would require a small change to the serializer (relatively trivial I think). Currently it works with the programmable problem and the SymbolicExpressionTreeEncoding (see attached example).

Location:
branches/HeuristicLab.LinqExpressionTreeInterpreter
Files:
6 added
2 edited
1 copied

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.LinqExpressionTreeInterpreter/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.csproj

    r12790 r12807  
    4141    <DebugType>full</DebugType>
    4242    <Optimize>false</Optimize>
    43     <OutputPath>$(SolutionDir)\bin\</OutputPath>
     43    <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath>
    4444    <DefineConstants>DEBUG;TRACE</DefineConstants>
    4545    <ErrorReport>prompt</ErrorReport>
     
    5151    <DebugType>pdbonly</DebugType>
    5252    <Optimize>true</Optimize>
    53     <OutputPath>$(SolutionDir)\bin\</OutputPath>
     53    <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath>
    5454    <DefineConstants>TRACE</DefineConstants>
    5555    <ErrorReport>prompt</ErrorReport>
     
    9999  </PropertyGroup>
    100100  <ItemGroup>
    101     <Reference Include="ALGLIB-3.9.0, Version=3.9.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
    102       <HintPath>..\..\bin\ALGLIB-3.9.0.dll</HintPath>
     101    <Reference Include="ALGLIB-3.9.0">
     102      <HintPath>..\..\..\..\trunk\sources\bin\ALGLIB-3.9.0.dll</HintPath>
     103      <Private>False</Private>
     104    </Reference>
     105    <Reference Include="HeuristicLab.Analysis-3.3">
     106      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Analysis-3.3.dll</HintPath>
     107      <Private>False</Private>
     108    </Reference>
     109    <Reference Include="HeuristicLab.Collections-3.3">
     110      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Collections-3.3.dll</HintPath>
     111      <Private>False</Private>
     112    </Reference>
     113    <Reference Include="HeuristicLab.Common-3.3">
     114      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Common-3.3.dll</HintPath>
     115      <Private>False</Private>
     116    </Reference>
     117    <Reference Include="HeuristicLab.Common.Resources-3.3">
     118      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Common.Resources-3.3.dll</HintPath>
     119      <Private>False</Private>
     120    </Reference>
     121    <Reference Include="HeuristicLab.Core-3.3">
     122      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Core-3.3.dll</HintPath>
     123      <Private>False</Private>
     124    </Reference>
     125    <Reference Include="HeuristicLab.Data-3.3">
     126      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Data-3.3.dll</HintPath>
     127      <Private>False</Private>
     128    </Reference>
     129    <Reference Include="HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4">
     130      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4.dll</HintPath>
     131      <Private>False</Private>
     132    </Reference>
     133    <Reference Include="HeuristicLab.Operators-3.3">
     134      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Operators-3.3.dll</HintPath>
     135      <Private>False</Private>
     136    </Reference>
     137    <Reference Include="HeuristicLab.Optimization-3.3">
     138      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Optimization-3.3.dll</HintPath>
     139      <Private>False</Private>
     140    </Reference>
     141    <Reference Include="HeuristicLab.Optimization.Operators-3.3">
     142      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Optimization.Operators-3.3.dll</HintPath>
     143      <Private>False</Private>
     144    </Reference>
     145    <Reference Include="HeuristicLab.Parameters-3.3">
     146      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Parameters-3.3.dll</HintPath>
     147      <Private>False</Private>
     148    </Reference>
     149    <Reference Include="HeuristicLab.Persistence-3.3">
     150      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Persistence-3.3.dll</HintPath>
     151      <Private>False</Private>
     152    </Reference>
     153    <Reference Include="HeuristicLab.PluginInfrastructure-3.3">
     154      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.PluginInfrastructure-3.3.dll</HintPath>
     155      <Private>False</Private>
     156    </Reference>
     157    <Reference Include="HeuristicLab.Problems.DataAnalysis-3.4">
     158      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Problems.DataAnalysis-3.4.dll</HintPath>
     159      <Private>False</Private>
     160    </Reference>
     161    <Reference Include="HeuristicLab.Problems.Instances-3.3">
     162      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Problems.Instances-3.3.dll</HintPath>
     163      <Private>False</Private>
     164    </Reference>
     165    <Reference Include="HeuristicLab.Random-3.3">
     166      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Random-3.3.dll</HintPath>
    103167      <Private>False</Private>
    104168    </Reference>
     
    137201    <Compile Include="Importer\Token.cs" />
    138202    <Compile Include="Interfaces\IModelBacktransformator.cs" />
     203    <Compile Include="Interpreter\SymbolicDataAnalysisExpressionCompiledTreeInterpreter.cs" />
    139204    <Compile Include="SymbolicExpressionTreeBacktransformator.cs" />
    140205    <Compile Include="SymbolicDataAnalysisExpressionPruningOperator.cs" />
     
    192257    <Compile Include="Symbols\AiryB.cs" />
    193258    <Compile Include="Symbols\Bessel.cs" />
     259    <Compile Include="Symbols\FunctionSymbol.cs" />
    194260    <Compile Include="Symbols\Xor.cs" />
    195261    <Compile Include="Symbols\Erf.cs" />
     
    276342    </BootstrapperPackage>
    277343  </ItemGroup>
    278   <ItemGroup>
    279     <ProjectReference Include="..\..\HeuristicLab.Analysis\3.3\HeuristicLab.Analysis-3.3.csproj">
    280       <Project>{887425B4-4348-49ED-A457-B7D2C26DDBF9}</Project>
    281       <Name>HeuristicLab.Analysis-3.3</Name>
    282       <Private>False</Private>
    283     </ProjectReference>
    284     <ProjectReference Include="..\..\HeuristicLab.Collections\3.3\HeuristicLab.Collections-3.3.csproj">
    285       <Project>{958B43BC-CC5C-4FA2-8628-2B3B01D890B6}</Project>
    286       <Name>HeuristicLab.Collections-3.3</Name>
    287       <Private>False</Private>
    288     </ProjectReference>
    289     <ProjectReference Include="..\..\HeuristicLab.Common.Resources\3.3\HeuristicLab.Common.Resources-3.3.csproj">
    290       <Project>{0E27A536-1C4A-4624-A65E-DC4F4F23E3E1}</Project>
    291       <Name>HeuristicLab.Common.Resources-3.3</Name>
    292       <Private>False</Private>
    293     </ProjectReference>
    294     <ProjectReference Include="..\..\HeuristicLab.Common\3.3\HeuristicLab.Common-3.3.csproj">
    295       <Project>{A9AD58B9-3EF9-4CC1-97E5-8D909039FF5C}</Project>
    296       <Name>HeuristicLab.Common-3.3</Name>
    297       <Private>False</Private>
    298     </ProjectReference>
    299     <ProjectReference Include="..\..\HeuristicLab.Core\3.3\HeuristicLab.Core-3.3.csproj">
    300       <Project>{C36BD924-A541-4A00-AFA8-41701378DDC5}</Project>
    301       <Name>HeuristicLab.Core-3.3</Name>
    302       <Private>False</Private>
    303     </ProjectReference>
    304     <ProjectReference Include="..\..\HeuristicLab.Data\3.3\HeuristicLab.Data-3.3.csproj">
    305       <Project>{BBAB9DF5-5EF3-4BA8-ADE9-B36E82114937}</Project>
    306       <Name>HeuristicLab.Data-3.3</Name>
    307       <Private>False</Private>
    308     </ProjectReference>
    309     <ProjectReference Include="..\..\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding\3.4\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4.csproj">
    310       <Project>{06D4A186-9319-48A0-BADE-A2058D462EEA}</Project>
    311       <Name>HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4</Name>
    312       <Private>False</Private>
    313     </ProjectReference>
    314     <ProjectReference Include="..\..\HeuristicLab.Operators\3.3\HeuristicLab.Operators-3.3.csproj">
    315       <Project>{23DA7FF4-D5B8-41B6-AA96-F0561D24F3EE}</Project>
    316       <Name>HeuristicLab.Operators-3.3</Name>
    317       <Private>False</Private>
    318     </ProjectReference>
    319     <ProjectReference Include="..\..\HeuristicLab.Optimization.Operators\3.3\HeuristicLab.Optimization.Operators-3.3.csproj">
    320       <Project>{25087811-F74C-4128-BC86-8324271DA13E}</Project>
    321       <Name>HeuristicLab.Optimization.Operators-3.3</Name>
    322       <Private>False</Private>
    323     </ProjectReference>
    324     <ProjectReference Include="..\..\HeuristicLab.Optimization\3.3\HeuristicLab.Optimization-3.3.csproj">
    325       <Project>{14AB8D24-25BC-400C-A846-4627AA945192}</Project>
    326       <Name>HeuristicLab.Optimization-3.3</Name>
    327     </ProjectReference>
    328     <ProjectReference Include="..\..\HeuristicLab.Parameters\3.3\HeuristicLab.Parameters-3.3.csproj">
    329       <Project>{56F9106A-079F-4C61-92F6-86A84C2D84B7}</Project>
    330       <Name>HeuristicLab.Parameters-3.3</Name>
    331       <Private>False</Private>
    332     </ProjectReference>
    333     <ProjectReference Include="..\..\HeuristicLab.Persistence\3.3\HeuristicLab.Persistence-3.3.csproj">
    334       <Project>{102BC7D3-0EF9-439C-8F6D-96FF0FDB8E1B}</Project>
    335       <Name>HeuristicLab.Persistence-3.3</Name>
    336       <Private>False</Private>
    337     </ProjectReference>
    338     <ProjectReference Include="..\..\HeuristicLab.PluginInfrastructure\3.3\HeuristicLab.PluginInfrastructure-3.3.csproj">
    339       <Project>{94186A6A-5176-4402-AE83-886557B53CCA}</Project>
    340       <Name>HeuristicLab.PluginInfrastructure-3.3</Name>
    341       <Private>False</Private>
    342     </ProjectReference>
    343     <ProjectReference Include="..\..\HeuristicLab.Problems.DataAnalysis\3.4\HeuristicLab.Problems.DataAnalysis-3.4.csproj">
    344       <Project>{DF87C13E-A889-46FF-8153-66DCAA8C5674}</Project>
    345       <Name>HeuristicLab.Problems.DataAnalysis-3.4</Name>
    346       <Private>False</Private>
    347     </ProjectReference>
    348     <ProjectReference Include="..\..\HeuristicLab.Problems.Instances\3.3\HeuristicLab.Problems.Instances-3.3.csproj">
    349       <Project>{3540E29E-4793-49E7-8EE2-FEA7F61C3994}</Project>
    350       <Name>HeuristicLab.Problems.Instances-3.3</Name>
    351       <Private>False</Private>
    352     </ProjectReference>
    353     <ProjectReference Include="..\..\HeuristicLab.Random\3.3\HeuristicLab.Random-3.3.csproj">
    354       <Project>{F4539FB6-4708-40C9-BE64-0A1390AEA197}</Project>
    355       <Name>HeuristicLab.Random-3.3</Name>
    356       <Private>False</Private>
    357     </ProjectReference>
    358   </ItemGroup>
    359344  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
    360345  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
  • branches/HeuristicLab.LinqExpressionTreeInterpreter/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/OpCodes.cs

    r12012 r12807  
    8383    public const byte Erf = 43;
    8484    public const byte Bessel = 44;
     85    public const byte UserDefinedFunction = 46;
    8586
    8687    private static Dictionary<Type, byte> symbolToOpcode = new Dictionary<Type, byte>() {
     
    110111      { typeof(Power),OpCodes.Power},
    111112      { typeof(Root),OpCodes.Root},
    112       { typeof(TimeLag), OpCodes.TimeLag}, 
     113      { typeof(TimeLag), OpCodes.TimeLag},
    113114      { typeof(Integral), OpCodes.Integral},
    114115      { typeof(Derivative), OpCodes.Derivative},
     
    130131      { typeof(Norm), OpCodes.Norm},
    131132      { typeof(Erf), OpCodes.Erf},
    132       { typeof(Bessel), OpCodes.Bessel}   
     133      { typeof(Bessel), OpCodes.Bessel},
     134      { typeof(FunctionSymbol), OpCodes.UserDefinedFunction }
    133135    };
    134136
Note: See TracChangeset for help on using the changeset viewer.