Exemple #1
0
    private Run(Run original, Cloner cloner)
      : base(original, cloner) {
      color = original.color;
      algorithm = cloner.Clone(original.algorithm);

      parameters = new ObservableDictionary<string, IItem>();
      foreach (string key in original.parameters.Keys)
        parameters.Add(key, cloner.Clone(original.parameters[key]));

      results = new ObservableDictionary<string, IItem>();
      foreach (string key in original.results.Keys)
        results.Add(key, cloner.Clone(original.results[key]));
    }
 public void Modify(List<IRun> runs) {
   var groups = runs.GroupBy(r => GetValues(GroupBy, r).ToString()).ToList();
   runs.Clear();
   foreach (var group in groups) {
     var run = new Run { Name = string.Format(group.Key) };
     foreach (var r in group) {
       var prefix = GetStringValue(Prefix, r);
       foreach (var result in r.Results) {
         InsertNew(run.Results, prefix, result.Key, result.Value);
       }
       foreach (var parameter in r.Parameters) {
         InsertNew(run.Parameters, prefix, parameter.Key, parameter.Value);
       }
     }
     runs.Add(run);
   }
 }
Exemple #3
0
 private Optimization.IRun ConvertToOptimizationRun(Run run) {
   Optimization.Run optRun = new Optimization.Run();
   foreach (Value value in run.ParameterValues)
     optRun.Parameters.Add(value.Name, ConvertToItem(value));
   foreach (Value value in run.ResultValues)
     optRun.Results.Add(value.Name, ConvertToItem(value));
   return optRun;
 }
    private void MakeSnapshot() {
      string time = Math.Round(ExecutionTime.TotalSeconds, 1).ToString("0.0");
      string runName = "Snapshot " + time + "s " + algorithm.Name;
      var changed = false;
      if (StoreAlgorithmInEachSnapshot && !Algorithm.StoreAlgorithmInEachRun) {
        Algorithm.StoreAlgorithmInEachRun = true;
        changed = true;
      } else if (!StoreAlgorithmInEachSnapshot && Algorithm.StoreAlgorithmInEachRun) {
        Algorithm.StoreAlgorithmInEachRun = false;
        changed = true;
      }
      var run = new Run(runName, Algorithm);
      if (changed)
        Algorithm.StoreAlgorithmInEachRun = !Algorithm.StoreAlgorithmInEachRun;

      snapshots.Add(run);
    }