Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/20/17 12:07:20 (8 years ago)
Author:
bwerth
Message:

#2745 fixed pausing and stopping and namespaces; Added MaximalDatasetSize and rudimentary ISurrogateAlgorithm-interface

Location:
branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO

    • Property svn:global-ignores set to
      obj
    • Property svn:ignore set to
      HeuristicLab.Algorithms.EGO-3.4.csproj.user
      Plugin.cs
  • branches/EfficientGlobalOptimization/HeuristicLab.Algorithms.EGO/EgoUtilities.cs

    r14741 r14768  
    5252
    5353    public static ResultCollection SyncRunSubAlgorithm(IAlgorithm alg, int random) {
     54
     55      if (alg.Parameters.ContainsKey("SetSeedRandomly") && alg.Parameters.ContainsKey("Seed")) {
     56        var setSeed = alg.Parameters["SetSeedRandomly"].ActualValue as BoolValue;
     57        var seed = alg.Parameters["Seed"].ActualValue as IntValue;
     58        if (seed == null || setSeed == null) throw new ArgumentException("wrong SeedParametertypes");
     59        setSeed.Value = false;
     60        seed.Value = random;
     61
     62      }
     63
     64
    5465      EventWaitHandle trigger = new AutoResetEvent(false);
    5566      Exception ex = null;
     
    103114      return new Dataset(names.Concat(new[] { "output" }).ToArray(), data);
    104115    }
     116    public static DoubleMatrix GetBoundingBox(IEnumerable<RealVector> vectors) {
     117      DoubleMatrix res = null;
     118      foreach (var vector in vectors)
     119        if (res == null) {
     120          res = new DoubleMatrix(vector.Length, 2);
     121          for (var i = 0; i < vector.Length; i++)
     122            res[i, 0] = res[i, 1] = vector[i];
     123        } else
     124          for (var i = 0; i < vector.Length; i++) {
     125            res[i, 0] = Math.Min(vector[i], res[i, 0]);
     126            res[i, 1] = Math.Max(vector[i], res[i, 1]);
     127          }
     128      return res;
     129    }
    105130  }
    106131}
Note: See TracChangeset for help on using the changeset viewer.