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.
File:
1 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
Note: See TracChangeset for help on using the changeset viewer.