Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/02/17 22:03:01 (8 years ago)
Author:
pkimmesw
Message:

#2665 Removed "this" qualifier

Location:
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Problem
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Problem/BenchmarkSuite/BenchmarkSuitePushSolutionView.cs

    r14897 r14908  
    3737
    3838    ~BenchmarkSuitePushSolutionView() {
    39       this.interpreter.Dispose();
     39      interpreter.Dispose();
    4040    }
    4141
    4242    private void InitEvents() {
    43       this.exampleComboBox.SelectedIndexChanged += this.SelectedExampleIndexChanged;
    44       this.pushDebugger.OnReset += this.PushDebuggerReset;
     43      exampleComboBox.SelectedIndexChanged += SelectedExampleIndexChanged;
     44      pushDebugger.OnReset += PushDebuggerReset;
    4545    }
    4646
    4747    private void PushDebuggerReset(object sender, IPushInterpreter interpreter) {
    48       if (this.exampleComboBox.SelectedIndex < 0) return;
    49 
    50       var example = Evaluator.Data.Examples[this.exampleComboBox.SelectedIndex];
     48      if (exampleComboBox.SelectedIndex < 0) return;
     49
     50      var example = Evaluator.Data.Examples[exampleComboBox.SelectedIndex];
    5151
    5252      interpreter.BooleanStack.Push(example.InputBoolean);
     
    6262
    6363    private void SelectedExampleIndexChanged(object sender, EventArgs e) {
    64       this.pushDebugger.ResetDebugging();
     64      pushDebugger.ResetDebugging();
    6565    }
    6666
     
    8080
    8181    protected override void OnContentChanged() {
    82       if (this.Content == null) return;
    83 
    84       this.Name = "Push Solution";
    85       this.nameTextBox.Text = this.Name;
    86 
    87       this.pool = new PushInterpreterPool(this.Content.Config);
    88 
    89       if (this.interpreter != null) {
    90         this.interpreter.Dispose();
    91       }
    92 
    93       this.interpreter = this.pool.Create(this.Content.Random);
    94       this.UpdateExamples(Evaluator.Data);
    95 
    96       if (this.exampleComboBox.SelectedIndex < 0) {
    97         this.exampleComboBox.SelectedIndex = 0; // Triggers ResetDebugging via event
    98       }
    99 
    100       this.InitResultGrid();
    101       this.pushDebugger.Content = this.Content;
     82      if (Content == null) return;
     83
     84      Name = "Push Solution";
     85      nameTextBox.Text = Name;
     86
     87      pool = new PushInterpreterPool(Content.Config);
     88
     89      if (interpreter != null) {
     90        interpreter.Dispose();
     91      }
     92
     93      interpreter = pool.Create(Content.Random);
     94      UpdateExamples(Evaluator.Data);
     95
     96      if (exampleComboBox.SelectedIndex < 0) {
     97        exampleComboBox.SelectedIndex = 0; // Triggers ResetDebugging via event
     98      }
     99
     100      InitResultGrid();
     101      pushDebugger.Content = Content;
    102102    }
    103103
    104104    private void InitResultGrid() {
    105       this.resultsDataGrid.Columns.Clear();
    106       this.resultsDataGrid.Rows.Clear();
     105      resultsDataGrid.Columns.Clear();
     106      resultsDataGrid.Rows.Clear();
    107107
    108108      var cellTemplate = new DataGridViewTextBoxCell();
     
    118118
    119119        column.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
    120         this.resultsDataGrid.Columns.Add(column);
     120        resultsDataGrid.Columns.Add(column);
    121121      }
    122122
     
    139139        outputColumn.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
    140140
    141         this.resultsDataGrid.Columns.Add(estimatedOutputColumn);
    142         this.resultsDataGrid.Columns.Add(outputColumn);
     141        resultsDataGrid.Columns.Add(estimatedOutputColumn);
     142        resultsDataGrid.Columns.Add(outputColumn);
    143143      }
    144144
     
    158158      relativeDiffColumn.DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
    159159
    160       this.resultsDataGrid.Columns.Add(absoluteDiffColumn);
    161       this.resultsDataGrid.Columns.Add(relativeDiffColumn);
    162 
    163       using (var pushInterpreter = this.pool.Create(this.Content.Random)) {
     160      resultsDataGrid.Columns.Add(absoluteDiffColumn);
     161      resultsDataGrid.Columns.Add(relativeDiffColumn);
     162
     163      using (var pushInterpreter = pool.Create(Content.Random)) {
    164164        for (var i = 0; i < data.Examples.Length; i++) {
    165165          var example = data.Examples[i];
     
    169169
    170170          row.HeaderCell.Value = row.Index + 1;
    171           row.CreateCells(this.resultsDataGrid);
     171          row.CreateCells(resultsDataGrid);
    172172
    173173          for (var j = 0; j < data.InputArgumentTypes.Length; j++) {
     
    177177          for (var j = 0; j < data.OutputArgumentTypes.Length; j++) {
    178178            row.Cells[data.InputArgumentTypes.Length + j * 2].Value = ViewHelper.StringifyOutput(data.OutputArgumentTypes[j], example, Separator);
    179             row.Cells[data.InputArgumentTypes.Length + j * 2 + 1].Value = this.StringifyResult(data.OutputArgumentTypes[j], pushInterpreter, example, Separator);
     179            row.Cells[data.InputArgumentTypes.Length + j * 2 + 1].Value = StringifyResult(data.OutputArgumentTypes[j], pushInterpreter, example, Separator);
    180180          }
    181181
     
    183183          row.Cells[data.TotalArgumentCount + 2].Value = relativeDiff + "%";
    184184
    185           this.resultsDataGrid.Rows.Add(row);
     185          resultsDataGrid.Rows.Add(row);
    186186          pushInterpreter.Reset();
    187187        }
     
    192192      switch (type) {
    193193        case ExampleArgumentType.Integer:
    194         case ExampleArgumentType.IntegerVector: return interpreter.IntegerStack.IsEmpty ? EmptySign : string.Join(valueSeparator, interpreter.IntegerStack.Peek(this.GetCount(interpreter.IntegerStack, example.OutputInteger)));
     194        case ExampleArgumentType.IntegerVector: return interpreter.IntegerStack.IsEmpty ? EmptySign : string.Join(valueSeparator, interpreter.IntegerStack.Peek(GetCount(interpreter.IntegerStack, example.OutputInteger)));
    195195
    196196        case ExampleArgumentType.Float:
    197         case ExampleArgumentType.FloatVector: return interpreter.FloatStack.IsEmpty ? EmptySign : string.Join(valueSeparator, interpreter.FloatStack.Peek(this.GetCount(interpreter.FloatStack, example.OutputFloat)).Select(d => d.ToString(CultureInfo.CurrentUICulture)));
     197        case ExampleArgumentType.FloatVector: return interpreter.FloatStack.IsEmpty ? EmptySign : string.Join(valueSeparator, interpreter.FloatStack.Peek(GetCount(interpreter.FloatStack, example.OutputFloat)).Select(d => d.ToString(CultureInfo.CurrentUICulture)));
    198198
    199199        case ExampleArgumentType.Boolean: return interpreter.BooleanStack.IsEmpty ? EmptySign : interpreter.BooleanStack.Top.ToString();
     
    201201
    202202        case ExampleArgumentType.String:
    203         case ExampleArgumentType.StringVector: return interpreter.StringStack.IsEmpty ? EmptySign : string.Join(valueSeparator, interpreter.StringStack.Peek(this.GetCount(interpreter.StringStack, example.OutputString)));
     203        case ExampleArgumentType.StringVector: return interpreter.StringStack.IsEmpty ? EmptySign : string.Join(valueSeparator, interpreter.StringStack.Peek(GetCount(interpreter.StringStack, example.OutputString)));
    204204        default: return string.Empty;
    205205      }
     
    211211
    212212    private void UpdateExamples(ProblemData data) {
    213       this.exampleComboBox.Items.Clear();
     213      exampleComboBox.Items.Clear();
    214214      if (data == null) return;
    215215
     
    220220
    221221      foreach (var str in stringRepresentations) {
    222         this.exampleComboBox.Items.Add(str);
     222        exampleComboBox.Items.Add(str);
    223223      }
    224224    }
  • branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Problem/BenchmarkSuite/PushBenchmarkSuiteEvaluator.cs

    r14907 r14908  
    6969
    7070    public void LoadData(ProblemData data) {
    71       this.Data = data;
     71      Data = data;
    7272
    7373      DataBounds.TrainingRange.Start = 0;
  • branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Problem/PushProblem.cs

    r14897 r14908  
    7272
    7373    private void EnabledExpressionsChanged(object sender, EnabledExpressionsChangedEventArgs e) {
    74       this.Encoding.Bounds[0, 1] = config.EnabledExpressions.Count;
    75       this.Encoding.BoundsParameter.Value[0, 1] = config.EnabledExpressions.Count;
     74      Encoding.Bounds[0, 1] = config.EnabledExpressions.Count;
     75      Encoding.BoundsParameter.Value[0, 1] = config.EnabledExpressions.Count;
    7676    }
    7777
     
    228228    public IValueParameter<IntValue> MaxPointsInProgramParameter
    229229    {
    230       get { return (IValueParameter<IntValue>)this.Parameters[MaxPointsInProgramParameterName]; }
     230      get { return (IValueParameter<IntValue>)Parameters[MaxPointsInProgramParameterName]; }
    231231    }
    232232
     
    250250    public IValueParameter<IntValue> MinPointsInProgramParameter
    251251    {
    252       get { return (IValueParameter<IntValue>)this.Parameters[MinPointsInProgramParameterName]; }
     252      get { return (IValueParameter<IntValue>)Parameters[MinPointsInProgramParameterName]; }
    253253    }
    254254
     
    287287    public IValueParameter<BoolValue> TopLevelPushCodeParameter
    288288    {
    289       get { return (IValueParameter<BoolValue>)this.Parameters[TopLevelPushCodeParameterName]; }
     289      get { return (IValueParameter<BoolValue>)Parameters[TopLevelPushCodeParameterName]; }
    290290    }
    291291
     
    305305    public IValueParameter<BoolValue> TopLevelPopCodeParameter
    306306    {
    307       get { return (IValueParameter<BoolValue>)this.Parameters[TopLevelPopCodeParameterName]; }
     307      get { return (IValueParameter<BoolValue>)Parameters[TopLevelPopCodeParameterName]; }
    308308    }
    309309
Note: See TracChangeset for help on using the changeset viewer.