Skip to content

Commit

Permalink
Merge pull request #212 from hrntsm/feature/support-trial-fail
Browse files Browse the repository at this point in the history
Feature/support trial fail
  • Loading branch information
hrntsm authored Dec 28, 2023
2 parents 0c5d670 + ece865c commit b85091c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ Please see [here](https://github.com/hrntsm/Tunny/releases) for the data release
- The seed value can be specified in BayesianOptimization(GP).
- Support optuna artifact feature.
- GeometryBase & FishPrint & file path are supported.
- Allows Trial to FAIL.
- In contrast to the constraint, if the value of the objective function cannot be obtained properly due to divergence of the solution or other reasons, it can be reflected in the trial.

### Changed

Expand Down
8 changes: 7 additions & 1 deletion Tunny/Solver/Algorithm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,13 @@ private TrialGrasshopperItems RunSingleOptimizeStep(OptimizationHandlingInfo opt
{
UploadArtifacts(result.Artifacts, optInfo.ArtifactBackend, trial);
}
if (optInfo.HumanInTheLoop == null)

if (result.Attribute.TryGetValue("IsFAIL", out List<string> isFail) && isFail.Contains("True"))
{
dynamic optuna = Py.Import("optuna");
optInfo.Study.tell(trial, state: optuna.trial.TrialState.FAIL);
}
else if (optInfo.HumanInTheLoop == null)
{
optInfo.Study.tell(trial, result.ObjectiveValues.ToArray());
}
Expand Down

0 comments on commit b85091c

Please sign in to comment.