Skip to content

Commit

Permalink
Merge pull request #328 from hrntsm/fix/hitl
Browse files Browse the repository at this point in the history
Fix _stop_flag exception
  • Loading branch information
hrntsm authored Oct 10, 2024
2 parents b84caf1 + 4d66311 commit 8ceef1e
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 19 deletions.
7 changes: 6 additions & 1 deletion Tunny/Solver/Algorithm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,12 @@ private bool CheckOptimizeComplete(OptimizationHandlingInfo optInfo, int trialNu
int nTrials = optInfo.NTrials;
double timeout = optInfo.Timeout;
dynamic study = optInfo.Study;
bool studyStopFlag = study._stop_flag;
bool studyStopFlag = false;
if (optInfo.HumanSliderInput == null && optInfo.Preferential == null)
{
studyStopFlag = study._stop_flag;
}


bool isOptimizeCompleted = false;
if (trialNum >= nTrials)
Expand Down
41 changes: 23 additions & 18 deletions Tunny/UI/OptimizationWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,13 +133,36 @@ private void SetUIValues()
{
TLog.MethodStart();
TLog.Info("Set UI values");

// Study Name GroupBox
studyNameTextBox.Text = _settings.StudyName;
continueStudyCheckBox.Checked = _settings.Optimize.ContinueStudy;
existingStudyComboBox.Enabled = continueStudyCheckBox.Checked;
studyNameTextBox.Enabled = !continueStudyCheckBox.Checked;
copyStudyCheckBox.Enabled = _settings.Optimize.CopyStudy;
inMemoryCheckBox.Checked = _settings.Storage.Type == StorageType.InMemory;
UpdateStudyComboBox();
ShowRealtimeResultCheckBox.Checked = _settings.Optimize.ShowRealtimeResult;

outputModelNumTextBox.Text = _settings.Result.OutputNumberString;
visualizeTypeComboBox.SelectedIndex = _settings.Result.SelectVisualizeType;
visualizeClusterNumUpDown.Value = _settings.Result.NumberOfClusters;
InitializeSamplerSettings();

runGarbageCollectionComboBox.SelectedIndex = (int)_settings.Optimize.GcAfterTrial;
miscLogComboBox.SelectedIndex = (int)_settings.LogLevel;
ignoreDuplicateSamplingCheckBox.Checked = _settings.Optimize.IgnoreDuplicateSampling;
disableRhinoViewportCheckBox.Checked = _settings.Optimize.DisableViewportDrawing;

HumanInTheLoopType type = _component.GhInOut.Objectives.HumanInTheLoopType;
if (type != HumanInTheLoopType.None)
{
TLog.Info("Set Tunny Human-in-the-loop mode");
Text = "Tunny (Human in the Loop mode)";
samplerComboBox.SelectedIndex = (int)SamplerType.GP; // GP
samplerComboBox.Enabled = false;
inMemoryCheckBox.Checked = false;
inMemoryCheckBox.Enabled = false;
nTrialText.Text = "Number of batches";
nTrialNumUpDown.Value = type == HumanInTheLoopType.Preferential ? 6 : 4;
timeoutNumUpDown.Value = 0;
Expand All @@ -157,24 +180,6 @@ private void SetUIValues()
timeoutNumUpDown.Value = (decimal)_settings.Optimize.Timeout;
}

// Study Name GroupBox
studyNameTextBox.Text = _settings.StudyName;
continueStudyCheckBox.Checked = _settings.Optimize.ContinueStudy;
existingStudyComboBox.Enabled = continueStudyCheckBox.Checked;
studyNameTextBox.Enabled = !continueStudyCheckBox.Checked;
copyStudyCheckBox.Enabled = _settings.Optimize.CopyStudy;
UpdateStudyComboBox();
ShowRealtimeResultCheckBox.Checked = _settings.Optimize.ShowRealtimeResult;

outputModelNumTextBox.Text = _settings.Result.OutputNumberString;
visualizeTypeComboBox.SelectedIndex = _settings.Result.SelectVisualizeType;
visualizeClusterNumUpDown.Value = _settings.Result.NumberOfClusters;
InitializeSamplerSettings();

runGarbageCollectionComboBox.SelectedIndex = (int)_settings.Optimize.GcAfterTrial;
miscLogComboBox.SelectedIndex = (int)_settings.LogLevel;
ignoreDuplicateSamplingCheckBox.Checked = _settings.Optimize.IgnoreDuplicateSampling;
disableRhinoViewportCheckBox.Checked = _settings.Optimize.DisableViewportDrawing;
}

private void GetUIValues()
Expand Down

0 comments on commit 8ceef1e

Please sign in to comment.