Skip to content

Commit

Permalink
Merge pull request #140 from hrntsm/feature/show-eta
Browse files Browse the repository at this point in the history
Feature/show eta
  • Loading branch information
hrntsm authored Jan 10, 2023
2 parents 4ee1aad + 70bc7c8 commit df5fe9d
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 8 deletions.
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,29 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p

Please see [here](https://github.com/hrntsm/Tunny/releases) for the data released for each version.

## [UNRELEASED] -20xx-xx-xx


### Added

- Display of estimated remaining time during optimization run.

### Changed


### Deprecated


### Removed


### Fixed


### Security



## [v0.6.0] -2022-12-23

### Added
Expand Down
2 changes: 2 additions & 0 deletions Tunny/Handler/ProgressState.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System;
using System.Collections.Generic;

namespace Tunny.Handler
Expand All @@ -9,5 +10,6 @@ public class ProgressState
public int ObjectiveNum { get; set; }
public double[][] BestValues { get; set; }
public double HypervolumeRatio { get; set; }
public TimeSpan EstimatedTimeRemaining { get; set; }
}
}
5 changes: 4 additions & 1 deletion Tunny/Solver/Algorithm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,10 @@ private void RunOptimize(int nTrials, double timeout, dynamic study, Dictionary<
ObjectiveNum = ObjNickName.Length,
BestValues = bestValues,
Values = xTest.Select(v => (decimal)v).ToList(),
HypervolumeRatio = trialNum == 0 ? 0 : trialNum == 1 || ObjNickName.Length == 1 ? 1 : Hypervolume.Compute2dHypervolumeRatio(study)
HypervolumeRatio = trialNum == 0 ? 0 : trialNum == 1 || ObjNickName.Length == 1 ? 1 : Hypervolume.Compute2dHypervolumeRatio(study),
EstimatedTimeRemaining = timeout == 0
? TimeSpan.FromSeconds((DateTime.Now - startTime).TotalSeconds * (nTrials - trialNum - 1) / (trialNum + 1))
: TimeSpan.FromSeconds(timeout - (DateTime.Now - startTime).TotalSeconds)
};
result = EvalFunc(pState, progress);

Expand Down
26 changes: 19 additions & 7 deletions Tunny/UI/OptimizationWindow.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Tunny/UI/OptimizeWindowTab/OptimizeTab.cs
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,8 @@ private void OptimizeProgressChangedHandler(object sender, ProgressChangedEventA
: $"Hypervolume Ratio: {pState.HypervolumeRatio:0.000}";
}

EstimatedTimeRemainingLabel.Text = $"Estimated Time Remaining: "
+ (pState.EstimatedTimeRemaining.TotalSeconds != 0 ? new DateTime(0).Add(pState.EstimatedTimeRemaining).ToString("HH:mm:ss") : "00:00:00");
optimizeProgressBar.Value = e.ProgressPercentage;
optimizeProgressBar.Update();
}
Expand Down

0 comments on commit df5fe9d

Please sign in to comment.