Changeset 11708


Ignore:
Timestamp:
12/20/14 19:22:32 (6 years ago)
Author:
gkronber
Message:

#2283: worked on bandits for grammatical optimization

Location:
branches/HeuristicLab.Problems.GrammaticalOptimization
Files:
11 added
6 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Problems.GrammaticalOptimization/GrammaticalOptimization.sln

    r11659 r11708  
    99EndProject
    1010Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Main", "Main\Main.csproj", "{524CBD70-6F99-46AF-AD00-A0BC9FD1175B}"
     11EndProject
     12Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Algorithms.Bandits", "HeuristicLab.Algorithms.Bandits\HeuristicLab.Algorithms.Bandits.csproj", "{24408F7D-EE0F-4886-A08B-EC324D662E47}"
    1113EndProject
    1214Global
     
    3234    {524CBD70-6F99-46AF-AD00-A0BC9FD1175B}.Release|Any CPU.ActiveCfg = Release|Any CPU
    3335    {524CBD70-6F99-46AF-AD00-A0BC9FD1175B}.Release|Any CPU.Build.0 = Release|Any CPU
     36    {24408F7D-EE0F-4886-A08B-EC324D662E47}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
     37    {24408F7D-EE0F-4886-A08B-EC324D662E47}.Debug|Any CPU.Build.0 = Debug|Any CPU
     38    {24408F7D-EE0F-4886-A08B-EC324D662E47}.Release|Any CPU.ActiveCfg = Release|Any CPU
     39    {24408F7D-EE0F-4886-A08B-EC324D662E47}.Release|Any CPU.Build.0 = Release|Any CPU
    3440  EndGlobalSection
    3541  GlobalSection(SolutionProperties) = preSolution
  • branches/HeuristicLab.Problems.GrammaticalOptimization/HeuristicLab.Algorithms.GrammaticalOptimization/ExhaustiveBreadthFirstSearch.cs

    r11690 r11708  
    1414
    1515    public ExhaustiveBreadthFirstSearch(int maxLen) {
    16       this.maxLen = maxLen;     
     16      this.maxLen = maxLen;
    1717    }
    1818
     
    4444        foreach (var alt in alts) {
    4545          var newPhrase = phrase.Remove(ntIdx, 1).Insert(ntIdx, alt);
    46           if (newPhrase.All(grammar.IsTerminal)) {
     46          if (newPhrase.All(grammar.IsTerminal) && newPhrase.Length <= maxLen) {
    4747            yield return newPhrase;
    4848          } else if (grammar.MinPhraseLength(newPhrase) <= maxLen) {
  • branches/HeuristicLab.Problems.GrammaticalOptimization/HeuristicLab.Algorithms.GrammaticalOptimization/ExhaustiveDepthFirstSearch.cs

    r11690 r11708  
    1414
    1515    public ExhaustiveDepthFirstSearch(int maxLen) {
    16       this.maxLen = maxLen;     
     16      this.maxLen = maxLen;
    1717    }
    1818
     
    4444        foreach (var alt in alts) {
    4545          var newPhrase = phrase.Remove(ntIdx, 1).Insert(ntIdx, alt);
    46           if (newPhrase.All(grammar.IsTerminal)) {
     46          if (newPhrase.All(grammar.IsTerminal) && newPhrase.Length <= maxLen) {
    4747            yield return newPhrase;
    4848          } else if (grammar.MinPhraseLength(newPhrase) <= maxLen) {
  • branches/HeuristicLab.Problems.GrammaticalOptimization/HeuristicLab.Problems.GrammaticalOptimization.Test/HeuristicLab.Problems.GrammaticalOptimization.Test.csproj

    r11659 r11708  
    5757  </Choose>
    5858  <ItemGroup>
     59    <Compile Include="TestBanditPolicies.cs" />
    5960    <Compile Include="TestInstances.cs" />
    6061    <Compile Include="Properties\AssemblyInfo.cs" />
     62    <Compile Include="TestSolvers.cs" />
    6163  </ItemGroup>
    6264  <ItemGroup>
     65    <ProjectReference Include="..\HeuristicLab.Algorithms.Bandits\HeuristicLab.Algorithms.Bandits.csproj">
     66      <Project>{24408f7d-ee0f-4886-a08b-ec324d662e47}</Project>
     67      <Name>HeuristicLab.Algorithms.Bandits</Name>
     68    </ProjectReference>
     69    <ProjectReference Include="..\HeuristicLab.Algorithms.GrammaticalOptimization\HeuristicLab.Algorithms.GrammaticalOptimization.csproj">
     70      <Project>{eea07488-1a51-412a-a52c-53b754a628b3}</Project>
     71      <Name>HeuristicLab.Algorithms.GrammaticalOptimization</Name>
     72    </ProjectReference>
    6373    <ProjectReference Include="..\HeuristicLab.Problems.GrammaticalOptimization\HeuristicLab.Problems.GrammaticalOptimization.csproj">
    6474      <Project>{cb9dccf6-667e-4a13-b82d-dbd6b45a045e}</Project>
  • branches/HeuristicLab.Problems.GrammaticalOptimization/HeuristicLab.Problems.GrammaticalOptimization/SantaFeAntProblem.cs

    r11659 r11708  
    99    private const string grammarString = @"
    1010G(A):
    11 A -> l | r | m | ?(A)(A) | AA | AAA
     11A -> l | r | m | ?(A)(A) | lA | rA | mA
    1212";
     13    // original koza grammar
    1314    // Ant -> left | right | move | if-food-ahead Ant Ant | Ant Ant | Ant Ant Ant
     15    //
     16    // here we use a modified grammar which has only one syntax tree for each sentence
    1417
    1518
  • branches/HeuristicLab.Problems.GrammaticalOptimization/HeuristicLab.Problems.GrammaticalOptimization/SymbolicRegressionPoly10Problem.cs

    r11659 r11708  
    88namespace HeuristicLab.Problems.GrammaticalOptimization {
    99  public class SymbolicRegressionPoly10Problem : IProblem {
    10     // length of the longest palindrome in the sentence + number of different symbols occurring in the palindrome
    1110    private const string grammarString = @"
    1211G(E):
     
    1413V -> a .. j
    1514";
     15
    1616
    1717    private readonly IGrammar grammar;
Note: See TracChangeset for help on using the changeset viewer.