- Timestamp:
- 04/10/13 13:29:24 (12 years ago)
- Location:
- branches/OaaS/HeuristicLab.Services.Optimization.Controller
- Files:
-
- 6 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/OaaS/HeuristicLab.Services.Optimization.Controller/HL/HiveScenarioManager.cs
r9324 r9350 21 21 using System.Data; 22 22 using HeuristicLab.Services.Optimization.ControllerService.General; 23 using HeuristicLab.Services.Optimization.ControllerService.Parameters.HL; 23 24 24 25 namespace HeuristicLab.Services.Optimization.ControllerService { 25 public class ScenarioEntity : TableServiceEntity { 26 26 public class ScenarioEntity : TableServiceEntity { 27 27 public ScenarioEntity() { 28 28 } … … 41 41 42 42 public class HiveScenarioManager : IScenarioManager { 43 private static HLParameterMapper parameterMapper = new HLParameterMapper(); 43 44 private static IScenarioMapper tspMapper; 44 45 private static object lockable; … … 297 298 var value = run.Results[key]; 298 299 Parameter result = MapHiveDataType(key, value); 299 resultValues.Add(result); 300 resultValues.Add(result); 300 301 } 301 302 taskRun.Results = resultValues; 303 IList<Parameter> inputParameters = new List<Model.Parameter>(); 304 foreach (var key in run.Parameters.Keys) { 305 var value = run.Parameters[key]; 306 Parameter param = MapHiveDataType(key, value); 307 inputParameters.Add(param); 308 } 309 // crawl the copied experiment of the job 310 //taskRun.Experiment = dal.JobDao.FindByJobId(id); 311 taskRun.InputParameters = inputParameters; 302 312 runs.Add(taskRun); 303 313 } … … 310 320 311 321 private Parameter MapHiveDataType(string name, IItem item) { 312 Parameter result = new Parameter(); 322 323 if (parameterMapper.IsHandlerAvailable(item)) { 324 return parameterMapper.Map(name, item); 325 } 326 327 var result = new Parameter(); 313 328 result.Type = ParameterType.String; 314 329 //TODO: How shall we handle dll specific datatypes? … … 349 364 matrixValue[i][j] = matrix[j, i]; 350 365 } 351 } 366 } 367 matrixValue = transpose(matrixValue); 352 368 result.Value = new HeuristicLab.Services.Optimization.ControllerService.Model.DecimalMatrix() { Name = name, Value = matrixValue, RowNames = (matrix.ColumnNames.Count() > 0 ? matrix.ColumnNames.ToArray() : null) }; 353 369 } … … 408 424 } 409 425 else { 410 result.Value = new HeuristicLab.Services.Optimization.ControllerService.Model.StringValue() { Name = name, Value = "Cannot be displayedas string" };426 result.Value = new HeuristicLab.Services.Optimization.ControllerService.Model.StringValue() { Name = name, Value = item.ItemName != null ? item.ItemName + " (Cannot be displayed properly as string)" : "Cannot be displayed properly as string" }; 411 427 } 412 428 // TODO: Add workaround for TSP -
branches/OaaS/HeuristicLab.Services.Optimization.Controller/HeuristicLab.Services.Optimization.ControllerService.csproj
r9305 r9350 179 179 <Compile Include="Mockup\MockupDAL.cs" /> 180 180 <Compile Include="Mockup\MockupScenarioManager.cs" /> 181 <Compile Include="Parameters\HL\HLParameterHandler.cs" /> 182 <Compile Include="Parameters\HL\PathTSPParameterHandler.cs" /> 183 <Compile Include="Parameters\HL\PermutationTypeHandler.cs" /> 184 <Compile Include="Parameters\ParameterHandler.cs" /> 181 185 <Compile Include="Parsers\AlgorithmConverter.cs" /> 182 186 <Compile Include="PlaceholderControllerService.cs" /> -
branches/OaaS/HeuristicLab.Services.Optimization.Controller/Interfaces/DAL.cs
r9324 r9350 39 39 IScenarioDao ScenarioDao { get; } 40 40 IBlobDao BlobDao { get; } 41 IExperimentDao ExperimentDao { get; } 41 IExperimentDao ExperimentDao { get; } 42 42 } 43 43 -
branches/OaaS/HeuristicLab.Services.Optimization.Controller/Interfaces/Model/ControllerModel.cs
r9305 r9350 480 480 [DataMember] 481 481 public IList<Parameter> Results { get; set; } 482 483 [DataMember] 484 public IList<Parameter> InputParameters { get; set; } 482 485 } 483 486 -
branches/OaaS/HeuristicLab.Services.Optimization.Controller/Mockup/MockupDAL.cs
r9215 r9350 253 253 } 254 254 } 255 256 255 } 257 256 } -
branches/OaaS/HeuristicLab.Services.Optimization.Controller/Parsers/AlgorithmConverter.cs
r9324 r9350 189 189 jrun["name"] = run.Name; 190 190 jrun["results"] = ConvertParametersToJson(run.Results); 191 jrun["params"] = ConvertParametersToJson(run.InputParameters); 191 192 return jrun; 192 193 } … … 196 197 foreach (var run in runs) 197 198 jarray.Add(ConvertRunToJson(run)); 199 200 201 // if there are multiple different jobs to execute and they have the same id, we must change it here manually 202 var maxId = new Dictionary<string,int>(); 203 for (int i = 0; i < jarray.Count; i++) { 204 for (int j = i + 1; j < jarray.Count; j++) { 205 if (jarray[i]["id"].ToString() == jarray[j]["id"].ToString()) { 206 int max; 207 if (!maxId.TryGetValue(jarray[i]["id"].ToString(), out max)) { 208 max = 1; 209 maxId[jarray[i]["id"].ToString()] = max; 210 } 211 maxId[jarray[i]["id"].ToString()]++; 212 // change j's entry 213 jarray[j]["id"] = jarray[j]["id"].ToString() + " (" + max + ")"; 214 jarray[j]["name"] = jarray[j]["name"] + " (" + max + ")"; 215 } 216 } 217 } 198 218 return jarray; 199 219 }
Note: See TracChangeset
for help on using the changeset viewer.