Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/22/08 18:24:33 (16 years ago)
Author:
gkronber
Message:

added problem injector for CEDMA problems and to create standard GP runs in the CEDMA dispatcher. #419 (Refactor CEDMA plugins)

Location:
branches/CEDMA-Refactoring-Ticket419
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Core/HeuristicLab.CEDMA.Core.csproj

    r992 r1053  
    9999    </Compile>
    100100    <Compile Include="Properties\AssemblyInfo.cs" />
     101    <Compile Include="ProblemInjector.cs" />
    101102  </ItemGroup>
    102103  <ItemGroup>
     
    119120      <Project>{7DD3A97A-56E9-462F-90E2-A351FE7AF5C2}</Project>
    120121      <Name>HeuristicLab.DataAnalysis</Name>
     122    </ProjectReference>
     123    <ProjectReference Include="..\HeuristicLab.Data\HeuristicLab.Data.csproj">
     124      <Project>{F473D9AF-3F09-4296-9F28-3C65118DAFFA}</Project>
     125      <Name>HeuristicLab.Data</Name>
    121126    </ProjectReference>
    122127    <ProjectReference Include="..\HeuristicLab.Operators\HeuristicLab.Operators.csproj">
  • branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Server/Dispatcher.cs

    r1044 r1053  
    3232using System.Linq;
    3333using HeuristicLab.CEDMA.Core;
     34using HeuristicLab.GP.StructureIdentification;
     35using HeuristicLab.Data;
    3436
    3537namespace HeuristicLab.CEDMA.Server {
    3638  public class Dispatcher {
    37     private List<string> dispatchQueue;
     39    private List<StandardGP> dispatchQueue;
    3840    public IList<string> DispatchQueue {
    39       get { return dispatchQueue.AsReadOnly(); }
     41      get { return dispatchQueue.Select(t => "StandardGP").ToList(); }
    4042    }
    4143
     
    4446    public Dispatcher(IStore store) {
    4547      this.store = store;
    46       this.dispatchQueue = new List<string>();
     48      this.dispatchQueue = new List<StandardGP>();
    4749    }
    4850
     
    5052      Dictionary<Entity, Dictionary<int, int>> numberOfModelsOfTargetVariableOfDataSet = new Dictionary<Entity, Dictionary<int, int>>();
    5153      IList<Statement> datasetStatements = store.Select(new Statement(Ontology.AnyEntity, Ontology.PredicateInstanceOf, Ontology.TypeDataSet));
    52       foreach (Statement datasetStatement in datasetStatements) {
     54      foreach(Statement datasetStatement in datasetStatements) {
    5355        numberOfModelsOfTargetVariableOfDataSet.Add(datasetStatement.Subject, new Dictionary<int, int>());
    5456        IList<Statement> modelStatements = store.Select(new Statement(datasetStatement.Subject, Ontology.PredicateHasModel, Ontology.AnyEntity));
    55         foreach (Statement modelStatement in modelStatements) {
     57        foreach(Statement modelStatement in modelStatements) {
    5658          IList<Statement> modelAttributeStatements = store.Select(new Statement((Entity)modelStatement.Property, Ontology.PredicateModelAttribute, Ontology.AnyEntity));
    57           foreach (Statement modelAttrStatement in modelAttributeStatements) {
     59          foreach(Statement modelAttrStatement in modelAttributeStatements) {
    5860            var targetVariableStatements = store.Select(new Statement((Entity)modelAttrStatement.Property, Ontology.PredicateModelAttributeName, Ontology.AnyEntity))
    5961               .Where(t => (string)((Literal)t.Property).Value == "TargetVariable")
    6062               .SelectMany(t => store.Select(new Statement((Entity)modelAttrStatement.Property, Ontology.PredicateModelAttributeValue, Ontology.AnyEntity)))
    6163               .GroupBy(t => (int)((Literal)t.Property).Value);
    62             foreach (var targetVariable in targetVariableStatements) {
     64            foreach(var targetVariable in targetVariableStatements) {
    6365              numberOfModelsOfTargetVariableOfDataSet[datasetStatement.Subject].Add(targetVariable.Key, targetVariable.Count());
    6466            }
     
    6971        DataSet dataSet = new DataSet(store, dataSetEntry.Key);
    7072        foreach(int targetVariable in dataSet.Problem.AllowedTargetVariables)
    71           if (!dataSetEntry.Value.ContainsKey(targetVariable) || dataSetEntry.Value[targetVariable] < 10) {
    72             QueueJob(dataSet.Name + " - target variable: " + targetVariable);
     73          if(!dataSetEntry.Value.ContainsKey(targetVariable) || dataSetEntry.Value[targetVariable] < 10) {
     74            QueueJob(CreateStandardGp(dataSet, targetVariable));
    7375          }
    7476      }
    7577    }
    7678
    77     private void QueueJob(string job) {
     79    private StandardGP CreateStandardGp(DataSet dataSet, int targetVariable) {
     80      ProblemInjector probInjector = new ProblemInjector(dataSet.Problem);
     81      probInjector.TargetVariable = targetVariable;
     82      StandardGP sgp = new StandardGP();
     83      sgp.SetSeedRandomly = true;
     84      sgp.MaxGenerations = 100;
     85      sgp.PopulationSize = 10000;
     86      sgp.Elites = 1;
     87      sgp.ProblemInjector = probInjector;
     88      return sgp;
     89    }
     90
     91    private void QueueJob(StandardGP job) {
    7892      dispatchQueue.Add(job);
    7993    }
    8094
    81     private string GetNextJob() {
    82       if (dispatchQueue.Count == 0) FillDispatchQueue();
    83       string next = dispatchQueue[0];
     95    private StandardGP GetNextJob() {
     96      if(dispatchQueue.Count == 0) FillDispatchQueue();
     97      StandardGP next = dispatchQueue[0];
    8498      dispatchQueue.RemoveAt(0);
    8599      return next;
  • branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Server/HeuristicLab.CEDMA.Server.csproj

    r1044 r1053  
    108108      <Name>HeuristicLab.Data</Name>
    109109    </ProjectReference>
     110    <ProjectReference Include="..\HeuristicLab.GP.StructureIdentification\HeuristicLab.GP.StructureIdentification.csproj">
     111      <Project>{74223A32-C726-4978-BE78-37113A18373C}</Project>
     112      <Name>HeuristicLab.GP.StructureIdentification</Name>
     113    </ProjectReference>
    110114    <ProjectReference Include="..\HeuristicLab.Grid\HeuristicLab.Grid.csproj">
    111115      <Project>{545CE756-98D8-423B-AC2E-6E7D70926E5C}</Project>
Note: See TracChangeset for help on using the changeset viewer.