Changeset 8977


Ignore:
Timestamp:
11/29/12 13:47:28 (5 years ago)
Author:
abeham
Message:

#1985: Fixed case where no snapshots should be made

Location:
branches/RuntimeOptimizer
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/RuntimeOptimizer/HeuristicLab.Optimization.Views/3.3/TimeLimitRunView.cs

    r8975 r8977  
    142142          SuppressEvents = true;
    143143          try {
    144             snapshotsTextBox.Text = string.Join(" ; ", Content.SnapshotTimes.Select(x => FormatTimeSpan(x, true)));
     144            if (Content.SnapshotTimes.Any())
     145              snapshotsTextBox.Text = String.Join(" ; ", Content.SnapshotTimes.Select(x => FormatTimeSpan(x, true)));
     146            else snapshotsTextBox.Text = String.Empty;
    145147            Content.SnapshotTimes.ItemsAdded += Content_SnapshotTimes_Changed;
    146148            Content.SnapshotTimes.ItemsMoved += Content_SnapshotTimes_Changed;
     
    180182      SuppressEvents = true;
    181183      try {
    182         snapshotsTextBox.Text = string.Join(" ; ", Content.SnapshotTimes.Select(x => FormatTimeSpan(x, true)));
     184        if (Content.SnapshotTimes.Any())
     185          snapshotsTextBox.Text = string.Join(" ; ", Content.SnapshotTimes.Select(x => FormatTimeSpan(x, true)));
     186        else snapshotsTextBox.Text = String.Empty;
    183187      } finally { SuppressEvents = false; }
    184188    }
     
    204208      errorProvider.SetError(timeLimitTextBox, String.Empty);
    205209
    206       var tokens = snapshotsTextBox.Text.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
     210      var tokens = snapshotsTextBox.Text.Trim().Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
    207211
    208212      var snapshotTimes = new ObservableList<TimeSpan>();
     
    295299      using (var dialog = new DefineArithmeticProgressionDialog(false, 1, Content.MaximumExecutionTime.TotalSeconds, 1)) {
    296300        if (dialog.ShowDialog() == DialogResult.OK) {
    297           Content.SnapshotTimes = new ObservableList<TimeSpan>(dialog.Values.Select(TimeSpan.FromSeconds));
     301          if (dialog.Values.Any())
     302            Content.SnapshotTimes = new ObservableList<TimeSpan>(dialog.Values.Select(TimeSpan.FromSeconds));
     303          else Content.SnapshotTimes = new ObservableList<TimeSpan>();
    298304        }
    299305      }
  • branches/RuntimeOptimizer/HeuristicLab.Optimization/3.3/MetaOptimizers/TimeLimitRun.cs

    r8975 r8977  
    341341        pausedForSnapshot = pausedForTermination = false;
    342342        MakeSnapshot();
    343         snapshotTimesIndex++;
     343        FindNextSnapshotTimeIndex(ExecutionTime);
    344344      }
    345345      OnPaused();
Note: See TracChangeset for help on using the changeset viewer.