Free cookie consent management tool by TermsFeed Policy Generator

Changeset 7338 for branches


Ignore:
Timestamp:
01/16/12 17:06:32 (13 years ago)
Author:
sforsten
Message:

#1758: first version to change the data set in a model has been implemented

Location:
branches/ChangeDatasetOfRegressionModel
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/ChangeDatasetOfRegressionModel/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Views/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Views-3.4.csproj

    r7122 r7338  
    275275    </BootstrapperPackage>
    276276  </ItemGroup>
     277  <ItemGroup>
     278    <EmbeddedResource Include="SymbolicRegressionSolutionView.resx">
     279      <DependentUpon>SymbolicRegressionSolutionView.cs</DependentUpon>
     280    </EmbeddedResource>
     281  </ItemGroup>
    277282  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
    278283  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
  • branches/ChangeDatasetOfRegressionModel/HeuristicLab.Problems.DataAnalysis.Symbolic.Regression.Views/3.4/SymbolicRegressionSolutionView.Designer.cs

    r5829 r7338  
    3636      //
    3737      //
    38       // splitContainer.Panel1
     38      // splitContainer.Panel2
    3939      //
    40       this.splitContainer.Panel1.Controls.Add(this.btnSimplify);
     40      this.splitContainer.Panel2.Controls.Add(this.btnSimplify);
    4141      this.splitContainer.Size = new System.Drawing.Size(480, 275);
    4242      this.splitContainer.SplitterDistance = 255;
     
    6868      // btnSimplify
    6969      //
    70       this.btnSimplify.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
    71       this.btnSimplify.Location = new System.Drawing.Point(177, 4);
     70      this.btnSimplify.Location = new System.Drawing.Point(3, 4);
    7271      this.btnSimplify.Name = "btnSimplify";
    7372      this.btnSimplify.Size = new System.Drawing.Size(75, 23);
  • branches/ChangeDatasetOfRegressionModel/HeuristicLab.Problems.DataAnalysis.Views/3.4/HeuristicLab.Problems.DataAnalysis.Views-3.4.csproj

    r7097 r7338  
    366366    </BootstrapperPackage>
    367367  </ItemGroup>
     368  <ItemGroup>
     369    <EmbeddedResource Include="Solution Views\RegressionSolutionView.resx">
     370      <DependentUpon>RegressionSolutionView.cs</DependentUpon>
     371    </EmbeddedResource>
     372  </ItemGroup>
    368373  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
    369374  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
  • branches/ChangeDatasetOfRegressionModel/HeuristicLab.Problems.DataAnalysis.Views/3.4/Solution Views/RegressionSolutionView.Designer.cs

    r7259 r7338  
    4545    /// </summary>
    4646    private void InitializeComponent() {
     47      this.btnImport = new System.Windows.Forms.Button();
     48      this.openFileDialog = new System.Windows.Forms.OpenFileDialog();
    4749      ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit();
    4850      this.splitContainer.Panel1.SuspendLayout();
     
    5557      // splitContainer
    5658      //
     59      //
     60      // splitContainer.Panel1
     61      //
     62      this.splitContainer.Panel1.Controls.Add(this.btnImport);
    5763      //
    5864      // itemsGroupBox
     
    6773      //
    6874      this.toolTip.SetToolTip(this.removeButton, "Remove");
     75      //
     76      // btnImport
     77      //
     78      this.btnImport.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     79      this.btnImport.Location = new System.Drawing.Point(172, 4);
     80      this.btnImport.Name = "btnImport";
     81      this.btnImport.Size = new System.Drawing.Size(75, 23);
     82      this.btnImport.TabIndex = 7;
     83      this.btnImport.Text = "Import";
     84      this.btnImport.UseVisualStyleBackColor = true;
     85      this.btnImport.Click += new System.EventHandler(this.btnImport_Click);
     86      //
     87      // openFileDialog
     88      //
     89      this.openFileDialog.Filter = "HL files|*.hl";
     90      this.openFileDialog.Title = "Import ProblemData or Problem...";
    6991      //
    7092      // RegressionSolutionView
     
    84106
    85107    #endregion
     108
     109    private System.Windows.Forms.Button btnImport;
     110    private System.Windows.Forms.OpenFileDialog openFileDialog;
    86111  }
    87112}
  • branches/ChangeDatasetOfRegressionModel/HeuristicLab.Problems.DataAnalysis.Views/3.4/Solution Views/RegressionSolutionView.cs

    r7259 r7338  
    2020#endregion
    2121
     22using System;
     23using System.Collections.Generic;
    2224using System.Windows.Forms;
    2325using HeuristicLab.Core;
    2426using HeuristicLab.MainForm;
     27using HeuristicLab.Persistence.Default.Xml;
     28using HeuristicLab.PluginInfrastructure;
    2529
    2630namespace HeuristicLab.Problems.DataAnalysis.Views {
     
    5054    }
    5155    #endregion
     56
     57    private void btnImport_Click(object sender, System.EventArgs e) {
     58      if (openFileDialog.ShowDialog(this) == DialogResult.OK) {
     59        object hlFile = null;
     60        try {
     61          hlFile = XmlParser.Deserialize(openFileDialog.FileName);
     62        }
     63        catch (Exception ex) {
     64          ErrorHandling.ShowErrorDialog(this, ex);
     65        }
     66        IRegressionProblemData problemData = null;
     67        if (hlFile != null && hlFile is RegressionProblemData) {
     68          problemData = (RegressionProblemData)hlFile;
     69        } else if (hlFile != null && hlFile is IRegressionProblem) {
     70          problemData = ((IRegressionProblem)hlFile).ProblemData;
     71        }
     72        if (problemData != null) {
     73          IList<string> missingVariables = new List<string>();
     74          if (!problemData.TargetVariable.Equals(Content.ProblemData.TargetVariable))
     75            missingVariables.Add(Content.ProblemData.TargetVariable);
     76
     77          //foreach (var item in Content.ProblemData.InputVariables.CheckedItems) {
     78          //  if (!problemData.InputVariables.Contains(item.Value))
     79          //    missingVariables.Add(item.Value.ToString());
     80          //}
     81
     82          //easier solution will be created later
     83          bool found;
     84          foreach (var item in Content.ProblemData.InputVariables.CheckedItems) {
     85            found = false;
     86            foreach (var it in problemData.InputVariables) {
     87              if (it.Value.Equals(item.Value.Value)) {
     88                found = true;
     89                break;
     90              }
     91            }
     92            if (!found)
     93              missingVariables.Add(item.Value.ToString());
     94          }
     95
     96          if (missingVariables.Count != 0) {
     97            string message = "";
     98            foreach (var item in missingVariables) {
     99              message += item + Environment.NewLine;
     100            }
     101            ErrorHandling.ShowErrorDialog(this, new Exception(message));
     102          } else {
     103            Content.ProblemData = problemData;
     104          }
     105        }
     106      }
     107    }
    52108  }
    53109}
Note: See TracChangeset for help on using the changeset viewer.