#region License Information /* HeuristicLab * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL) * * This file is part of HeuristicLab. * * HeuristicLab is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * HeuristicLab is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with HeuristicLab. If not, see . */ #endregion using System; using System.Windows.Forms; using HeuristicLab.Encodings.ConditionActionEncoding; using HeuristicLab.MainForm; using HeuristicLab.MainForm.WindowsForms; namespace HeuristicLab.Problems.LCS.Views { [View("XCS Model")] [Content(typeof(XCSModel), true)] public partial class XCSModelView : AsynchronousContentView { public new XCSModel Content { get { return (XCSModel)base.Content; } set { base.Content = value; } } public XCSModelView() { InitializeComponent(); } protected override void OnContentChanged() { base.OnContentChanged(); UpdateDataGridView(); } private void UpdateDataGridView() { if (InvokeRequired) { Invoke((Action)UpdateDataGridView); } else { if (Content == null) { dataGridView.Rows.Clear(); } else { dataGridView.RowCount = Content.Count; int row = 0; foreach (var xcsClassifier in Content) { dataGridView[0, row].Value = xcsClassifier.Classifier.ToString(); dataGridView[1, row].Value = xcsClassifier.Prediction.ToString(); dataGridView[2, row].Value = xcsClassifier.PredictionError.ToString(); dataGridView[3, row].Value = xcsClassifier.Fitness.ToString(); dataGridView[4, row].Value = xcsClassifier.Numerosity.ToString(); dataGridView[5, row].Value = xcsClassifier.Timestamp.ToString(); dataGridView[6, row].Value = xcsClassifier.Experience.ToString(); dataGridView[7, row].Value = xcsClassifier.AverageActionSetSize.ToString(); row++; } dataGridView.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.ColumnHeader); dataGridView.AutoResizeRowHeadersWidth(DataGridViewRowHeadersWidthSizeMode.AutoSizeToAllHeaders); } } } } }