Changeset 1053 for branches/CEDMA-Refactoring-Ticket419
- Timestamp:
- 12/22/08 18:24:33 (16 years ago)
- 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 99 99 </Compile> 100 100 <Compile Include="Properties\AssemblyInfo.cs" /> 101 <Compile Include="ProblemInjector.cs" /> 101 102 </ItemGroup> 102 103 <ItemGroup> … … 119 120 <Project>{7DD3A97A-56E9-462F-90E2-A351FE7AF5C2}</Project> 120 121 <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> 121 126 </ProjectReference> 122 127 <ProjectReference Include="..\HeuristicLab.Operators\HeuristicLab.Operators.csproj"> -
branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Server/Dispatcher.cs
r1044 r1053 32 32 using System.Linq; 33 33 using HeuristicLab.CEDMA.Core; 34 using HeuristicLab.GP.StructureIdentification; 35 using HeuristicLab.Data; 34 36 35 37 namespace HeuristicLab.CEDMA.Server { 36 38 public class Dispatcher { 37 private List< string> dispatchQueue;39 private List<StandardGP> dispatchQueue; 38 40 public IList<string> DispatchQueue { 39 get { return dispatchQueue. AsReadOnly(); }41 get { return dispatchQueue.Select(t => "StandardGP").ToList(); } 40 42 } 41 43 … … 44 46 public Dispatcher(IStore store) { 45 47 this.store = store; 46 this.dispatchQueue = new List< string>();48 this.dispatchQueue = new List<StandardGP>(); 47 49 } 48 50 … … 50 52 Dictionary<Entity, Dictionary<int, int>> numberOfModelsOfTargetVariableOfDataSet = new Dictionary<Entity, Dictionary<int, int>>(); 51 53 IList<Statement> datasetStatements = store.Select(new Statement(Ontology.AnyEntity, Ontology.PredicateInstanceOf, Ontology.TypeDataSet)); 52 foreach 54 foreach(Statement datasetStatement in datasetStatements) { 53 55 numberOfModelsOfTargetVariableOfDataSet.Add(datasetStatement.Subject, new Dictionary<int, int>()); 54 56 IList<Statement> modelStatements = store.Select(new Statement(datasetStatement.Subject, Ontology.PredicateHasModel, Ontology.AnyEntity)); 55 foreach 57 foreach(Statement modelStatement in modelStatements) { 56 58 IList<Statement> modelAttributeStatements = store.Select(new Statement((Entity)modelStatement.Property, Ontology.PredicateModelAttribute, Ontology.AnyEntity)); 57 foreach 59 foreach(Statement modelAttrStatement in modelAttributeStatements) { 58 60 var targetVariableStatements = store.Select(new Statement((Entity)modelAttrStatement.Property, Ontology.PredicateModelAttributeName, Ontology.AnyEntity)) 59 61 .Where(t => (string)((Literal)t.Property).Value == "TargetVariable") 60 62 .SelectMany(t => store.Select(new Statement((Entity)modelAttrStatement.Property, Ontology.PredicateModelAttributeValue, Ontology.AnyEntity))) 61 63 .GroupBy(t => (int)((Literal)t.Property).Value); 62 foreach 64 foreach(var targetVariable in targetVariableStatements) { 63 65 numberOfModelsOfTargetVariableOfDataSet[datasetStatement.Subject].Add(targetVariable.Key, targetVariable.Count()); 64 66 } … … 69 71 DataSet dataSet = new DataSet(store, dataSetEntry.Key); 70 72 foreach(int targetVariable in dataSet.Problem.AllowedTargetVariables) 71 if 72 QueueJob( dataSet.Name + " - target variable: " + targetVariable);73 if(!dataSetEntry.Value.ContainsKey(targetVariable) || dataSetEntry.Value[targetVariable] < 10) { 74 QueueJob(CreateStandardGp(dataSet, targetVariable)); 73 75 } 74 76 } 75 77 } 76 78 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) { 78 92 dispatchQueue.Add(job); 79 93 } 80 94 81 private stringGetNextJob() {82 if 83 stringnext = dispatchQueue[0];95 private StandardGP GetNextJob() { 96 if(dispatchQueue.Count == 0) FillDispatchQueue(); 97 StandardGP next = dispatchQueue[0]; 84 98 dispatchQueue.RemoveAt(0); 85 99 return next; -
branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Server/HeuristicLab.CEDMA.Server.csproj
r1044 r1053 108 108 <Name>HeuristicLab.Data</Name> 109 109 </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> 110 114 <ProjectReference Include="..\HeuristicLab.Grid\HeuristicLab.Grid.csproj"> 111 115 <Project>{545CE756-98D8-423B-AC2E-6E7D70926E5C}</Project>
Note: See TracChangeset
for help on using the changeset viewer.