Changeset 12833


Ignore:
Timestamp:
08/03/15 11:37:49 (6 years ago)
Author:
aballeit
Message:

#2283 EpsGreedy Textbox for Epsylon

Location:
branches/HeuristicLab.Problems.GrammaticalOptimization/Evaluation
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Problems.GrammaticalOptimization/Evaluation/MainWindow.xaml

    r12832 r12833  
    4646                          DisplayMemberPath="Name"
    4747                          SelectedValue="{Binding SelectedPolicy}"
    48                           Width="200" Margin="5,0,0,0"></ComboBox>
     48                          Width="200" Margin="5,0,0,0"
     49                          SelectionChanged="ComboBoxPolicies_OnSelectionChanged"></ComboBox>
     50                <TextBlock Name="TextBlockEpsylon" Text="Epsylon:" Visibility="Hidden" Margin="5,0,0,0" VerticalAlignment="Center"></TextBlock>
     51                <TextBox Name="TextBoxEpsylon" Text="{Binding Epsylon}" Visibility="Hidden" Margin="5,0,0,0" VerticalAlignment="Center" Width="50"></TextBox>
    4952                <Button Name="ButtonRun" Margin="5,0,0,0" Click="ButtonRun_OnClick" Height="22" VerticalAlignment="Top">Run</Button>
    5053                <Button Name="ButtonPause" Margin="5,0,0,0" Click="ButtonPause_OnClick" IsEnabled="False">Pause</Button>
     
    7477                <TextBox Name="TextBoxMaxIterations" Margin="2" Grid.Column="1" Grid.Row="1" Width="100" VerticalAlignment="Center" TextAlignment="Right" Text="{Binding MaxIterations}"></TextBox>
    7578                <TextBlock Margin="2" Grid.Column="2" Grid.Row="1" VerticalAlignment="Center">MaxThreads:</TextBlock>
    76                 <TextBox Name="MaxThreads" Margin="2" Grid.Column="3" Grid.Row="1" Width="100" VerticalAlignment="Center" TextAlignment="Right" Text="{Binding MaxThreads}"></TextBox>
     79                <TextBox Name="TextBoxMaxThreads" Margin="2" Grid.Column="3" Grid.Row="1" Width="100" VerticalAlignment="Center" TextAlignment="Right" Text="{Binding MaxThreads}"></TextBox>
    7780                <TextBlock Margin="2" Grid.Column="2" Grid.Row="0" VerticalAlignment="Center">MaxLen:</TextBlock>
    7881                <TextBox Name="TextBoxMaxLen" Margin="2" Grid.Column="3" Grid.Row="0" Width="100" VerticalAlignment="Center" TextAlignment="Right" Text="{Binding MaxLen}"></TextBox>
  • branches/HeuristicLab.Problems.GrammaticalOptimization/Evaluation/MainWindow.xaml.cs

    r12832 r12833  
    156156            TextBoxMaxLen.IsEnabled = true;
    157157            TextBoxRuns.IsEnabled = true;
     158            TextBoxMaxThreads.IsEnabled = true;
    158159        }
    159160
     
    181182                policyInstance = new BoltzmannExplorationPolicy(2);
    182183            }
     184            else if (policy == typeof (EpsGreedyPolicy))
     185            {
     186                policyInstance = new EpsGreedyPolicy(vm.Epsylon);
     187            }
    183188            else
    184189            {
    185190                policyInstance = (IBanditPolicy)Activator.CreateInstance(policy);
    186191            }
    187 
    188 
    189192
    190193            for (int i = 0; i < vm.NrRuns; i++)
     
    428431            Clipboard.SetData(DataFormats.Text, tableExport.ToString());
    429432        }
     433
     434        private void ComboBoxPolicies_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
     435        {
     436            if (vm.SelectedPolicy == typeof (EpsGreedyPolicy))
     437            {
     438                TextBoxEpsylon.Visibility = Visibility.Visible;
     439                TextBlockEpsylon.Visibility = Visibility.Visible;
     440            }
     441            else
     442            {
     443                TextBoxEpsylon.Visibility = Visibility.Hidden;
     444                TextBlockEpsylon.Visibility = Visibility.Hidden;
     445            }
     446        }
    430447    }
    431448}
  • branches/HeuristicLab.Problems.GrammaticalOptimization/Evaluation/ViewModel/EvaluationViewModel.cs

    r12832 r12833  
    119119                this.maxThreads = value;
    120120                this.OnPropertyChanged("MaxThreads");
     121            }
     122        }
     123
     124        private double epsylon;
     125
     126        public double Epsylon
     127        {
     128            get { return this.epsylon; }
     129            set
     130            {
     131                this.epsylon = value;
     132                this.OnPropertyChanged("Epsylon");
    121133            }
    122134        }
Note: See TracChangeset for help on using the changeset viewer.