Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/28/12 11:03:38 (12 years ago)
Author:
abeham
Message:

#1985: added ability to edit snapshot times (changed representation to a list of timespan instead of a list of double)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/RuntimeOptimizer/HeuristicLab.Optimization/3.3/MetaOptimizers/TimeLimitRun.cs

    r8956 r8961  
    7878    private int snapshotTimesIndex;
    7979    [Storable]
    80     private ObservableList<double> snapshotTimes;
    81     public ObservableList<double> SnapshotTimes {
     80    private ObservableList<TimeSpan> snapshotTimes;
     81    public ObservableList<TimeSpan> SnapshotTimes {
    8282      get { return snapshotTimes; }
    8383      set {
     
    170170      : base(original, cloner) {
    171171      maximumExecutionTime = original.maximumExecutionTime;
    172       snapshotTimes = new ObservableList<double>(original.snapshotTimes);
     172      snapshotTimes = new ObservableList<TimeSpan>(original.snapshotTimes);
    173173      snapshotTimesIndex = original.snapshotTimesIndex;
    174174      snapshots = cloner.Clone(original.snapshots);
     
    200200      description = ItemDescription;
    201201      maximumExecutionTime = TimeSpan.FromMinutes(1);
    202       snapshotTimes = new ObservableList<double>(new[] {
    203           TimeSpan.FromSeconds(5).TotalMilliseconds,
    204           TimeSpan.FromSeconds(10).TotalMilliseconds,
    205           TimeSpan.FromSeconds(30).TotalMilliseconds });
     202      snapshotTimes = new ObservableList<TimeSpan>(new[] {
     203          TimeSpan.FromSeconds(5),
     204          TimeSpan.FromSeconds(10),
     205          TimeSpan.FromSeconds(30) });
    206206      snapshotTimesIndex = 0;
    207207      snapTimer = new Timer() {
     
    223223      description = ItemDescription;
    224224      maximumExecutionTime = TimeSpan.FromMinutes(1);
    225       snapshotTimes = new ObservableList<double>(new[] {
    226           TimeSpan.FromSeconds(5).TotalMilliseconds,
    227           TimeSpan.FromSeconds(10).TotalMilliseconds,
    228           TimeSpan.FromSeconds(30).TotalMilliseconds });
     225      snapshotTimes = new ObservableList<TimeSpan>(new[] {
     226          TimeSpan.FromSeconds(5),
     227          TimeSpan.FromSeconds(10),
     228          TimeSpan.FromSeconds(30) });
    229229      snapshotTimesIndex = 0;
    230230      snapTimer = new Timer() {
     
    245245      : base(name, description) {
    246246      maximumExecutionTime = TimeSpan.FromMinutes(1);
    247       snapshotTimes = new ObservableList<double>(new[] {
    248           TimeSpan.FromSeconds(5).TotalMilliseconds,
    249           TimeSpan.FromSeconds(10).TotalMilliseconds,
    250           TimeSpan.FromSeconds(30).TotalMilliseconds });
     247      snapshotTimes = new ObservableList<TimeSpan>(new[] {
     248          TimeSpan.FromSeconds(5),
     249          TimeSpan.FromSeconds(10),
     250          TimeSpan.FromSeconds(30) });
    251251      snapshotTimesIndex = 0;
    252252      snapTimer = new Timer() {
     
    320320          var execTime = ExecutionTime;
    321321          if (snapshotTimesIndex < SnapshotTimes.Count &&
    322               SnapshotTimes[snapshotTimesIndex] <= execTime.TotalMilliseconds) {
     322              SnapshotTimes[snapshotTimesIndex] <= execTime) {
    323323            DoSnapshot();
    324324            snapshotTimesIndex++;
     
    345345    private void FindNextSnapshotTimeIndex(TimeSpan reference) {
    346346      var index = 0;
    347       while (index < snapshotTimes.Count && (snapshotTimes[index] - reference.TotalMilliseconds) <= 0) {
     347      while (index < snapshotTimes.Count && snapshotTimes[index] <= reference) {
    348348        index++;
    349349      };
Note: See TracChangeset for help on using the changeset viewer.