Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/15/13 15:50:53 (12 years ago)
Author:
fschoepp
Message:

#1888:

  • Model: OptimizationScenario may be a tree of algorithms (and problems)
  • Model: Renamed InputParameters to ProblemParameters (as they are the parameters of a problem)
  • Model: Added JobExecutionDetails which contain Repetitions + Group (resource to use)
  • ScenarioParser parses the new XML scenario files
  • Website + Model: You are now able to add/remove rows from a table (no JavaScript involved yet)
  • Website + Controller: Added repetitions (enables batch jobs) and group (resource to use) to OaaS which will be used by the controller to schedule the job
  • Website: Updated templates to use new model structure
  • Website + Scenarios: Added the new algorithm Benchmark Algorithm
  • Controller: Added a singleton to make the (Azure/Mockup)-DAL exchangeable
  • Controller: Added mockup classes for DAL + IScenarioManager
  • Website/Result Page: Line Diagrams will be added via JavaScript, crawling their data using AJAX
  • Website: Most configuration parameters can be set in the ServiceDefinition directly
  • Added a mockup for the Membership classes: These can be used if no network connection is available or if other parts of the app shall be tested
  • Scenarios: Updated TSP mappings to new xsd
Location:
branches/OaaS/HeuristicLab.Services.Optimization.Controller
Files:
5 added
1 deleted
11 edited

Legend:

Unmodified
Added
Removed
  • branches/OaaS/HeuristicLab.Services.Optimization.Controller/Azure/DAL.cs

    r8958 r9166  
    66using Microsoft.WindowsAzure;
    77using Microsoft.WindowsAzure.StorageClient;
     8using Microsoft.WindowsAzure.ServiceRuntime;
     9using System.Diagnostics;
    810
    911namespace HeuristicLab.Services.Optimization.ControllerService.Azure {
     
    98100      get {
    99101        if (storageAccount == null) {
    100           storageAccount = CloudStorageAccount.Parse(CloudConfigurationManager.GetSetting(AzureConstants.CLOUD_SETTINGS_KEY));
     102          try {
     103            storageAccount = CloudStorageAccount.Parse(CloudConfigurationManager.GetSetting(AzureConstants.CLOUD_SETTINGS_KEY));
     104          }
     105          catch (Exception ex) {
     106            Trace.WriteLine(ex.Message);
     107            storageAccount = CloudStorageAccount.Parse("DefaultEndpointsProtocol=https;AccountName=optimizationstorage1;AccountKey=n7Leom8ZFWkof/VQ2a4aRSvwOlX+Gwr3uojQF9CFJw1osmGCV0WwaNC8s7nkZ+qteLduAgW2l75WFpbXrkvG4Q==");
     108          }
    101109        }
    102110        return storageAccount;
  • branches/OaaS/HeuristicLab.Services.Optimization.Controller/HL/HLMapper.cs

    r8958 r9166  
    1111namespace HeuristicLab.Services.Optimization.ControllerService {
    1212  public interface IScenarioMapper {
    13     void MapScenario(OptimizationScenario scenario, IAlgorithm algorithm);
     13    void MapScenario(OptimizationScenario scenario, out IAlgorithm algorithm);
    1414  }
    1515
     
    1818      var dv = parameter.Value as DecimalValue;
    1919      return new DoubleValue(dv.Value);     
     20    }
     21
     22    public static T Create<T>(Parameter typeParameter) {
     23      var type = Type.GetType((typeParameter.Value as TypeValue).Value);     
     24      return (T)Activator.CreateInstance(type, null);
    2025    }
    2126
  • branches/OaaS/HeuristicLab.Services.Optimization.Controller/HL/HiveMapper.cs

    r8958 r9166  
    77namespace HeuristicLab.Services.Optimization.ControllerService.Model {
    88  public static class HiveMapper {   
    9     public static double FindDoubleValue(this InputParameters ip, string what) {     
     9    public static double FindDoubleValue(this ProblemParameters ip, string what) {     
    1010      foreach (var param in ip.Items) {
    1111        if (param.Value.Name == what) {
  • branches/OaaS/HeuristicLab.Services.Optimization.Controller/HL/HiveScenarioManager.cs

    r9062 r9166  
    2020using HeuristicLab.Services.Optimization.ControllerService.Azure;
    2121using System.Data;
     22using HeuristicLab.Services.Optimization.ControllerService.General;
    2223
    2324namespace HeuristicLab.Services.Optimization.ControllerService {
     
    4344    private static object lockable;
    4445    private Dictionary<string, IScenarioMapper> mappers = new Dictionary<string, IScenarioMapper>();
    45     private IDataAccessLayer dal = new AzureDataAccessLayer();
     46    private IDataAccessLayer dal = DataAccessLayerProvider.GetLayer();
    4647
    4748    public static readonly string SCENARIO_TABLE = "Scenario";
     
    5152    }
    5253
    53     public void DispatchScenario(Model.User user, Model.OptimizationScenario scenario) {
    54       Experiment experiment = new Experiment();
    55       var problem = new TravelingSalesmanProblem();
    56       var algo = new GeneticAlgorithm();
    57       algo.Problem = problem;     
     54    public void DispatchScenario(Model.User user, Model.OptimizationScenario scenario, JobExecutionDetails details) {
     55      // Experiment experiment = new Experiment();
     56      // var problem = new TravelingSalesmanProblem();
     57      // var algo = new GeneticAlgorithm();
     58      // algo.Problem = problem;     
    5859     
    5960      IScenarioMapper mapper = GetMapper(scenario);
    60       mapper.MapScenario(scenario, algo); 
    61 
    62       //experiment.Optimizers.Add(algo);
    63       SendExperimentToHive(user, algo);
     61      IAlgorithm algo;
     62      mapper.MapScenario(scenario, out algo);
     63      if (details.Repititions > 1) {
     64        BatchRun br = new BatchRun();
     65        //br.Name = details.JobTitle;
     66        br.Optimizer = algo;       
     67        br.Repetitions = details.Repititions;
     68        SendExperimentToHive(user, br, details);
     69      }
     70      else {       
     71        SendExperimentToHive(user, algo, details);
     72      }
    6473    }
    6574
     
    7382    }
    7483
    75     private IScenarioMapper CompileMapper(string scenarioMapper) {
     84    public static IScenarioMapper CompileMapper(string scenarioMapper) {
    7685       // http://stackoverflow.com/questions/3188882/compile-and-run-dynamic-code-without-generating-exe
    7786      using (var csCodeProvider = new Microsoft.CSharp.CSharpCodeProvider()) {
     
    105114
    106115    private IScenarioMapper GetMapper(Model.OptimizationScenario scenario) {
    107       if (!mappers.ContainsKey(scenario.Name)) {
     116      var id = scenario.Id;
     117      if (!mappers.ContainsKey(id)) {
    108118        lock (lockable) {
    109           if (mappers.ContainsKey(scenario.Name))
    110             return mappers[scenario.Name];
     119          if (mappers.ContainsKey(id))
     120            return mappers[id];
    111121         
    112           var mapperString = GetMapperFromBlobStore(scenario.Name);
     122          var mapperString = GetMapperFromBlobStore(id);
    113123          var mapper = CompileMapper(mapperString);
    114124
    115           mappers[scenario.Name] = mapper;
     125          mappers[id] = mapper;
    116126          return mapper;
    117127        } // lock       
     
    120130     } 
    121131
    122     private void MapExperiment(Model.OptimizationScenario scenario, IAlgorithm algorithm) {     
     132    private void MapExperiment(Model.OptimizationScenario scenario, out IAlgorithm algorithm) {     
    123133      IScenarioMapper mapper = GetMapper(scenario);
    124       mapper.MapScenario(scenario, algorithm);     
    125     }
    126 
    127     private void SendExperimentToHive(Model.User user, IAlgorithm exp) {
     134      mapper.MapScenario(scenario, out algorithm);     
     135    }
     136
     137    private void ConfigureHive(Model.User user) {
     138      HiveServiceLocator.Instance.Username = user.Username;
     139      HiveServiceLocator.Instance.Password = user.Password;
     140      HiveServiceLocator.Instance.EndpointConfigurationName = Configuration.HiveEndpointName;     
     141    }
     142
     143    private void SendExperimentToHive(Model.User user, IOptimizer exp, JobExecutionDetails details) {     
    128144      var job = new RefreshableJob();
    129145      job.IsAllowedPrivileged = true;     
    130       job.Job.Name = "Web Scheduled Traveling Salesman Job";
    131       job.Job.ResourceNames = "TESTGROUP";
    132       job.RefreshAutomatically = false;
     146      job.Job.Name = details.JobTitle;
     147      job.Job.ResourceNames = details.Group;     
     148      job.RefreshAutomatically = false;     
     149      if (exp.ExecutionState != ExecutionState.Prepared) {
     150        exp.Prepare();
     151      }     
    133152      job.HiveTasks.Add(new OptimizerHiveTask(exp));
    134       HiveServiceLocator.Instance.Username = user.Username;
    135       HiveServiceLocator.Instance.Password = user.Password;
    136       HiveServiceLocator.Instance.EndpointConfigurationName = "WSHttpBinding_IHiveService";
     153      ConfigureHive(user);
    137154     
    138155      HiveClient.StartJob((ex) => {
     
    145162
    146163    public IList<Model.Job> GetJobs(User user) {
    147       HiveServiceLocator.Instance.Username = user.Username;
    148       HiveServiceLocator.Instance.Password = user.Password;
    149       HiveServiceLocator.Instance.EndpointConfigurationName = "WSHttpBinding_IHiveService";
     164      ConfigureHive(user);
    150165      var jobsLoaded = HiveServiceLocator.Instance.CallHiveService<IEnumerable<HeuristicLab.Clients.Hive.Job>>(s => s.GetJobs());
    151166      IList<Model.Job> jobs = new List<Model.Job>();
    152      
     167
    153168      foreach (var job in jobsLoaded) {
    154169        jobs.Add(ConvertJob(user, job));
     
    163178      if (job.CalculatingCount > 0)
    164179        state = JobState.Calculating;
    165       else if (job.JobCount == job.FinishedCount)
     180      else if (job.JobCount > 0 && job.JobCount == job.FinishedCount)
    166181        state = JobState.Finished;
    167182      else
    168183        state = JobState.Waiting;
    169       /*var jobTasks = HiveServiceLocator.Instance.CallHiveService<IEnumerable<HeuristicLab.Clients.Hive.LightweightTask>>(s => s.GetLightweightJobTasks(job.Id));
    170      
    171       foreach (var task in jobTasks) {       
    172         switch (task.State) {
    173           case TaskState.Aborted:
    174             state = JobState.Aborted;
    175             break;
    176           case TaskState.Failed:
    177             state = JobState.Failed;
    178             break;
    179         }
    180       }
    181       if (!state.HasValue) {
    182         if (job.CalculatingCount > 0)
    183           state = JobState.Calculating;
    184         else if (waitingJobs > 0)
    185           state = JobState.Waiting;
    186         else
    187           state = JobState.Finished;       
    188       }*/
    189184      return new Model.Job() { Id = job.Id.ToString(), Name = job.Name, Resource = job.ResourceNames, State = state.Value, DateCreated = job.DateCreated };
    190185    }
     
    192187
    193188    public Model.Job GetJob(User user, string id) {
    194       HiveServiceLocator.Instance.Username = user.Username;
    195       HiveServiceLocator.Instance.Password = user.Password;
    196       HiveServiceLocator.Instance.EndpointConfigurationName = "WSHttpBinding_IHiveService";
     189      ConfigureHive(user);
    197190      var guid = Guid.Parse(id);
    198191      return ConvertJob(user, HiveServiceLocator.Instance.CallHiveService<HeuristicLab.Clients.Hive.Job>(s => s.GetJob(guid)));
     
    201194
    202195    public void DeleteJob(User user, string id) {
    203       HiveServiceLocator.Instance.Username = user.Username;
    204       HiveServiceLocator.Instance.Password = user.Password;
    205       HiveServiceLocator.Instance.EndpointConfigurationName = "WSHttpBinding_IHiveService";
     196      ConfigureHive(user);
    206197      var guid = Guid.Parse(id);
    207198      HiveServiceLocator.Instance.CallHiveService(s => s.DeleteJob(guid));     
     
    209200
    210201    public IList<Model.Run> GetJobResults(User user, string id) {
    211       HiveServiceLocator.Instance.Username = user.Username;
    212       HiveServiceLocator.Instance.Password = user.Password;
    213       HiveServiceLocator.Instance.EndpointConfigurationName = "WSHttpBinding_IHiveService";
     202      ConfigureHive(user);
    214203      var guid = Guid.Parse(id);
    215204      var jobTasks = HiveServiceLocator.Instance.CallHiveService<IEnumerable<HeuristicLab.Clients.Hive.LightweightTask>>(s => s.GetLightweightJobTasks(guid));
  • branches/OaaS/HeuristicLab.Services.Optimization.Controller/HL/ScenarioParser.cs

    r8958 r9166  
    99using HeuristicLab.Services.Optimization.ControllerService.Azure;
    1010using HeuristicLab.Services.Optimization.ControllerService.Interfaces;
     11using System.Diagnostics;
    1112
    1213namespace HeuristicLab.Services.Optimization.ControllerService {
     
    1516    private static object lockable = new object();
    1617
    17     private IDataAccessLayer dal = new AzureDataAccessLayer();
     18    private IDataAccessLayer dal = DataAccessLayerProvider.GetLayer();
    1819
    1920    public IList<Model.OptimizationScenario> Scenarios {
     
    3233    public Model.OptimizationScenario GetByName(string name) {
    3334      foreach (var scen in Scenarios) {
    34         if (scen.Name == name) {
     35        if (scen.Id == name) {
    3536          return scen;
    3637        }
     
    115116    } */
    116117
     118    private Model.Problem ParseProblem(XmlReader reader) {
     119      var problem = new Model.Problem();
     120      while (reader.Read()) {
     121        if (reader.NodeType == XmlNodeType.EndElement)
     122          break;
     123        if (reader.Name == "parameters")
     124          problem.Parameters.Items = ParseParameters(reader);
     125      }
     126      return problem;
     127    }
     128
     129    private void ParseAlgorithms(out IList<Model.Algorithm> algos, XmlReader reader) {
     130      algos = new List<Model.Algorithm>();
     131      var depth = reader.Depth;
     132      do {
     133        if (reader.Name == "algorithm" && reader.Depth == depth) {
     134          var innerAlg = new Model.Algorithm();
     135          algos.Add(innerAlg);
     136         
     137          innerAlg.Mapper = reader.GetAttribute("mapper");
     138          reader.Read();
     139          for (;;) {
     140            if (reader.Name == "algorithm" && reader.NodeType == XmlNodeType.EndElement)
     141              break;
     142
     143            if (reader.Name == "parameters" && reader.NodeType == XmlNodeType.Element) {
     144              innerAlg.Parameters.Items = ParseParameters(reader);
     145              continue;
     146            }
     147            else if (reader.Name == "problem" && reader.NodeType == XmlNodeType.Element) {
     148              innerAlg.Problem = ParseProblem(reader);
     149              continue;
     150            }
     151            else if (reader.Name == "algorithm" && reader.NodeType == XmlNodeType.Element) {
     152              IList<Model.Algorithm> childAlgos;
     153              ParseAlgorithms(out childAlgos, reader);
     154              innerAlg.ChildAlgorithms = childAlgos;
     155              //TODO: Test with child algorithms
     156              continue;
     157            }
     158            reader.Read();
     159          }
     160        }
     161      } while (reader.Read() && reader.Depth >= depth);
     162    }
     163
     164    private Model.OptimizationScenario ParseScenarioElement(XmlReader reader) {
     165      var scenario = new Model.OptimizationScenario();
     166      var depth = reader.Depth;
     167      while (reader.Depth >= depth) {
     168        if (reader.Name == "scenario" && reader.NodeType == XmlNodeType.EndElement)
     169          break;
     170
     171        if (reader.Name == "name") {
     172          scenario.Id = reader.ReadElementContentAsString();
     173          continue;
     174        }
     175        else if (reader.Name == "algorithm") {
     176          IList<Model.Algorithm> algos;
     177          ParseAlgorithms(out algos, reader);
     178          scenario.Algorithm = algos;
     179          continue;
     180        }
     181        reader.Read();
     182      }
     183      return scenario;
     184    }
     185
    117186    private Model.OptimizationScenario ParseScenario(StringReader str) {
    118187      // Set the validation settings.     
     
    120189      var settings = GetSettings();
    121190      settings.ValidationEventHandler += (sender, args) => {
    122         Console.WriteLine(args.Message);
     191        Trace.WriteLine(args.Message);
    123192        isErrorPresent = true;
    124193      };
    125       Model.OptimizationScenario scenario = null;
     194      Model.OptimizationScenario scenario = null;     
    126195      using (var reader = XmlReader.Create(str, settings)) {       
    127         while (!isErrorPresent && !reader.EOF) {
     196        while (!reader.EOF) {
    128197          if (reader.Name == "scenario" && reader.NodeType == XmlNodeType.Element) {
    129             scenario = new Model.OptimizationScenario();
    130             scenario.ProblemType = reader.GetAttribute("mapper");
    131             scenario.ProblemType = reader.GetAttribute("algorithmType");
    132             scenario.ProblemType = reader.GetAttribute("problemType");
    133           }
    134           else if (reader.Name == "name") {
    135             scenario.Name = reader.ReadElementContentAsString();
    136             continue;
    137           }
    138           else if (reader.Name == "problemParameters") {
    139             IList<Model.Parameter> problemParameters = ParseParameters(reader);
    140             foreach (var param in problemParameters)
    141               scenario.InputParameters.Items.Add(param);
    142           }
    143           else if (reader.Name == "algorithmParameters") {
    144             IList<Model.Parameter> algoParameters = ParseParameters(reader);
    145             foreach (var param in algoParameters)
    146               scenario.AlgorithmParameters.Items.Add(param);
     198            scenario = ParseScenarioElement(reader);           
    147199          }
    148200          reader.Read();
     
    185237      IList<Model.Parameter> parameters = new List<Model.Parameter>();
    186238      while (reader.Read()) {
    187         if (reader.Name.EndsWith("Parameters"))
     239        if (reader.Name == "parameters" && reader.NodeType == XmlNodeType.EndElement)
    188240          break;
    189241        // parse parameter
    190         if (reader.Depth == 2 && reader.Name == "param" && reader.NodeType == XmlNodeType.Element) {
     242        if (reader.Name == "param" && reader.NodeType == XmlNodeType.Element) {
    191243          var param = new Model.Parameter();
    192244          var typeAtt = reader.GetAttribute("type");
  • branches/OaaS/HeuristicLab.Services.Optimization.Controller/HeuristicLab.Services.Optimization.ControllerService.csproj

    r9062 r9166  
    3636      <HintPath>..\bin\ALGLIB-3.5.0.dll</HintPath>
    3737    </Reference>
     38    <Reference Include="HeuristicLab.ALGLIB-3.5.0">
     39      <HintPath>..\bin\HeuristicLab.ALGLIB-3.5.0.dll</HintPath>
     40    </Reference>
     41    <Reference Include="HeuristicLab.Algorithms.Benchmarks-3.3">
     42      <HintPath>..\bin\HeuristicLab.Algorithms.Benchmarks-3.3.dll</HintPath>
     43    </Reference>
    3844    <Reference Include="HeuristicLab.Algorithms.GeneticAlgorithm-3.3">
    3945      <HintPath>..\bin\HeuristicLab.Algorithms.GeneticAlgorithm-3.3.dll</HintPath>
     
    9298      <HintPath>..\bin\HeuristicLab.Operators-3.3.dll</HintPath>
    9399    </Reference>
     100    <Reference Include="HeuristicLab.Operators.Views.GraphVisualization-3.3">
     101      <HintPath>..\bin\HeuristicLab.Operators.Views.GraphVisualization-3.3.dll</HintPath>
     102    </Reference>
    94103    <Reference Include="HeuristicLab.Optimization-3.3">
    95104      <HintPath>..\HeuristicLab.Optimization\3.3\obj\Debug\HeuristicLab.Optimization-3.3.dll</HintPath>
     
    129138      <SpecificVersion>False</SpecificVersion>
    130139      <HintPath>..\bin\HeuristicLab.Selection-3.3.dll</HintPath>
     140    </Reference>
     141    <Reference Include="HeuristicLab.SequentialEngine-3.3">
     142      <HintPath>..\bin\HeuristicLab.SequentialEngine-3.3.dll</HintPath>
    131143    </Reference>
    132144    <Reference Include="HeuristicLab.Tracing-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     
    153165  <ItemGroup>
    154166    <Compile Include="Azure\DAL.cs" />
    155     <Compile Include="HL\HiveScenarioManagerOld.cs" />
     167    <Compile Include="General\Configuration.cs" />
    156168    <Compile Include="HL\HiveMapper.cs" />
    157169    <Compile Include="HL\HiveScenarioManager.cs" />
     
    161173    <Compile Include="Interfaces\IScenarioManager.cs" />
    162174    <Compile Include="Interfaces\Model\ControllerModel.cs" />
     175    <Compile Include="Mockup\MockupDAL.cs" />
     176    <Compile Include="Mockup\MockupScenarioManager.cs" />
    163177    <Compile Include="PlaceholderControllerService.cs" />
    164178    <Compile Include="Properties\AssemblyInfo.cs" />
     
    172186    <None Include="packages.config" />
    173187  </ItemGroup>
     188  <ItemGroup />
    174189  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
    175190  <PropertyGroup>
  • branches/OaaS/HeuristicLab.Services.Optimization.Controller/Interfaces/DAL.cs

    r8958 r9166  
    2727    IBlobDao CreateBlobDao();
    2828  }
     29
     30  public static class DataAccessLayerProvider {   
     31    private static IDataAccessLayer layer = new Azure.AzureDataAccessLayer();
     32    //private static IDataAccessLayer layer = new Mockup.MockupDataAccessLayer();
     33
     34    public static IDataAccessLayer GetLayer() {
     35      return layer;
     36    }
     37  }
    2938}
    3039
  • branches/OaaS/HeuristicLab.Services.Optimization.Controller/Interfaces/IControllerService.cs

    r8958 r9166  
    2020
    2121    [OperationContract]
    22     void ScheduleOptimizationScenario(User user, OptimizationScenario scenario);
     22    void ScheduleOptimizationScenario(User user, OptimizationScenario scenario, JobExecutionDetails details);
    2323
    2424    [OperationContract]
  • branches/OaaS/HeuristicLab.Services.Optimization.Controller/Interfaces/IScenarioManager.cs

    r8958 r9166  
    77namespace HeuristicLab.Services.Optimization.ControllerService.Interfaces {
    88  public interface IScenarioManager {
    9     void DispatchScenario(User user, OptimizationScenario scenario);
     9    void DispatchScenario(User user, OptimizationScenario scenario, JobExecutionDetails details);
    1010    IList<Job> GetJobs(User user);
    1111    Job GetJob(User user, string id);
  • branches/OaaS/HeuristicLab.Services.Optimization.Controller/Interfaces/Model/ControllerModel.cs

    r9062 r9166  
    4545    public string[] RowNames { get; set; }
    4646
     47    public void CopyRow(int index) {
     48      var newData = new double[Value.Length + 1][];
     49      var copyRow = new double[Value[index].Length];
     50      for (var i = 0; i < copyRow.Length; i++) {
     51        copyRow[i] = Value[index][i];
     52      }
     53      for (var i = 0; i < newData.Length; i++) {
     54        if (i < index) {
     55          newData[i] = Value[i];
     56        }
     57        else if (i == index) {
     58          newData[i] = copyRow;
     59        }
     60        else if (i > index) {
     61          newData[i] = Value[i - 1];
     62        }
     63      }
     64      Value = newData;
     65    }
     66
     67    public void DeleteRow(int index) {
     68      if (Value.Length == 1)
     69        return;
     70
     71      var newData = new double[Value.Length - 1][];
     72      for (var i = 0; i < Value.Length; i++) {
     73        if (i < index) {
     74          newData[i] = Value[i];
     75        }
     76        else if (i > index) {
     77          newData[i - 1] = Value[i];
     78        }
     79      }
     80      Value = newData;
     81    }
     82
    4783    public override bool TrySetFromString(string input) {
    4884      var splitted = input.Split(':');
     
    6197        return false;
    6298      // very, very buggy
    63       if (i >= Value.Length || j >= Value[0].Length ) {
     99      /*if (i >= Value.Length || j >= Value[0].Length ) {
    64100        double[][] valueArr = new double[i >= Value.GetLength(0) ? i : Value.GetLength(0)][];       
    65101        for (int k = 0; k < Value.Length; k++) {
     
    70106        }
    71107        Value = valueArr;
    72       }
     108      }*/
    73109
    74110      Value[i][j] = value;
     
    186222
    187223  [DataContract]
    188   public class InputParameters {
     224  public class ProblemParameters {
    189225    private IList<Parameter> items = new List<Parameter>();
    190226
     
    226262
    227263  [DataContract]
     264  public class Problem {
     265    public Problem() { Parameters = new ProblemParameters(); }
     266
     267    [DataMember]
     268    public ProblemParameters Parameters { get; set; }
     269
     270    [DataMember]
     271    public string Class { get; set; }
     272  }
     273
     274  [DataContract]
     275  public class Algorithm {
     276    public Algorithm() { Parameters = new AlgorithmParameters(); }
     277
     278    [DataMember]
     279    public AlgorithmParameters Parameters { get; set; }
     280
     281    [DataMember]
     282    public Problem Problem{ get; set; }
     283
     284    [DataMember]
     285    public IList<Algorithm> ChildAlgorithms { get; set; }
     286
     287    [DataMember]
     288    public string Class { get; set; }
     289
     290    [DataMember]
     291    public string Mapper { get; set; }
     292  }
     293
     294  [DataContract]
    228295  public class OptimizationScenario {
    229296    [DataMember]
     297    public string Id { get; set; }
     298   
     299    [DataMember]
     300    public IList<Algorithm> Algorithm { get; set; }
     301
     302    public Algorithm FirstAlgorithm { get { return Algorithm.FirstOrDefault(); } } 
     303  }
     304
     305  [DataContract]
     306  public class Experiment {
     307    [DataMember]
     308    public IList<OptimizationScenario> Scenarios { get; set; }
     309
     310    public Experiment() {
     311      Scenarios = new List<OptimizationScenario>();
     312    }
     313  }
     314
     315  [DataContract]
     316  public enum JobState {
     317    [EnumMember]
     318    Waiting,
     319    [EnumMember]
     320    Calculating,
     321    [EnumMember]
     322    Aborted,
     323    [EnumMember]
     324    Failed,
     325    [EnumMember]
     326    Finished
     327  }
     328
     329  [DataContract]
     330  public class JobExecutionDetails {
     331    [DataMember]
     332    public int Repititions { get; set; }
     333
     334    [DataMember]
     335    public string JobTitle { get; set; }
     336
     337    [DataMember]
     338    public string Group { get; set; }
     339  }
     340
     341  [DataContract]
     342  public class Job {
     343    [DataMember]
     344    public string Id { get; set; }
     345
     346    [DataMember]
     347    public JobState State { get; set; }
     348
     349    [DataMember]
    230350    public string Name { get; set; }
    231351
    232352    [DataMember]
    233     public string ProblemType { get; set; }
    234 
    235     [DataMember]
    236     public string AlgorithmType { get; set; }
    237 
    238     [DataMember]
    239     public string MapperType { get; set; }
    240 
    241     private InputParameters inputParams = new InputParameters();
    242 
    243     [DataMember]
    244     public InputParameters InputParameters {
    245       get { return inputParams; }
    246       set { inputParams = value; }
    247     }
    248 
    249 
    250     private AlgorithmParameters algorithmParameters = new AlgorithmParameters();
    251 
    252     [DataMember]
    253     public AlgorithmParameters AlgorithmParameters {
    254       get { return algorithmParameters; }
    255       set { algorithmParameters = value; }
    256     }
    257   }
    258 
    259   [DataContract]
    260   public enum JobState {
    261     [EnumMember]
    262     Waiting,
    263     [EnumMember]
    264     Calculating,
    265     [EnumMember]
    266     Aborted,
    267     [EnumMember]
    268     Failed,
    269     [EnumMember]
    270     Finished
    271   }
    272 
    273   [DataContract]
    274   public class Job {
     353    public string Resource { get; set; }
     354
     355    [DataMember]
     356    public DateTime DateCreated { get; set; }
     357  }
     358
     359  [DataContract]
     360  public class Run {
    275361    [DataMember]
    276362    public string Id { get; set; }
    277363
    278364    [DataMember]
    279     public JobState State { get; set; }
    280 
    281     [DataMember]
    282365    public string Name { get; set; }
    283366
    284367    [DataMember]
    285     public string Resource { get; set; }
    286 
    287     [DataMember]
    288     public DateTime DateCreated { get; set; }
    289   }
    290 
    291   [DataContract]
    292   public class Run {
    293     [DataMember]
    294     public string Id { get; set; }
    295 
    296     [DataMember]
    297     public string Name { get; set; }
    298 
    299     [DataMember]
    300368    public IList<Parameter> Results { get; set; }
    301369  }
  • branches/OaaS/HeuristicLab.Services.Optimization.Controller/PlaceholderControllerService.cs

    r8958 r9166  
    5151      this.scenarios = new List<Model.OptimizationScenario>() { tsp };*/     
    5252      //hiveManager.DispatchScenario(tsp);
     53      //hiveManager = new MockupScenarioManager();
    5354      hiveManager = new HiveScenarioManager();
    5455      scenarios = parser.Scenarios;
     
    6364    public Model.OptimizationScenario GetOptimizationScenarioByName(string name) {
    6465      var scen = (from e in scenarios
    65                   where e.Name == name
     66                  where e.Id == name
    6667                  select e).FirstOrDefault();     
    6768      return scen;
    6869    }
    6970
    70     public void ScheduleOptimizationScenario(Model.User user, Model.OptimizationScenario scenario) {
    71       hiveManager.DispatchScenario(user, scenario);
     71    public void ScheduleOptimizationScenario(Model.User user, Model.OptimizationScenario scenario, JobExecutionDetails details) {
     72      hiveManager.DispatchScenario(user, scenario, details);
    7273    }
    7374
     
    9798        return false;
    9899      }     
    99       var added = hiveManager.AddScenario(user, scenario.Name, scenarioXml, scenarioMapper);
     100      var added = hiveManager.AddScenario(user, scenario.Id, scenarioXml, scenarioMapper);
    100101      if (added)
    101102        scenarios.Add(scenario);
     
    114115    public IEnumerable<string> GetOptimizationScenarioNames() {
    115116      return (from e in scenarios
    116               select e.Name).AsEnumerable();     
     117              select e.Id).AsEnumerable();     
    117118    }
    118119  }
Note: See TracChangeset for help on using the changeset viewer.