Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/19/13 08:46:01 (12 years ago)
Author:
fschoepp
Message:

#1888:

  • Experiments will be saved as JSON elements within the blob store.
  • Added simple model and JSON converters.
  • Backend stores and runs experiments.
  • Updated interfaces to save/read experiments.
  • Added a binding to automatically map incoming JSON ajax requests to experiment models.
  • Added the javascript DatatypeMapper to map parameter inputs to the right html elements and vice versa.
  • Added smartwizard to generate Wizards for creating new experiments (New.cshtml).
File:
1 edited

Legend:

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

    r9215 r9227  
    66using HeuristicLab.Services.Optimization.ControllerService.Interfaces;
    77using HeuristicLab.Services.Optimization.ControllerService.Model;
     8using HeuristicLab.Services.Optimization.ControllerService.General;
    89
    910namespace HeuristicLab.Services.Optimization.ControllerService {
     
    120121
    121122
    122     public bool SaveExperiment(User user, Experiment experiment) {
    123       return hiveManager.SaveExperiment(user, experiment);
     123    public bool SaveExperiment(User user, Experiment experiment) {     
     124      // make sure all algorithms store their choices aswell
     125      var scenarioMap = new Dictionary<string, OptimizationScenario>();
     126      var algos = new Stack<Algorithm>();
     127      foreach (var algo in experiment.Algorithm) algos.Push(algo);
     128     
     129     
     130
     131      while (algos.Count > 0) {
     132        var algo = algos.Pop();
     133        if (algo.ChildAlgorithms != null)
     134          foreach (var child in algo.ChildAlgorithms) algos.Push(child);
     135
     136        if (AlgorithmHelper.HasToBeUpdated(algo)) {
     137          OptimizationScenario scenario;
     138          if (!scenarioMap.TryGetValue(algo.Name, out scenario)) {
     139            scenario = GetOptimizationScenarioByName(algo.Name);
     140            scenarioMap[algo.Name] = scenario;
     141          }
     142         
     143          AlgorithmHelper.Update(algo, scenario);
     144        }
     145      }
     146
     147      // finally store the experiment
     148      var success = hiveManager.SaveExperiment(user, experiment);
     149      // if it has been stored, and jobdetails are present, run the job!
     150      if (success && experiment.JobDetails != null) {
     151        return ScheduleExperiment(user, experiment.Name, experiment.JobDetails);
     152      }
     153      return success;
    124154    }
    125155
     
    142172      return hiveManager.GetTaskData(u, jobId, taskId);
    143173    }
     174
     175
     176    public Experiment GetExperimentByName(User user, string scenario) {
     177      return hiveManager.GetExperimentByName(user, scenario);
     178    }
     179
     180
     181    public bool ScheduleExperiment(User user, string experiment, JobExecutionDetails details) {
     182      var exp = hiveManager.GetExperimentByName(user, experiment);
     183      return hiveManager.DispatchExperiment(user, exp, details);
     184    }
    144185  }
    145186}
Note: See TracChangeset for help on using the changeset viewer.