Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/10/13 13:29:24 (12 years ago)
Author:
fschoepp
Message:

#1888:

  • Added input parameters to the run class. They will be populated by the back-end and returned to the web pages which renders them.
  • Added a ParameterMapper class which converts HL specific model classes to OaaS independent classes. The conversion gets delegated to IParameterHandler which have to be implemented manually and registered for a certain Type before. All parameters which can be converted to IStringConvertible, IStringConvertibleMatrix, IString* will be converted into a OaaS-StringValue instance.
  • Added IParameterHandlers for PathTSPTour and PermutationType (required for TSP).
  • AlgorithmConverter now makes sure that the id of a run is unique. (All runs of a RunList will be shown now.)
  • Web pages are capable of rendering both the results of a run and their input parameters (added a accordion to wrap their content).
  • Renamed "Traveling Salesman Problem" to "Genetic Algorithm - TSP".
  • Changed js-files to render both input and result parameters of a Run.
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  
    2121using System.Data;
    2222using HeuristicLab.Services.Optimization.ControllerService.General;
     23using HeuristicLab.Services.Optimization.ControllerService.Parameters.HL;
    2324
    2425namespace HeuristicLab.Services.Optimization.ControllerService {
    25   public class ScenarioEntity : TableServiceEntity {
    26 
     26  public class ScenarioEntity : TableServiceEntity {   
    2727    public ScenarioEntity() {
    2828    }
     
    4141
    4242  public class HiveScenarioManager : IScenarioManager {
     43    private static HLParameterMapper parameterMapper = new HLParameterMapper();
    4344    private static IScenarioMapper tspMapper;
    4445    private static object lockable;
     
    297298              var value = run.Results[key];             
    298299              Parameter result = MapHiveDataType(key, value);
    299               resultValues.Add(result);
     300              resultValues.Add(result);             
    300301            }
    301302            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;
    302312            runs.Add(taskRun);
    303313          }
     
    310320   
    311321    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();
    313328      result.Type = ParameterType.String;
    314329      //TODO: How shall we handle dll specific datatypes?     
     
    349364            matrixValue[i][j] = matrix[j, i];
    350365          }
    351         }       
     366        }
     367        matrixValue = transpose(matrixValue);
    352368        result.Value = new HeuristicLab.Services.Optimization.ControllerService.Model.DecimalMatrix() { Name = name, Value = matrixValue, RowNames = (matrix.ColumnNames.Count() > 0 ? matrix.ColumnNames.ToArray() : null) };
    353369      }
     
    408424      }
    409425      else {
    410         result.Value = new HeuristicLab.Services.Optimization.ControllerService.Model.StringValue() { Name = name, Value = "Cannot be displayed as 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" };
    411427      }
    412428      // TODO: Add workaround for TSP
  • branches/OaaS/HeuristicLab.Services.Optimization.Controller/HeuristicLab.Services.Optimization.ControllerService.csproj

    r9305 r9350  
    179179    <Compile Include="Mockup\MockupDAL.cs" />
    180180    <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" />
    181185    <Compile Include="Parsers\AlgorithmConverter.cs" />
    182186    <Compile Include="PlaceholderControllerService.cs" />
  • branches/OaaS/HeuristicLab.Services.Optimization.Controller/Interfaces/DAL.cs

    r9324 r9350  
    3939    IScenarioDao ScenarioDao { get; }
    4040    IBlobDao BlobDao { get; }
    41     IExperimentDao ExperimentDao { get; }   
     41    IExperimentDao ExperimentDao { get; }
    4242  }
    4343
  • branches/OaaS/HeuristicLab.Services.Optimization.Controller/Interfaces/Model/ControllerModel.cs

    r9305 r9350  
    480480    [DataMember]
    481481    public IList<Parameter> Results { get; set; }
     482
     483    [DataMember]
     484    public IList<Parameter> InputParameters { get; set; }
    482485  }
    483486
  • branches/OaaS/HeuristicLab.Services.Optimization.Controller/Mockup/MockupDAL.cs

    r9215 r9350  
    253253      }     
    254254    }
    255 
    256255  }
    257256}
  • branches/OaaS/HeuristicLab.Services.Optimization.Controller/Parsers/AlgorithmConverter.cs

    r9324 r9350  
    189189      jrun["name"] = run.Name;
    190190      jrun["results"] = ConvertParametersToJson(run.Results);
     191      jrun["params"] = ConvertParametersToJson(run.InputParameters);
    191192      return jrun;
    192193    }
     
    196197      foreach (var run in runs)
    197198        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      }
    198218      return jarray;
    199219    }
Note: See TracChangeset for help on using the changeset viewer.