Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/21/09 16:14:40 (15 years ago)
Author:
gkronber
Message:

Added new predefined function libraries for symbolic regression algorithms. Changed CEDMA dispatcher to choose a function library randomly. #813 (GP structure-identification algorithms that use only a simple function library)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.CEDMA.Server/3.3/SimpleDispatcher.cs

    r2440 r2566  
    3434using HeuristicLab.Modeling.Database;
    3535using HeuristicLab.DataAnalysis;
     36using HeuristicLab.GP.Interfaces;
     37using HeuristicLab.GP;
     38using HeuristicLab.GP.StructureIdentification;
    3639
    3740namespace HeuristicLab.CEDMA.Server {
     
    196199      }
    197200      algo.AllowedVariables = allowedFeatures;
     201
     202      IGeneticProgrammingAlgorithm structIdAlgo = algo as IGeneticProgrammingAlgorithm;
     203      if (structIdAlgo != null) {
     204        var funLib = SelectRandomFunctionLibrary();
     205        structIdAlgo.FunctionLibraryInjector = funLib;
     206      }
     207    }
     208
     209    private IOperator SelectRandomFunctionLibrary() {
     210      DiscoveryService ds = new DiscoveryService();
     211      var injectors = from injector in ds.GetInstances<FunctionLibraryInjectorBase>()
     212                      where injector.GetType().GetCustomAttributes(typeof(SymbolicRegressionFunctionLibraryInjectorAttribute), true).Count() > 0
     213                      select injector;
     214
     215      return injectors.ElementAt(random.Next(injectors.Count()));
    198216    }
    199217
Note: See TracChangeset for help on using the changeset viewer.