- Timestamp:
- 12/29/08 08:06:58 (16 years ago)
- Location:
- branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Server
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Server/Dispatcher.cs
r1060 r1072 64 64 .GroupBy(t => (int)((Literal)t.Property).Value); 65 65 foreach (var targetVariable in targetVariableStatements) { 66 numberOfModelsOfTargetVariableOfDataSet[datasetStatement.Subject].Add(targetVariable.Key, targetVariable.Count()); 66 if (numberOfModelsOfTargetVariableOfDataSet[datasetStatement.Subject].ContainsKey(targetVariable.Key)) { 67 numberOfModelsOfTargetVariableOfDataSet[datasetStatement.Subject][targetVariable.Key] = targetVariable.Count(); 68 } else { 69 numberOfModelsOfTargetVariableOfDataSet[datasetStatement.Subject].Add(targetVariable.Key, targetVariable.Count()); 70 } 67 71 } 68 72 } … … 87 91 public Execution GetNextJob() { 88 92 if (dispatchQueue.Count == 0) FillDispatchQueue(); 89 Execution next = dispatchQueue[0]; 90 dispatchQueue.RemoveAt(0); 91 return next; 93 if (dispatchQueue.Count > 0) { 94 Execution next = dispatchQueue[0]; 95 dispatchQueue.RemoveAt(0); 96 return next; 97 } else 98 return null; 92 99 } 93 100 … … 113 120 StandardGP sgp = new StandardGP(); 114 121 sgp.SetSeedRandomly = true; 115 sgp.MaxGenerations = 1 00;116 sgp.PopulationSize = 1000 0;122 sgp.MaxGenerations = 1; 123 sgp.PopulationSize = 1000; 117 124 sgp.Elites = 1; 118 125 sgp.ProblemInjector = probInjector; -
branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Server/Executer.cs
r1060 r1072 69 69 // get an execution from the dispatcher and execute in grid via job-manager 70 70 Execution execution = dispatcher.GetNextJob(); 71 AtomicOperation op = new AtomicOperation(execution.Engine.OperatorGraph.InitialOperator, execution.Engine.GlobalScope); 72 WaitHandle opWh = jobManager.BeginExecuteOperation(execution.Engine.GlobalScope, op); 73 wh.Add(opWh); 74 activeOperations.Add(opWh, op); 71 if (execution != null) { 72 AtomicOperation op = new AtomicOperation(execution.Engine.OperatorGraph.InitialOperator, execution.Engine.GlobalScope); 73 WaitHandle opWh = jobManager.BeginExecuteOperation(execution.Engine.GlobalScope, op); 74 wh.Add(opWh); 75 activeOperations.Add(opWh, op); 76 activeExecutions.Add(opWh, execution); 77 } 75 78 } 76 79 // wait until any job is finished … … 90 93 } 91 94 if (finishedEngine != null) { 92 Entity modelEntity = new Entity(Ontology.CedmaNameSpace+Guid.NewGuid()); 93 store.Add(new Statement(modelEntity, Ontology.PredicateInstanceOf, Ontology.TypeGeneticProgrammingFunctionTree)); 94 Entity targetVariableAttr = new Entity(Ontology.CedmaNameSpace+Guid.NewGuid()); 95 store.Add(new Statement(modelEntity, Ontology.PredicateModelAttribute, targetVariableAttr)); 96 store.Add(new Statement(targetVariableAttr, Ontology.PredicateModelAttributeName, new Literal("TargetVariable"))); 97 store.Add(new Statement(targetVariableAttr, Ontology.PredicateModelAttributeValue, new Literal(finishedExecution.TargetVariable))); 98 store.Add(new Statement(targetVariableAttr, Ontology.PredicateModelAttributeType, Ontology.TypeCategoricalAttribute)); 99 store.Add(new Statement(finishedExecution.DataSetEntity, Ontology.PredicateHasModel, modelEntity)); 95 StoreResults(finishedExecution, finishedEngine); 100 96 } 101 97 } … … 105 101 } 106 102 } 103 104 private void StoreResults(Execution finishedExecution, ProcessingEngine finishedEngine) { 105 Entity modelEntity = new Entity(Ontology.CedmaNameSpace + Guid.NewGuid()); 106 store.Add(new Statement(modelEntity, Ontology.PredicateInstanceOf, Ontology.TypeGeneticProgrammingFunctionTree)); 107 store.Add(new Statement(finishedExecution.DataSetEntity, Ontology.PredicateHasModel, modelEntity)); 108 Entity targetVariableAttr = new Entity(Ontology.CedmaNameSpace + Guid.NewGuid()); 109 store.Add(new Statement(modelEntity, Ontology.PredicateModelAttribute, targetVariableAttr)); 110 store.Add(new Statement(targetVariableAttr, Ontology.PredicateModelAttributeName, new Literal("TargetVariable"))); 111 store.Add(new Statement(targetVariableAttr, Ontology.PredicateModelAttributeValue, new Literal(finishedExecution.TargetVariable))); 112 store.Add(new Statement(targetVariableAttr, Ontology.PredicateModelAttributeType, Ontology.TypeCategoricalAttribute)); 113 114 Scope bestModelScope = finishedEngine.GlobalScope.GetVariableValue<Scope>("BestValidationSolution", false); 115 double validationMape = bestModelScope.GetVariableValue<DoubleData>("ValidationMAPE", false).Data; 116 Entity validationMapeAttr = new Entity(Ontology.CedmaNameSpace + Guid.NewGuid()); 117 store.Add(new Statement(modelEntity, Ontology.PredicateModelAttribute, validationMapeAttr)); 118 store.Add(new Statement(validationMapeAttr, Ontology.PredicateModelAttributeName, new Literal("ValidationMeanAbsolutePercentageError"))); 119 store.Add(new Statement(validationMapeAttr, Ontology.PredicateModelAttributeValue, new Literal(validationMape))); 120 store.Add(new Statement(validationMapeAttr, Ontology.PredicateModelAttributeType, Ontology.TypeOrdinalAttribute)); 121 } 107 122 } 108 123 }
Note: See TracChangeset
for help on using the changeset viewer.