Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/19/20 19:07:40 (4 years ago)
Author:
fbaching
Message:

#1837: merged changes from trunk

  • apply changes from Attic release to all SlidingWindow specific code files (replace StorableClass with StorableType)
Location:
branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views
Files:
2 deleted
34 edited
2 copied

Legend:

Unmodified
Added
Removed
  • branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views

  • branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Exporters/SymbolicSolutionExcelExporter.cs

    r9994 r17687  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    3030namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Views {
    3131  public class SymbolicSolutionExcelExporter : IDataAnalysisSolutionExporter {
    32     private const string TRAININGSTART = "TrainingStart";
    33     private const string TRAININGEND = "TrainingEnd";
    34     private const string TESTSTART = "TestStart";
    35     private const string TESTEND = "TestEnd";
     32    protected const string TRAININGSTART = "TrainingStart";
     33    protected const string TRAININGEND = "TrainingEnd";
     34    protected const string TESTSTART = "TestStart";
     35    protected const string TESTEND = "TestEnd";
    3636
    3737
     
    4444    }
    4545
    46     public void Export(IDataAnalysisSolution solution, string fileName) {
     46    public virtual void Export(IDataAnalysisSolution solution, string fileName) {
    4747      var symbSolution = solution as ISymbolicDataAnalysisSolution;
    4848      if (symbSolution == null) throw new NotSupportedException("This solution cannot be exported to Excel");
     
    216216    }
    217217
    218     private string Indirect(string column, bool training) {
     218    protected string Indirect(string column, bool training) {
    219219      if (training) {
    220220        return string.Format("INDIRECT(\"'Estimated Values'!{0}\"&{1}+2&\":{0}\"&{2}+1)", column, TRAININGSTART, TRAININGEND);
     
    260260    }
    261261
    262     private void AddModelTreePicture(ExcelWorksheet modelWorksheet, ISymbolicDataAnalysisModel model) {
     262    protected void AddModelTreePicture(ExcelWorksheet modelWorksheet, ISymbolicDataAnalysisModel model) {
    263263      SymbolicExpressionTreeChart modelTreePicture = new SymbolicExpressionTreeChart();
    264264      modelTreePicture.Tree = model.SymbolicExpressionTree;
     
    289289      estimatedWorksheet.Cells[1, 1, 1, 10].AutoFitColumns();
    290290
     291      // fill in id, target variable and unbounded estimated values
    291292      int targetIndex = solution.ProblemData.Dataset.VariableNames.ToList().FindIndex(x => x.Equals(solution.ProblemData.TargetVariable)) + 1;
    292293      for (int i = 0; i < rows; i++) {
    293         estimatedWorksheet.Cells[i + 2, 1].Value = i;
    294         estimatedWorksheet.Cells[i + 2, 2].Formula = datasetWorksheet.Cells[i + 2, targetIndex].FullAddress;
    295         estimatedWorksheet.Cells[i + 2, 9].Formula = string.Format(preparedFormula, i + 2);
     294        estimatedWorksheet.Cells[i + 2, 1].Value = i; // id
     295        estimatedWorksheet.Cells[i + 2, 2].Formula = datasetWorksheet.Cells[i + 2, targetIndex].FullAddress; // target variable
     296        estimatedWorksheet.Cells[i + 2, 9].Formula = string.Format(preparedFormula, i + 2); // unbounded estimated values
    296297      }
    297298      estimatedWorksheet.Cells["B2:B" + (rows + 1)].Style.Numberformat.Format = "0.000";
     
    313314    }
    314315
    315     private string PrepareFormula(string[] formulaParts) {
     316    protected string PrepareFormula(string[] formulaParts) {
    316317      string preparedFormula = formulaParts[0];
    317318      foreach (var part in formulaParts.Skip(2)) {
     
    323324    }
    324325
    325     private void WriteInputSheet(ExcelWorksheet inputsWorksheet, ExcelWorksheet datasetWorksheet, IEnumerable<string> list, Dataset dataset) {
     326    protected void WriteInputSheet(ExcelWorksheet inputsWorksheet, ExcelWorksheet datasetWorksheet, IEnumerable<string> list, IDataset dataset) {
    326327      //remark the performance of EPPlus drops dramatically
    327328      //if the data is not written row wise (from left to right) due the internal indices used.
     
    337338    }
    338339
    339     private void WriteDatasetToExcel(ExcelWorksheet datasetWorksheet, IDataAnalysisProblemData problemData) {
     340    protected void WriteDatasetToExcel(ExcelWorksheet datasetWorksheet, IDataAnalysisProblemData problemData) {
    340341      //remark the performance of EPPlus drops dramatically
    341342      //if the data is not written row wise (from left to right) due the internal indices used.
    342       Dataset dataset = problemData.Dataset;
     343      IDataset dataset = problemData.Dataset;
    343344      var variableNames = dataset.VariableNames.ToList();
    344345      var doubleVariables = new HashSet<string>(dataset.DoubleVariables);
  • branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/GraphicalSymbolicDataAnalysisModelView.cs

    r9708 r17687  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
  • branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/GraphicalSymbolicDataAnalysisModelView.designer.cs

    r9708 r17687  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
  • branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/HeuristicLab.Problems.DataAnalysis.Symbolic.Views-3.4.csproj

    r10724 r17687  
    1111    <RootNamespace>HeuristicLab.Problems.DataAnalysis.Symbolic.Views</RootNamespace>
    1212    <AssemblyName>HeuristicLab.Problems.DataAnalysis.Symbolic.Views-3.4</AssemblyName>
    13     <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
     13    <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
    1414    <TargetFrameworkProfile>
    1515    </TargetFrameworkProfile>
     
    4141    <DebugType>full</DebugType>
    4242    <Optimize>false</Optimize>
    43     <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath>
     43    <OutputPath>..\..\..\..\trunk\bin\</OutputPath>
    4444    <DefineConstants>DEBUG;TRACE</DefineConstants>
    4545    <ErrorReport>prompt</ErrorReport>
    4646    <WarningLevel>4</WarningLevel>
    4747    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
     48    <Prefer32Bit>false</Prefer32Bit>
    4849  </PropertyGroup>
    4950  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    5051    <DebugType>pdbonly</DebugType>
    5152    <Optimize>true</Optimize>
    52     <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath>
     53    <OutputPath>$(SolutionDir)\bin\</OutputPath>
    5354    <DefineConstants>TRACE</DefineConstants>
    5455    <ErrorReport>prompt</ErrorReport>
    5556    <WarningLevel>4</WarningLevel>
    5657    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
     58    <Prefer32Bit>false</Prefer32Bit>
    5759  </PropertyGroup>
    5860  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
     
    6466    <ErrorReport>prompt</ErrorReport>
    6567    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
     68    <Prefer32Bit>false</Prefer32Bit>
    6669  </PropertyGroup>
    6770  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
     
    7376    <ErrorReport>prompt</ErrorReport>
    7477    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
     78    <Prefer32Bit>false</Prefer32Bit>
    7579  </PropertyGroup>
    7680  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
     
    8286    <ErrorReport>prompt</ErrorReport>
    8387    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
     88    <Prefer32Bit>false</Prefer32Bit>
    8489  </PropertyGroup>
    8590  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
     
    9196    <ErrorReport>prompt</ErrorReport>
    9297    <CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
    93   </PropertyGroup>
    94   <ItemGroup>
    95     <Reference Include="ALGLIB-3.7.0">
    96       <HintPath>..\..\..\..\trunk\sources\bin\ALGLIB-3.7.0.dll</HintPath>
     98    <Prefer32Bit>false</Prefer32Bit>
     99  </PropertyGroup>
     100  <ItemGroup>
     101    <Reference Include="ALGLIB-3.7.0, Version=3.7.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     102      <HintPath>..\..\..\..\trunk\bin\ALGLIB-3.7.0.dll</HintPath>
    97103      <Private>False</Private>
    98104    </Reference>
    99     <Reference Include="EPPlus-3.1.3, Version=3.1.3.0, Culture=neutral, PublicKeyToken=ea159fdaa78159a1, processorArchitecture=MSIL">
    100       <SpecificVersion>False</SpecificVersion>
    101       <HintPath>..\..\..\..\trunk\sources\bin\EPPlus-3.1.3.dll</HintPath>
     105    <Reference Include="EPPlus-4.0.3, Version=4.0.3.0, Culture=neutral, PublicKeyToken=ea159fdaa78159a1, processorArchitecture=MSIL">
    102106      <Private>False</Private>
    103107    </Reference>
    104     <Reference Include="HeuristicLab.Analysis-3.3">
    105       <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Analysis-3.3.dll</HintPath>
    106     </Reference>
    107     <Reference Include="HeuristicLab.Analysis.Views-3.3">
    108       <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Analysis.Views-3.3.dll</HintPath>
    109       <Private>False</Private>
     108    <Reference Include="HeuristicLab.Analysis-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     109      <SpecificVersion>False</SpecificVersion>
     110      <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Analysis-3.3.dll</HintPath>
     111    </Reference>
     112    <Reference Include="HeuristicLab.Analysis.Views-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     113      <SpecificVersion>False</SpecificVersion>
     114      <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Analysis.Views-3.3.dll</HintPath>
    110115    </Reference>
    111116    <Reference Include="HeuristicLab.Collections-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
    112       <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Collections-3.3.dll</HintPath>
    113       <Private>False</Private>
     117      <SpecificVersion>False</SpecificVersion>
     118      <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Collections-3.3.dll</HintPath>
    114119    </Reference>
    115120    <Reference Include="HeuristicLab.Common-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
    116       <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Common-3.3.dll</HintPath>
    117       <Private>False</Private>
     121      <SpecificVersion>False</SpecificVersion>
     122      <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Common-3.3.dll</HintPath>
    118123    </Reference>
    119124    <Reference Include="HeuristicLab.Common.Resources-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
    120125      <SpecificVersion>False</SpecificVersion>
    121       <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Common.Resources-3.3.dll</HintPath>
    122       <Private>False</Private>
     126      <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Common.Resources-3.3.dll</HintPath>
    123127    </Reference>
    124128    <Reference Include="HeuristicLab.Core-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
    125       <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Core-3.3.dll</HintPath>
    126       <Private>False</Private>
    127     </Reference>
    128     <Reference Include="HeuristicLab.Core.Views-3.3">
    129       <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Core.Views-3.3.dll</HintPath>
    130       <Private>False</Private>
     129      <SpecificVersion>False</SpecificVersion>
     130      <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Core-3.3.dll</HintPath>
     131    </Reference>
     132    <Reference Include="HeuristicLab.Core.Views-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     133      <SpecificVersion>False</SpecificVersion>
     134      <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Core.Views-3.3.dll</HintPath>
    131135    </Reference>
    132136    <Reference Include="HeuristicLab.Data-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
    133       <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Data-3.3.dll</HintPath>
    134       <Private>False</Private>
    135     </Reference>
    136     <Reference Include="HeuristicLab.Data.Views-3.3">
    137       <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Data.Views-3.3.dll</HintPath>
    138       <Private>False</Private>
     137      <SpecificVersion>False</SpecificVersion>
     138      <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Data-3.3.dll</HintPath>
     139    </Reference>
     140    <Reference Include="HeuristicLab.Data.Views-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     141      <SpecificVersion>False</SpecificVersion>
     142      <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Data.Views-3.3.dll</HintPath>
    139143    </Reference>
    140144    <Reference Include="HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4, Version=3.4.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
    141       <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4.dll</HintPath>
    142       <Private>False</Private>
    143     </Reference>
    144     <Reference Include="HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views-3.4">
    145       <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views-3.4.dll</HintPath>
    146       <Private>False</Private>
    147     </Reference>
    148     <Reference Include="HeuristicLab.MainForm-3.3">
    149       <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.MainForm-3.3.dll</HintPath>
    150       <Private>False</Private>
    151     </Reference>
    152     <Reference Include="HeuristicLab.MainForm.WindowsForms-3.3">
    153       <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.MainForm.WindowsForms-3.3.dll</HintPath>
    154       <Private>False</Private>
     145      <SpecificVersion>False</SpecificVersion>
     146      <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4.dll</HintPath>
     147    </Reference>
     148    <Reference Include="HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views-3.4, Version=3.4.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     149      <SpecificVersion>False</SpecificVersion>
     150      <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views-3.4.dll</HintPath>
     151    </Reference>
     152    <Reference Include="HeuristicLab.MainForm-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     153      <SpecificVersion>False</SpecificVersion>
     154      <HintPath>..\..\..\..\trunk\bin\HeuristicLab.MainForm-3.3.dll</HintPath>
     155    </Reference>
     156    <Reference Include="HeuristicLab.MainForm.WindowsForms-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     157      <SpecificVersion>False</SpecificVersion>
     158      <HintPath>..\..\..\..\trunk\bin\HeuristicLab.MainForm.WindowsForms-3.3.dll</HintPath>
    155159    </Reference>
    156160    <Reference Include="HeuristicLab.Optimization-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
    157       <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Optimization-3.3.dll</HintPath>
    158       <Private>False</Private>
    159     </Reference>
    160     <Reference Include="HeuristicLab.Optimization.Views-3.3">
    161       <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Optimization.Views-3.3.dll</HintPath>
    162       <Private>False</Private>
    163     </Reference>
    164     <Reference Include="HeuristicLab.Optimizer-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
    165       <SpecificVersion>False</SpecificVersion>
    166       <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Optimizer-3.3.dll</HintPath>
    167       <Private>False</Private>
    168     </Reference>
    169     <Reference Include="HeuristicLab.Parameters-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
    170       <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Parameters-3.3.dll</HintPath>
    171       <Private>False</Private>
    172     </Reference>
    173     <Reference Include="HeuristicLab.Parameters.Views-3.3">
    174       <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Parameters.Views-3.3.dll</HintPath>
    175       <Private>False</Private>
     161      <SpecificVersion>False</SpecificVersion>
     162      <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Optimization-3.3.dll</HintPath>
     163    </Reference>
     164    <Reference Include="HeuristicLab.Optimization.Views-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     165      <SpecificVersion>False</SpecificVersion>
     166      <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Optimization.Views-3.3.dll</HintPath>
    176167    </Reference>
    177168    <Reference Include="HeuristicLab.PluginInfrastructure-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
    178       <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.PluginInfrastructure-3.3.dll</HintPath>
    179       <Private>False</Private>
     169      <SpecificVersion>False</SpecificVersion>
     170      <HintPath>..\..\..\..\trunk\bin\HeuristicLab.PluginInfrastructure-3.3.dll</HintPath>
    180171    </Reference>
    181172    <Reference Include="HeuristicLab.Problems.DataAnalysis-3.4, Version=3.4.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
    182       <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Problems.DataAnalysis-3.4.dll</HintPath>
    183       <Private>False</Private>
     173      <SpecificVersion>False</SpecificVersion>
     174      <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Problems.DataAnalysis-3.4.dll</HintPath>
    184175    </Reference>
    185176    <Reference Include="HeuristicLab.Visualization.ChartControlsExtensions-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
    186       <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Visualization.ChartControlsExtensions-3.3.dll</HintPath>
    187       <Private>False</Private>
     177      <SpecificVersion>False</SpecificVersion>
     178      <HintPath>..\..\..\..\trunk\bin\HeuristicLab.Visualization.ChartControlsExtensions-3.3.dll</HintPath>
    188179    </Reference>
    189180    <Reference Include="System" />
     
    194185    <Reference Include="System.Windows.Forms" />
    195186    <Reference Include="System.Windows.Forms.DataVisualization" />
    196     <Reference Include="System.Xml.Linq">
    197       <RequiredTargetFramework>3.5</RequiredTargetFramework>
    198     </Reference>
    199     <Reference Include="System.Data.DataSetExtensions">
    200       <RequiredTargetFramework>3.5</RequiredTargetFramework>
    201     </Reference>
    202     <Reference Include="System.Data" />
    203     <Reference Include="System.Xml" />
    204   </ItemGroup>
    205   <ItemGroup>
     187  </ItemGroup>
     188  <ItemGroup>
     189    <Compile Include="Exporters\SymbolicSolutionExcelExporter.cs" />
    206190    <Compile Include="InteractiveSymbolicExpressionTreeChart.cs">
    207191      <SubType>UserControl</SubType>
     
    210194      <DependentUpon>InteractiveSymbolicExpressionTreeChart.cs</DependentUpon>
    211195    </Compile>
    212     <Compile Include="MathSymbolicDataAnalysisModelView.cs">
    213       <SubType>UserControl</SubType>
    214     </Compile>
    215     <Compile Include="MathSymbolicDataAnalysisModelView.designer.cs">
    216       <DependentUpon>MathSymbolicDataAnalysisModelView.cs</DependentUpon>
    217     </Compile>
    218     <Compile Include="Plugin.cs" />
    219196    <Compile Include="SlidingWindow\SlidingWindowBestSolutionsCollectionHeatMapControl.cs">
    220197      <SubType>UserControl</SubType>
     
    241218      <DependentUpon>SlidingWindowDataView.cs</DependentUpon>
    242219    </Compile>
     220    <Compile Include="SymbolicDataAnalysisModelMathView.cs">
     221      <SubType>UserControl</SubType>
     222    </Compile>
     223    <Compile Include="SymbolicDataAnalysisModelMathView.designer.cs">
     224      <DependentUpon>SymbolicDataAnalysisModelMathView.cs</DependentUpon>
     225    </Compile>
     226    <Compile Include="Plugin.cs" />
    243227    <Compile Include="TextualSymbolicDataAnalysisModelView.cs">
    244228      <SubType>UserControl</SubType>
     
    317301    </Compile>
    318302    <Compile Include="Properties\AssemblyInfo.cs" />
    319   </ItemGroup>
    320   <ItemGroup>
    321     <ProjectReference Include="..\..\HeuristicLab.Problems.DataAnalysis.Symbolic\3.4\HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.csproj">
    322       <Project>{3D28463F-EC96-4D82-AFEE-38BE91A0CA00}</Project>
    323       <Name>HeuristicLab.Problems.DataAnalysis.Symbolic-3.4</Name>
    324       <Private>False</Private>
    325     </ProjectReference>
    326303  </ItemGroup>
    327304  <ItemGroup>
     
    348325  </ItemGroup>
    349326  <ItemGroup>
    350     <Folder Include="Exporters\" />
     327    <ProjectReference Include="..\..\HeuristicLab.Problems.DataAnalysis.Symbolic\3.4\HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.csproj">
     328      <Project>{3d28463f-ec96-4d82-afee-38be91a0ca00}</Project>
     329      <Name>HeuristicLab.Problems.DataAnalysis.Symbolic-3.4</Name>
     330    </ProjectReference>
    351331  </ItemGroup>
    352332  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
     
    373353</PreBuildEvent>
    374354  </PropertyGroup>
     355  <PropertyGroup>
     356    <PreBuildEvent />
     357  </PropertyGroup>
    375358</Project>
  • branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicDataAnalysisSolutionSimplifierView.Designer.cs

    r10681 r17687  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    4747    private void InitializeComponent() {
    4848      this.components = new System.ComponentModel.Container();
     49      System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(InteractiveSymbolicDataAnalysisSolutionSimplifierView));
    4950      this.viewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost();
    5051      this.splitContainer = new System.Windows.Forms.SplitContainer();
     
    5253      this.treeStatusValue = new System.Windows.Forms.Label();
    5354      this.flowLayoutPanel = new System.Windows.Forms.FlowLayoutPanel();
     55      this.btnSimplify = new System.Windows.Forms.Button();
    5456      this.btnOptimizeConstants = new System.Windows.Forms.Button();
    55       this.btnSimplify = new System.Windows.Forms.Button();
    56       this.treeStatusLabel = new System.Windows.Forms.Label();
    57       this.treeChart = new HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views.SymbolicExpressionTreeChart();
    5857      this.grpViewHost = new System.Windows.Forms.GroupBox();
     58      this.treeChart = new HeuristicLab.Problems.DataAnalysis.Symbolic.Views.InteractiveSymbolicExpressionTreeChart();
     59      this.toolTip = new System.Windows.Forms.ToolTip(this.components);
    5960      ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit();
    6061      this.splitContainer.Panel1.SuspendLayout();
     
    104105      this.grpSimplify.Controls.Add(this.treeStatusValue);
    105106      this.grpSimplify.Controls.Add(this.flowLayoutPanel);
    106       this.grpSimplify.Controls.Add(this.treeStatusLabel);
    107107      this.grpSimplify.Controls.Add(this.treeChart);
    108108      this.grpSimplify.Dock = System.Windows.Forms.DockStyle.Fill;
     
    116116      // treeStatusValue
    117117      //
     118      this.treeStatusValue.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
    118119      this.treeStatusValue.AutoSize = true;
    119       this.treeStatusValue.BackColor = System.Drawing.Color.Transparent;
    120       this.treeStatusValue.ForeColor = System.Drawing.Color.Green;
    121       this.treeStatusValue.Location = new System.Drawing.Point(72, 16);
     120      this.treeStatusValue.BackColor = System.Drawing.Color.White;
     121      this.treeStatusValue.ForeColor = System.Drawing.Color.Red;
     122      this.treeStatusValue.Location = new System.Drawing.Point(6, 351);
    122123      this.treeStatusValue.Name = "treeStatusValue";
    123       this.treeStatusValue.Size = new System.Drawing.Size(30, 13);
     124      this.treeStatusValue.Size = new System.Drawing.Size(63, 13);
    124125      this.treeStatusValue.TabIndex = 3;
    125       this.treeStatusValue.Text = "Valid";
     126      this.treeStatusValue.Text = "Invalid Tree";
     127      this.treeStatusValue.Visible = false;
    126128      //
    127129      // flowLayoutPanel
     
    137139      this.flowLayoutPanel.WrapContents = false;
    138140      //
    139       // btnOptimizeConstants
    140       //       
    141       this.btnOptimizeConstants.AutoSize = true;
    142       this.btnOptimizeConstants.Enabled = false;
    143       this.btnOptimizeConstants.Image = HeuristicLab.Common.Resources.VSImageLibrary.Performance;
    144       this.btnOptimizeConstants.ImageAlign = System.Drawing.ContentAlignment.MiddleCenter;
    145       this.btnOptimizeConstants.Location = new System.Drawing.Point(105, 3);
    146       this.btnOptimizeConstants.Name = "btnOptimizeConstants";
    147       this.btnOptimizeConstants.Size = new System.Drawing.Size(80, 24);
    148       this.btnOptimizeConstants.TabIndex = 2;
    149       this.btnOptimizeConstants.Text = "Optimize";
    150       this.btnOptimizeConstants.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
    151       this.btnOptimizeConstants.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
    152       this.btnOptimizeConstants.UseVisualStyleBackColor = true;
    153       this.btnOptimizeConstants.Click += new System.EventHandler(this.btnOptimizeConstants_Click);
    154       //
    155141      // btnSimplify
    156142      //
    157143      this.btnSimplify.AutoSize = true;
    158       this.btnSimplify.Enabled = true;
    159144      this.btnSimplify.Image = HeuristicLab.Common.Resources.VSImageLibrary.FormulaEvaluator;
    160       this.btnSimplify.ImageAlign = System.Drawing.ContentAlignment.MiddleCenter;
    161145      this.btnSimplify.Location = new System.Drawing.Point(3, 3);
    162146      this.btnSimplify.Name = "btnSimplify";
     
    164148      this.btnSimplify.TabIndex = 1;
    165149      this.btnSimplify.Text = "Simplify";
    166       this.btnSimplify.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
    167150      this.btnSimplify.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
     151      this.toolTip.SetToolTip(this.btnSimplify, "Simplifies the model structure based on mathematical simplification rules.");
    168152      this.btnSimplify.UseVisualStyleBackColor = true;
    169153      this.btnSimplify.Click += new System.EventHandler(this.btnSimplify_Click);
    170154      //
    171       // treeStatusLabel
    172       //
    173       this.treeStatusLabel.AutoSize = true;
    174       this.treeStatusLabel.BackColor = System.Drawing.Color.Transparent;
    175       this.treeStatusLabel.Location = new System.Drawing.Point(6, 16);
    176       this.treeStatusLabel.Name = "treeStatusLabel";
    177       this.treeStatusLabel.Size = new System.Drawing.Size(68, 13);
    178       this.treeStatusLabel.TabIndex = 2;
    179       this.treeStatusLabel.Text = "Tree Status: ";
    180       //
    181       // treeChart
    182       //
    183       this.treeChart.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
    184             | System.Windows.Forms.AnchorStyles.Left)
    185             | System.Windows.Forms.AnchorStyles.Right)));
    186       this.treeChart.BackgroundColor = System.Drawing.Color.White;
    187       this.treeChart.LineColor = System.Drawing.Color.Black;
    188       this.treeChart.Location = new System.Drawing.Point(6, 32);
    189       this.treeChart.Name = "treeChart";
    190       this.treeChart.Size = new System.Drawing.Size(201, 332);
    191       this.treeChart.Spacing = 5;
    192       this.treeChart.SuspendRepaint = false;
    193       this.treeChart.TabIndex = 0;
    194       this.treeChart.TextFont = new System.Drawing.Font("Times New Roman", 8F);
    195       this.treeChart.Tree = null;
    196       this.treeChart.SymbolicExpressionTreeNodeDoubleClicked += new System.Windows.Forms.MouseEventHandler(this.treeChart_SymbolicExpressionTreeNodeDoubleClicked);
     155      // btnOptimizeConstants
     156      //
     157      this.btnOptimizeConstants.AutoSize = true;
     158      this.btnOptimizeConstants.Enabled = false;
     159      this.btnOptimizeConstants.Image = HeuristicLab.Common.Resources.VSImageLibrary.Performance;
     160      this.btnOptimizeConstants.Location = new System.Drawing.Point(89, 3);
     161      this.btnOptimizeConstants.Name = "btnOptimizeConstants";
     162      this.btnOptimizeConstants.Size = new System.Drawing.Size(80, 24);
     163      this.btnOptimizeConstants.TabIndex = 2;
     164      this.btnOptimizeConstants.Text = "Optimize";
     165      this.btnOptimizeConstants.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
     166      this.toolTip.SetToolTip(this.btnOptimizeConstants, "Optimizes the numerical constants of the model. \r\nIf the algorithm converges, opt" +
     167        "imization is stopped.");
     168      this.btnOptimizeConstants.UseVisualStyleBackColor = true;
     169      this.btnOptimizeConstants.Click += new System.EventHandler(this.btnOptimizeConstants_Click);
    197170      //
    198171      // grpViewHost
     
    206179      this.grpViewHost.TabStop = false;
    207180      this.grpViewHost.Text = "Details";
     181      //
     182      // treeChart
     183      //
     184      this.treeChart.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     185            | System.Windows.Forms.AnchorStyles.Left)
     186            | System.Windows.Forms.AnchorStyles.Right)));
     187      this.treeChart.BackgroundColor = System.Drawing.Color.White;
     188      this.treeChart.LineColor = System.Drawing.Color.Black;
     189      this.treeChart.Location = new System.Drawing.Point(6, 16);
     190      this.treeChart.ModifyTree = null;
     191      this.treeChart.Name = "treeChart";
     192      this.treeChart.Size = new System.Drawing.Size(201, 348);
     193      this.treeChart.SuspendRepaint = false;
     194      this.treeChart.TabIndex = 0;
     195      this.treeChart.TextFont = new System.Drawing.Font("Times New Roman", 8F);
     196      this.treeChart.Tree = null;
     197      this.treeChart.SymbolicExpressionTreeNodeDoubleClicked += new System.Windows.Forms.MouseEventHandler(this.treeChart_SymbolicExpressionTreeNodeDoubleClicked);
    208198      //
    209199      // InteractiveSymbolicDataAnalysisSolutionSimplifierView
     
    223213      this.grpSimplify.PerformLayout();
    224214      this.flowLayoutPanel.ResumeLayout(false);
     215      this.flowLayoutPanel.PerformLayout();
    225216      this.grpViewHost.ResumeLayout(false);
    226217      this.ResumeLayout(false);
     
    230221    #endregion
    231222
    232     private HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views.SymbolicExpressionTreeChart treeChart;
     223    private HeuristicLab.Problems.DataAnalysis.Symbolic.Views.InteractiveSymbolicExpressionTreeChart treeChart;
    233224    private System.Windows.Forms.SplitContainer splitContainer;
    234225    private HeuristicLab.MainForm.WindowsForms.ViewHost viewHost;
     
    239230    protected System.Windows.Forms.Button btnOptimizeConstants;
    240231    private System.Windows.Forms.Label treeStatusValue;
    241     private System.Windows.Forms.Label treeStatusLabel;
     232    private System.Windows.Forms.ToolTip toolTip;
    242233  }
    243234}
  • branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicDataAnalysisSolutionSimplifierView.cs

    r10681 r17687  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    2424using System.Drawing;
    2525using System.Linq;
     26using System.Threading;
     27using System.Threading.Tasks;
    2628using System.Windows.Forms;
    2729using HeuristicLab.Common;
    2830using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    2931using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views;
     32using HeuristicLab.MainForm;
    3033using HeuristicLab.MainForm.WindowsForms;
    3134
    3235namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Views {
    3336  public abstract partial class InteractiveSymbolicDataAnalysisSolutionSimplifierView : AsynchronousContentView {
    34     private Dictionary<ISymbolicExpressionTreeNode, ISymbolicExpressionTreeNode> foldedNodes;
    35     private Dictionary<ISymbolicExpressionTreeNode, double> nodeImpacts;
     37    private readonly Dictionary<ISymbolicExpressionTreeNode, ISymbolicExpressionTreeNode> foldedNodes = new Dictionary<ISymbolicExpressionTreeNode, ISymbolicExpressionTreeNode>();
     38    private readonly Dictionary<ISymbolicExpressionTreeNode, ISymbolicExpressionTreeNode> changedNodes = new Dictionary<ISymbolicExpressionTreeNode, ISymbolicExpressionTreeNode>();
     39    private readonly Dictionary<ISymbolicExpressionTreeNode, Interval> nodeIntervals = new Dictionary<ISymbolicExpressionTreeNode, Interval>();
     40    private readonly Dictionary<ISymbolicExpressionTreeNode, double> nodeImpacts = new Dictionary<ISymbolicExpressionTreeNode, double>();
     41
     42    private readonly ISymbolicDataAnalysisSolutionImpactValuesCalculator impactCalculator;
     43
     44    private readonly Progress progress = new Progress();
     45    private CancellationTokenSource cancellationTokenSource;
     46
    3647    private enum TreeState { Valid, Invalid }
    37 
    38     public InteractiveSymbolicDataAnalysisSolutionSimplifierView() {
     48    private TreeState treeState;
     49
     50    protected InteractiveSymbolicDataAnalysisSolutionSimplifierView(ISymbolicDataAnalysisSolutionImpactValuesCalculator impactCalculator) {
    3951      InitializeComponent();
    40       foldedNodes = new Dictionary<ISymbolicExpressionTreeNode, ISymbolicExpressionTreeNode>();
    41       nodeImpacts = new Dictionary<ISymbolicExpressionTreeNode, double>();
    4252      this.Caption = "Interactive Solution Simplifier";
     53      this.impactCalculator = impactCalculator;
     54
     55      // initialize the tree modifier that will be used to perform edit operations over the tree
     56      treeChart.ModifyTree = Modify;
     57    }
     58
     59    /// <summary>
     60    /// Remove, Replace or Insert subtrees
     61    /// </summary>
     62    /// <param name="tree">The symbolic expression tree</param>
     63    /// <param name="parent">The insertion point (ie, the parent node who will receive a new child)</param>
     64    /// <param name="oldChild">The subtree to be replaced</param>
     65    /// <param name="newChild">The replacement subtree</param>
     66    /// <param name="removeSubtree">Flag used to indicate if whole subtrees should be removed (default behavior), or just the subtree root</param>
     67    private void Modify(ISymbolicExpressionTree tree, ISymbolicExpressionTreeNode parent,
     68      ISymbolicExpressionTreeNode oldChild, ISymbolicExpressionTreeNode newChild, bool removeSubtree = true) {
     69      if (oldChild == null && newChild == null)
     70        throw new ArgumentNullException("Cannot deduce operation type from the arguments. Please provide non null operands.");
     71      if (oldChild == null) {
     72        // insertion operation
     73        parent.AddSubtree(newChild);
     74        newChild.Parent = parent;
     75      } else if (newChild == null) {
     76        // removal operation
     77        parent.RemoveSubtree(parent.IndexOfSubtree(oldChild));
     78        if (!removeSubtree) {
     79          for (int i = oldChild.SubtreeCount - 1; i >= 0; --i) {
     80            var subtree = oldChild.GetSubtree(i);
     81            oldChild.RemoveSubtree(i);
     82            parent.AddSubtree(subtree);
     83          }
     84        }
     85      } else {
     86        // replacement operation
     87        var replacementIndex = parent.IndexOfSubtree(oldChild);
     88        parent.RemoveSubtree(replacementIndex);
     89        parent.InsertSubtree(replacementIndex, newChild);
     90        newChild.Parent = parent;
     91        if (changedNodes.ContainsKey(oldChild)) {
     92          changedNodes.Add(newChild, changedNodes[oldChild]); // so that on double click the original node is restored
     93          changedNodes.Remove(oldChild);
     94        } else {
     95          changedNodes.Add(newChild, oldChild);
     96        }
     97      }
     98      treeState = IsValid(tree) ? TreeState.Valid : TreeState.Invalid;
     99      switch (treeState) {
     100        case TreeState.Valid:
     101          this.grpViewHost.Enabled = true;
     102          UpdateModel(Content.Model.SymbolicExpressionTree);
     103          break;
     104        case TreeState.Invalid:
     105          this.grpViewHost.Enabled = false;
     106          break;
     107      }
     108    }
     109
     110    // the optimizer always assumes 2 children for multiplication and addition nodes
     111    // thus, we enforce that the tree stays valid so that the constant optimization won't throw an exception
     112    // by returning 2 as the minimum allowed arity for addition and multiplication symbols
     113    private readonly Func<ISymbol, int> GetMinArity = symbol => {
     114      var min = symbol.MinimumArity;
     115      if (symbol is Multiplication || symbol is Division) return Math.Max(2, min);
     116      return min;
     117    };
     118    private bool IsValid(ISymbolicExpressionTree tree) {
     119      treeChart.Tree = tree;
     120      treeChart.Repaint();
     121      // check if all nodes have a legal arity
     122      var nodes = tree.IterateNodesPostfix().ToList();
     123      bool valid = !nodes.Any(node => node.SubtreeCount < GetMinArity(node.Symbol) || node.SubtreeCount > node.Symbol.MaximumArity);
     124
     125      if (valid) {
     126        // check if all variables are contained in the dataset
     127        var variables = new HashSet<string>(Content.ProblemData.Dataset.DoubleVariables);
     128        valid = nodes.OfType<VariableTreeNode>().All(x => variables.Contains(x.VariableName));
     129      }
     130
     131      if (valid) {
     132        btnOptimizeConstants.Enabled = true;
     133        btnSimplify.Enabled = true;
     134        treeStatusValue.Visible = false;
     135      } else {
     136        btnOptimizeConstants.Enabled = false;
     137        btnSimplify.Enabled = false;
     138        treeStatusValue.Visible = true;
     139      }
     140      this.Refresh();
     141      return valid;
    43142    }
    44143
     
    53152      Content.ProblemDataChanged += Content_Changed;
    54153      treeChart.Repainted += treeChart_Repainted;
     154      Progress.ShowOnControl(grpSimplify, progress);
     155      progress.StopRequested += progress_StopRequested;
    55156    }
    56157    protected override void DeregisterContentEvents() {
     
    59160      Content.ProblemDataChanged -= Content_Changed;
    60161      treeChart.Repainted -= treeChart_Repainted;
     162      Progress.HideFromControl(grpSimplify, false);
     163      progress.StopRequested -= progress_StopRequested;
    61164    }
    62165
    63166    private void Content_Changed(object sender, EventArgs e) {
    64167      UpdateView();
     168      SetEnabledStateOfControls();
    65169    }
    66170
    67171    protected override void OnContentChanged() {
    68172      base.OnContentChanged();
    69       foldedNodes = new Dictionary<ISymbolicExpressionTreeNode, ISymbolicExpressionTreeNode>();
     173      foldedNodes.Clear();
     174      changedNodes.Clear();
     175      nodeIntervals.Clear();
     176      nodeImpacts.Clear();
    70177      UpdateView();
    71178      viewHost.Content = this.Content;
     
    77184    }
    78185
    79     private void UpdateView() {
     186    private void progress_StopRequested(object sender, EventArgs e) {
     187      cancellationTokenSource.Cancel();
     188    }
     189
     190    private async void UpdateView() {
    80191      if (Content == null || Content.Model == null || Content.ProblemData == null) return;
    81192      var tree = Content.Model.SymbolicExpressionTree;
    82193      treeChart.Tree = tree.Root.SubtreeCount > 1 ? new SymbolicExpressionTree(tree.Root) : new SymbolicExpressionTree(tree.Root.GetSubtree(0).GetSubtree(0));
    83194
    84       var impactAndReplacementValues = CalculateImpactAndReplacementValues(tree);
    85       nodeImpacts = impactAndReplacementValues.ToDictionary(x => x.Key, x => x.Value.Item1);
    86       var replacementValues = impactAndReplacementValues.ToDictionary(x => x.Key, x => x.Value.Item2);
    87       foreach (var pair in replacementValues.Where(pair => !(pair.Key is ConstantTreeNode))) {
    88         foldedNodes[pair.Key] = MakeConstantTreeNode(pair.Value);
    89       }
     195      progress.Start("Calculate Impact and Replacement Values ...");
     196      cancellationTokenSource = new CancellationTokenSource();
     197      progress.CanBeStopped = true;
     198      try {
     199        var impactAndReplacementValues = await Task.Run(() => CalculateImpactAndReplacementValues(tree));
     200        try {
     201          await Task.Delay(300, cancellationTokenSource.Token); // wait for progressbar to finish animation
     202        } catch (OperationCanceledException) { }
     203
     204        var replacementValues = impactAndReplacementValues.ToDictionary(x => x.Key, x => x.Value.Item2);
     205        foreach (var pair in replacementValues.Where(pair => !(pair.Key is ConstantTreeNode))) {
     206          foldedNodes[pair.Key] = MakeConstantTreeNode(pair.Value);
     207        }
     208       
     209        foreach (var pair in impactAndReplacementValues) {
     210          nodeImpacts[pair.Key] = pair.Value.Item1;
     211        }
     212
     213        if (IntervalInterpreter.IsCompatible(tree)) {
     214          var regressionProblemData = Content.ProblemData as IRegressionProblemData;
     215          if (regressionProblemData != null) {
     216            var interpreter = new IntervalInterpreter();
     217            var variableRanges = regressionProblemData.VariableRanges.GetReadonlyDictionary();
     218            IDictionary<ISymbolicExpressionTreeNode, Interval> intervals;
     219            interpreter.GetSymbolicExpressionTreeIntervals(tree, variableRanges, out intervals);
     220            foreach (var kvp in intervals) {
     221              nodeIntervals[kvp.Key] = kvp.Value;
     222            }
     223          }
     224        }
     225      } finally {
     226        progress.Finish();
     227      }
     228
     229      progress.CanBeStopped = false;
    90230      PaintNodeImpacts();
    91231    }
    92232
    93     protected abstract Dictionary<ISymbolicExpressionTreeNode, double> CalculateReplacementValues(ISymbolicExpressionTree tree);
    94     protected abstract Dictionary<ISymbolicExpressionTreeNode, double> CalculateImpactValues(ISymbolicExpressionTree tree);
    95     protected abstract Dictionary<ISymbolicExpressionTreeNode, Tuple<double, double>> CalculateImpactAndReplacementValues(ISymbolicExpressionTree tree);
     233    protected virtual Dictionary<ISymbolicExpressionTreeNode, Tuple<double, double>> CalculateImpactAndReplacementValues(ISymbolicExpressionTree tree) {
     234      var impactAndReplacementValues = new Dictionary<ISymbolicExpressionTreeNode, Tuple<double, double>>();
     235      foreach (var node in tree.Root.GetSubtree(0).GetSubtree(0).IterateNodesPrefix()) {
     236        if (progress.ProgressState == ProgressState.StopRequested) continue;
     237        double impactValue, replacementValue, newQualityForImpactsCalculation;
     238        impactCalculator.CalculateImpactAndReplacementValues(Content.Model, node, Content.ProblemData, Content.ProblemData.TrainingIndices, out impactValue, out replacementValue, out newQualityForImpactsCalculation);
     239        double newProgressValue = progress.ProgressValue + 1.0 / (tree.Length - 2);
     240        progress.ProgressValue = Math.Min(newProgressValue, 1);
     241        impactAndReplacementValues.Add(node, new Tuple<double, double>(impactValue, replacementValue));
     242      }
     243      return impactAndReplacementValues;
     244    }
     245
    96246    protected abstract void UpdateModel(ISymbolicExpressionTree tree);
     247
     248    protected virtual ISymbolicExpressionTree OptimizeConstants(ISymbolicExpressionTree tree, IProgress progress) {
     249      return tree;
     250    }
    97251
    98252    private static ConstantTreeNode MakeConstantTreeNode(double value) {
     
    104258
    105259    private void treeChart_SymbolicExpressionTreeNodeDoubleClicked(object sender, MouseEventArgs e) {
     260      if (treeState == TreeState.Invalid) return;
    106261      var visualNode = (VisualTreeNode<ISymbolicExpressionTreeNode>)sender;
     262      if (visualNode.Content == null) { throw new Exception("VisualNode content cannot be null."); }
    107263      var symbExprTreeNode = (SymbolicExpressionTreeNode)visualNode.Content;
    108       if (symbExprTreeNode == null) return;
    109264      var tree = Content.Model.SymbolicExpressionTree;
    110265      var parent = symbExprTreeNode.Parent;
    111266      int indexOfSubtree = parent.IndexOfSubtree(symbExprTreeNode);
    112       if (foldedNodes.ContainsKey(symbExprTreeNode)) {
     267      if (changedNodes.ContainsKey(symbExprTreeNode)) {
     268        // undo node change
     269        parent.RemoveSubtree(indexOfSubtree);
     270        var originalNode = changedNodes[symbExprTreeNode];
     271        parent.InsertSubtree(indexOfSubtree, originalNode);
     272        changedNodes.Remove(symbExprTreeNode);
     273      } else if (foldedNodes.ContainsKey(symbExprTreeNode)) {
    113274        // undo node folding
    114275        SwitchNodeWithReplacementNode(parent, indexOfSubtree);
     
    119280    private void SwitchNodeWithReplacementNode(ISymbolicExpressionTreeNode parent, int subTreeIndex) {
    120281      ISymbolicExpressionTreeNode subTree = parent.GetSubtree(subTreeIndex);
    121       parent.RemoveSubtree(subTreeIndex);
    122282      if (foldedNodes.ContainsKey(subTree)) {
     283        parent.RemoveSubtree(subTreeIndex);
    123284        var replacementNode = foldedNodes[subTree];
    124285        parent.InsertSubtree(subTreeIndex, replacementNode);
     
    133294      double max = impacts.Max();
    134295      double min = impacts.Min();
    135       foreach (var treeNode in Content.Model.SymbolicExpressionTree.IterateNodesPostfix()) {
     296      foreach (ISymbolicExpressionTreeNode treeNode in Content.Model.SymbolicExpressionTree.IterateNodesPostfix()) {
    136297        VisualTreeNode<ISymbolicExpressionTreeNode> visualTree = treeChart.GetVisualSymbolicExpressionTreeNode(treeNode);
    137298
    138299        if (!(treeNode is ConstantTreeNode) && nodeImpacts.ContainsKey(treeNode)) {
     300          visualTree.ToolTip = visualTree.Content.ToString();
    139301          double impact = nodeImpacts[treeNode];
    140302
     
    157319          }
    158320        }
    159         if (visualTree != null)
    160           if (treeNode is ConstantTreeNode && foldedNodes.ContainsKey(treeNode)) {
     321        if (visualTree != null) {
     322          if (nodeIntervals.ContainsKey(treeNode))
     323            visualTree.ToolTip += String.Format($"{Environment.NewLine}Intervals: [{nodeIntervals[treeNode].LowerBound:G5} ... {nodeIntervals[treeNode].UpperBound:G5}]");
     324          if (changedNodes.ContainsKey(treeNode)) {
     325            visualTree.LineColor = Color.DodgerBlue;
     326          } else if (treeNode is ConstantTreeNode && foldedNodes.ContainsKey(treeNode)) {
    161327            visualTree.LineColor = Color.DarkOrange;
    162328          }
     329        }
    163330      }
    164331      treeChart.RepaintNodes();
     
    166333
    167334    private void btnSimplify_Click(object sender, EventArgs e) {
    168       var simplifier = new SymbolicDataAnalysisExpressionTreeSimplifier();
    169       var simplifiedExpressionTree = simplifier.Simplify(Content.Model.SymbolicExpressionTree);
     335      var simplifiedExpressionTree = TreeSimplifier.Simplify(Content.Model.SymbolicExpressionTree);
    170336      UpdateModel(simplifiedExpressionTree);
    171337    }
    172338
    173     protected abstract void btnOptimizeConstants_Click(object sender, EventArgs e);
     339    private async void btnOptimizeConstants_Click(object sender, EventArgs e) {
     340      progress.Start("Optimizing Constants ...");
     341      cancellationTokenSource = new CancellationTokenSource();
     342      progress.CanBeStopped = true;
     343      try {
     344        var tree = (ISymbolicExpressionTree)Content.Model.SymbolicExpressionTree.Clone();
     345
     346        var newTree = await Task.Run(() => OptimizeConstants(tree, progress));
     347        try {
     348          await Task.Delay(300, cancellationTokenSource.Token); // wait for progressbar to finish animation
     349        } catch (OperationCanceledException) { }
     350        UpdateModel(newTree); // triggers progress.Finish after calculating the node impacts when model is changed
     351      } catch {
     352        progress.Finish();
     353      }
     354    }
    174355  }
    175356}
  • branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicExpressionTreeChart.Designer.cs

    r9708 r17687  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    5656      this.toolStripSeparator = new System.Windows.Forms.ToolStripSeparator();
    5757      this.copyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
     58      this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
     59      this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
    5860      this.SuspendLayout();
    5961      //
     
    6163      //
    6264      this.insertNodeToolStripMenuItem.Name = "insertNodeToolStripMenuItem";
    63       this.insertNodeToolStripMenuItem.Size = new System.Drawing.Size(147, 22);
     65      this.insertNodeToolStripMenuItem.Size = new System.Drawing.Size(165, 22);
    6466      this.insertNodeToolStripMenuItem.Text = "Insert Node";
    6567      this.insertNodeToolStripMenuItem.Click += new System.EventHandler(this.insertNodeToolStripMenuItem_Click);
     
    6870      //
    6971      this.changeNodeToolStripMenuItem.Name = "changeNodeToolStripMenuItem";
    70       this.changeNodeToolStripMenuItem.Size = new System.Drawing.Size(147, 22);
     72      this.changeNodeToolStripMenuItem.Size = new System.Drawing.Size(165, 22);
    7173      this.changeNodeToolStripMenuItem.Text = "Change Node";
    7274      this.changeNodeToolStripMenuItem.Click += new System.EventHandler(this.changeNodeToolStripMenuItem_Click);
     
    7577      //
    7678      this.cutToolStripMenuItem.Name = "cutToolStripMenuItem";
    77       this.cutToolStripMenuItem.Size = new System.Drawing.Size(147, 22);
    78       this.cutToolStripMenuItem.Text = "Cut";
     79      this.cutToolStripMenuItem.Size = new System.Drawing.Size(165, 22);
     80      this.cutToolStripMenuItem.Text = "Cut Subtree";
    7981      this.cutToolStripMenuItem.Click += new System.EventHandler(this.cutToolStripMenuItem_Click);
    8082      //
     
    8587            this.removeSubtreeToolStripMenuItem});
    8688      this.removeToolStripMenuItem.Name = "removeToolStripMenuItem";
    87       this.removeToolStripMenuItem.Size = new System.Drawing.Size(147, 22);
     89      this.removeToolStripMenuItem.Size = new System.Drawing.Size(165, 22);
    8890      this.removeToolStripMenuItem.Text = "Remove";
    8991      this.removeToolStripMenuItem.Click += new System.EventHandler(this.removeSubtreeToolStripMenuItem_Click);
     
    106108      //
    107109      this.pasteToolStripMenuItem.Name = "pasteToolStripMenuItem";
    108       this.pasteToolStripMenuItem.Size = new System.Drawing.Size(147, 22);
    109       this.pasteToolStripMenuItem.Text = "Paste";
     110      this.pasteToolStripMenuItem.Size = new System.Drawing.Size(165, 22);
     111      this.pasteToolStripMenuItem.Text = "Paste Subtree";
    110112      this.pasteToolStripMenuItem.Click += new System.EventHandler(this.pasteToolStripMenuItem_Clicked);
    111113      //
     
    118120      //
    119121      this.copyToolStripMenuItem.Name = "copyToolStripMenuItem";
    120       this.copyToolStripMenuItem.Size = new System.Drawing.Size(147, 22);
    121       this.copyToolStripMenuItem.Text = "Copy";
     122      this.copyToolStripMenuItem.Size = new System.Drawing.Size(165, 22);
     123      this.copyToolStripMenuItem.Text = "Copy Subtree";
    122124      this.copyToolStripMenuItem.Click += new System.EventHandler(this.copyToolStripMenuItem_Click);
     125      //
     126      // toolStripSeparator1
     127      //
     128      this.toolStripSeparator1.Name = "toolStripSeparator1";
     129      this.toolStripSeparator1.Size = new System.Drawing.Size(162, 6);
     130      //
     131      // toolStripSeparator2
     132      //
     133      this.toolStripSeparator2.Name = "toolStripSeparator2";
     134      this.toolStripSeparator2.Size = new System.Drawing.Size(162, 6);
    123135      //
    124136      // contextMenuStrip
    125137      //
    126138      this.contextMenuStrip.Opened += this.contextMenuStrip_Opened;
    127       this.contextMenuStrip.Items.AddRange(new ToolStripItem[] { insertNodeToolStripMenuItem,
     139      this.contextMenuStrip.Items.AddRange(new ToolStripItem[] { toolStripSeparator1,
     140                                                                 insertNodeToolStripMenuItem,
     141                                                                 removeToolStripMenuItem,
    128142                                                                 changeNodeToolStripMenuItem,
     143                                                                 toolStripSeparator2,
    129144                                                                 copyToolStripMenuItem,
    130145                                                                 cutToolStripMenuItem,
    131                                                                  removeToolStripMenuItem,
    132146                                                                 pasteToolStripMenuItem });
    133147      //
     
    139153      this.Name = "InteractiveSymbolicExpressionTreeChart";
    140154      this.ResumeLayout(false);
    141 
    142155    }
    143156
     
    154167    private ToolStripSeparator toolStripSeparator;
    155168    private ToolStripMenuItem copyToolStripMenuItem;
     169    private ToolStripSeparator toolStripSeparator1;
     170    private ToolStripSeparator toolStripSeparator2;
    156171  }
    157172}
  • branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/InteractiveSymbolicExpressionTreeChart.cs

    r10681 r17687  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    7676        pasteToolStripMenuItem.Visible = true;
    7777        pasteToolStripMenuItem.Enabled = tempNode != null && insertNodeToolStripMenuItem.Enabled
    78                                                           && !(lastOp == EditOp.CutSubtree
    79                                                                && tempNode.IterateNodesBreadth().Contains(currSelected.Content));
     78                                                          && !(lastOp == EditOp.CutSubtree && tempNode.IterateNodesBreadth().Contains(node))
     79                                                          && node.SubtreeCount < node.Symbol.MaximumArity;
    8080      }
    8181    }
     
    8383    protected override void OnSymbolicExpressionTreeNodeClicked(object sender, MouseEventArgs e) {
    8484      currSelected = (VisualTreeNode<ISymbolicExpressionTreeNode>)sender; ;
    85       if (currSelected != null) {
    86         currSelected.LineColor = Color.FromArgb(130, currSelected.LineColor);
    87         RepaintNode(currSelected);
    88       }
    8985      base.OnSymbolicExpressionTreeNodeClicked(sender, e);
    9086    }
    9187
    92     protected override void SymbolicExpressionTreeChart_MouseClick(object sender, MouseEventArgs e) {
    93       if (currSelected != null) {
    94         currSelected.LineColor = Color.FromArgb(255, currSelected.LineColor);
    95         RepaintNode(currSelected);
    96       }
    97       base.SymbolicExpressionTreeChart_MouseClick(sender, e);
    98     }
    99 
    10088    protected override void OnSymbolicExpressionTreeNodeDoubleClicked(object sender, MouseEventArgs e) {
    10189      currSelected = null;
     
    10391    }
    10492
     93
     94    private static readonly ISymbolicExpressionGrammar grammar = new TypeCoherentExpressionGrammar();
    10595    private void insertNodeToolStripMenuItem_Click(object sender, EventArgs e) {
    10696      if (currSelected == null || currSelected.Content is SymbolicExpressionTreeTerminalNode) return;
     
    10898
    10999      using (var dialog = new InsertNodeDialog()) {
    110         dialog.SetAllowedSymbols(parent.Grammar.AllowedSymbols.Where(s => s.Enabled && s.InitialFrequency > 0.0 && !(s is ProgramRootSymbol || s is StartSymbol || s is Defun)));
     100        dialog.SetAllowedSymbols(grammar.Symbols.Where(s => !(s is ProgramRootSymbol || s is StartSymbol || s is Defun || s is GroupSymbol))); // allow everything
    111101        dialog.ShowDialog(this);
    112102        if (dialog.DialogResult != DialogResult.OK) return;
    113103
    114         var symbol = dialog.SelectedSymbol();
     104        var symbol = dialog.SelectedSymbol;
    115105        var node = symbol.CreateTreeNode();
    116106        if (node is ConstantTreeNode) {
     
    120110          var variable = node as VariableTreeNode;
    121111          variable.Weight = double.Parse(dialog.variableWeightTextBox.Text);
    122           variable.VariableName = dialog.variableNamesCombo.Text;
     112          variable.VariableName = dialog.SelectedVariableName;
    123113        } else if (node.Symbol.MinimumArity <= parent.SubtreeCount && node.Symbol.MaximumArity >= parent.SubtreeCount) {
    124114          for (int i = parent.SubtreeCount - 1; i >= 0; --i) {
     
    172162        foreach (var subtree in tempNode.IterateNodesPostfix()) {
    173163          var visualNode = GetVisualSymbolicExpressionTreeNode(subtree);
    174           visualNode.LineColor = Color.FromArgb(255, visualNode.LineColor); // reset the alpha value to 255
    175           visualNode.TextColor = Color.FromArgb(255, visualNode.TextColor);
     164          visualNode.LineColor = Color.Black;
     165          visualNode.TextColor = Color.Black;
    176166          if (subtree.Parent != null) {
    177167            var visualLine = GetVisualSymbolicExpressionTreeNodeConnection(subtree.Parent, subtree);
    178             visualLine.LineColor = Color.FromArgb(255, visualLine.LineColor);
     168            visualLine.LineColor = Color.Black;
    179169          }
    180170        }
     
    183173      foreach (var node in tempNode.IterateNodesPostfix()) {
    184174        var visualNode = GetVisualSymbolicExpressionTreeNode(node);
    185         visualNode.LineColor = Color.FromArgb(100, visualNode.LineColor);
    186         visualNode.TextColor = Color.FromArgb(100, visualNode.TextColor);
     175        visualNode.LineColor = Color.LightGray;
     176        visualNode.TextColor = Color.LightGray;
    187177        foreach (var subtree in node.Subtrees) {
    188178          var visualLine = GetVisualSymbolicExpressionTreeNodeConnection(node, subtree);
    189           visualLine.LineColor = Color.FromArgb(100, visualLine.LineColor);
    190         }
    191       }
    192       currSelected = null;
    193       Repaint();
     179          visualLine.LineColor = Color.LightGray;
     180        }
     181      }
     182      currSelected = null;
     183      RepaintNodes(); // no need to redo the layout and repaint everything since this operation does not change the tree
    194184    }
    195185    private void removeNodeToolStripMenuItem_Click(object sender, EventArgs e) {
  • branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Plugin.cs.frame

    r10681 r17687  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    2424using System.Text;
    2525using HeuristicLab.PluginInfrastructure;
     26using System.Runtime.InteropServices;
     27using System.IO;
    2628
    2729namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Views {
    28   [Plugin("HeuristicLab.Problems.DataAnalysis.Symbolic.Views","Provides views for symbolic data analysis problem classes.", "3.4.5.$WCREV$")]
     30  [Plugin("HeuristicLab.Problems.DataAnalysis.Symbolic.Views","Provides views for symbolic data analysis problem classes.", "3.4.12.$WCREV$")]
    2931  [PluginFile("HeuristicLab.Problems.DataAnalysis.Symbolic.Views-3.4.dll", PluginFileType.Assembly)]
    3032  [PluginFile("displayModelFrame.html", PluginFileType.Data)]
     
    3739  [PluginDependency("HeuristicLab.Data", "3.3")]
    3840  [PluginDependency("HeuristicLab.Data.Views", "3.3")]
    39   [PluginDependency("HeuristicLab.EPPlus", "3.1")]
     41  [PluginDependency("HeuristicLab.EPPlus", "4.0.3")]
    4042  [PluginDependency("HeuristicLab.Encodings.SymbolicExpressionTreeEncoding", "3.4")]
    4143  [PluginDependency("HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views", "3.4")]
    4244  [PluginDependency("HeuristicLab.MainForm", "3.3")]
    4345  [PluginDependency("HeuristicLab.MainForm.WindowsForms", "3.3")]
    44   [PluginDependency("HeuristicLab.MathJax", "1.1")]
     46  [PluginDependency("HeuristicLab.MathJax", "1.2")]
    4547  [PluginDependency("HeuristicLab.Optimization","3.3")]
    4648  [PluginDependency("HeuristicLab.Problems.DataAnalysis", "3.4")]
    4749  [PluginDependency("HeuristicLab.Problems.DataAnalysis.Symbolic", "3.4")]
    4850  public class HeuristicLabProblemsDataAnalysisSymbolicViewsPlugin : PluginBase {
     51    // HeuristicLab is marked with zone identifier 'Internet' after download.
     52    // This propagates to all extracted files and can be checked in the file properties.
     53    // IE prevents execution of MathJax JavaScript inside of untrusted html
     54    // Therefore we need to programmatically unblock the displayModelFrame.html file before extracting.
     55    // see http://engram404.net/programmatically-unblocking-downloaded-files/
     56
     57    // for removing the Zone.Identifier alternative NTFS stream (effectively unblocking the file)
     58    [DllImport("kernel32.dll", SetLastError = true)]
     59    private static extern bool DeleteFile(string lpFileName);
     60
     61    public override void OnLoad() {
     62      base.OnLoad();
     63
     64      // unblock mathjax.zip ()
     65      DeleteFile(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "displayModelFrame.html:Zone.Identifier"));
     66    }
    4967  }
    5068}
  • branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Properties/AssemblyInfo.cs.frame

    r10364 r17687  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    3131[assembly: AssemblyCompany("")]
    3232[assembly: AssemblyProduct("HeuristicLab")]
    33 [assembly: AssemblyCopyright("(c) 2002-2013 HEAL")]
     33[assembly: AssemblyCopyright("(c) HEAL")]
    3434[assembly: AssemblyTrademark("")]
    3535[assembly: AssemblyCulture("")]
     
    5353// by using the '*' as shown below:
    5454[assembly: AssemblyVersion("3.4.0.0")]
    55 [assembly: AssemblyFileVersion("3.4.5.$WCREV$")]
     55[assembly: AssemblyFileVersion("3.4.12.$WCREV$")]
  • branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/RunCollectionVariableImpactView.Designer.cs

    r9708 r17687  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
  • branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/RunCollectionVariableImpactView.cs

    r9708 r17687  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    2222using System;
    2323using System.Collections.Generic;
     24using System.ComponentModel;
    2425using System.Drawing;
    2526using System.Linq;
     
    6667    private void RegisterRunEvents(IEnumerable<IRun> runs) {
    6768      foreach (IRun run in runs)
    68         run.Changed += Run_Changed;
     69        run.PropertyChanged += Run_PropertyChanged;
    6970    }
    7071    private void DeregisterRunEvents(IEnumerable<IRun> runs) {
    7172      foreach (IRun run in runs)
    72         run.Changed -= Run_Changed;
     73        run.PropertyChanged -= Run_PropertyChanged;
    7374    }
    7475    private void Content_ItemsAdded(object sender, HeuristicLab.Collections.CollectionItemsChangedEventArgs<IRun> e) {
     
    8889      if (!Content.UpdateOfRunsInProgress) UpdateData();
    8990    }
    90     private void Run_Changed(object sender, EventArgs e) {
    91       if (!Content.UpdateOfRunsInProgress) UpdateData();
     91    private void Run_PropertyChanged(object sender, PropertyChangedEventArgs e) {
     92      if (!Content.UpdateOfRunsInProgress && e.PropertyName == "Visible")
     93        UpdateData();
    9294    }
    9395    #endregion
  • branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/SlidingWindow/SlidingWindowBestSolutionsCollectionHeatMapControl.cs

    r10724 r17687  
    6464      InitializeComponent();
    6565      progress = new Progress();
    66       MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>().AddOperationProgressToView(this, progress);
     66      MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>();//.AddOperationProgressToView(this, progress);
    6767    }
    6868
  • branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/SlidingWindow/SlidingWindowBestSolutionsCollectionView.cs

    r10724 r17687  
    8484      InitializeComponent();
    8585      progress = new Progress();
    86       MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>().AddOperationProgressToView(this, progress);
     86      MainFormManager.GetMainForm<MainForm.WindowsForms.MainForm>();//.AddOperationProgressToView(this, progress);
    8787    }
    8888
  • branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/SymbolicDataAnalysisModelMathView.cs

    r15681 r17687  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
  • branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/SymbolicDataAnalysisModelMathView.designer.cs

    r15681 r17687  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
  • branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Symbols/ConstantView.Designer.cs

    r9708 r17687  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
  • branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Symbols/ConstantView.cs

    r9708 r17687  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
  • branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Symbols/LaggedVariableView.Designer.cs

    r9708 r17687  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    6363      // weightInitializationMuTextBox
    6464      //
     65      this.weightInitializationMuTextBox.Size = new System.Drawing.Size(293, 20);
    6566      this.toolTip.SetToolTip(this.weightInitializationMuTextBox, "The mu (mean) parameter of the normal distribution from which to sample the initi" +
    6667        "al weights.");
     
    6970      //
    7071      this.initializationGroupBox.Location = new System.Drawing.Point(6, 7);
    71       this.initializationGroupBox.Size = new System.Drawing.Size(379, 73);
     72      this.initializationGroupBox.Size = new System.Drawing.Size(391, 73);
    7273      //
    7374      // weightSigmaLabel
     
    7778      // weightInitializationSigmaTextBox
    7879      //
     80      this.weightInitializationSigmaTextBox.Size = new System.Drawing.Size(293, 20);
    7981      this.toolTip.SetToolTip(this.weightInitializationSigmaTextBox, "The sigma parameter for the normal distribution from which to sample the initial " +
    8082        "weights.");
     
    8385      //
    8486      this.mutationGroupBox.Location = new System.Drawing.Point(6, 86);
    85       this.mutationGroupBox.Size = new System.Drawing.Size(379, 73);
     87      this.mutationGroupBox.Size = new System.Drawing.Size(391, 95);
    8688      //
    8789      // multiplicativeWeightChangeLabel
    8890      //
     91      this.multiplicativeWeightChangeLabel.TabIndex = 4;
    8992      this.toolTip.SetToolTip(this.multiplicativeWeightChangeLabel, "The sigma parameter for the normal distribution to use to sample a multiplicative" +
    9093        " change in weight.");
     
    9295      // multiplicativeWeightChangeSigmaTextBox
    9396      //
     97      this.multiplicativeWeightChangeSigmaTextBox.TabIndex = 5;
    9498      this.toolTip.SetToolTip(this.multiplicativeWeightChangeSigmaTextBox, "The sigma (std.dev.) parameter for the normal distribution to sample a multiplica" +
    9599        "tive change in weight.");
     
    97101      // additiveWeightChangeLabel
    98102      //
     103      this.additiveWeightChangeLabel.TabIndex = 2;
    99104      this.toolTip.SetToolTip(this.additiveWeightChangeLabel, "The sigma (std.dev.) parameter for the normal distribution to sample an additive " +
    100105        "change in weight.");
     
    102107      // additiveWeightChangeSigmaTextBox
    103108      //
     109      this.additiveWeightChangeSigmaTextBox.TabIndex = 3;
    104110      this.toolTip.SetToolTip(this.additiveWeightChangeSigmaTextBox, "The sigma (std.dev.) parameter for the normal distribution to sample an additive " +
    105111        "change in weight.");
     
    111117      // parametersTabPage
    112118      //
    113       this.parametersTabPage.Size = new System.Drawing.Size(400, 149);
     119      this.parametersTabPage.Size = new System.Drawing.Size(412, 208);
    114120      //
    115121      // tabControl
    116122      //
    117123      this.tabControl.Location = new System.Drawing.Point(0, 179);
    118       this.tabControl.Size = new System.Drawing.Size(408, 175);
    119       this.tabControl.TabIndex = 9;
     124      this.tabControl.Size = new System.Drawing.Size(420, 234);
     125      this.tabControl.TabIndex = 13;
     126      //
     127      // varChangeProbTextBox
     128      //
     129      this.varChangeProbTextBox.TabIndex = 1;
     130      this.toolTip.SetToolTip(this.varChangeProbTextBox, "The sigma (std.dev.) parameter for the normal distribution to sample an additive " +
     131        "change in weight.");
     132      //
     133      // varChangeProbLabel
     134      //
     135      this.varChangeProbLabel.TabIndex = 0;
     136      this.toolTip.SetToolTip(this.varChangeProbLabel, "The probability of changing the referenced variable in [0..1]. Variable reference" +
     137        "s are sampled uniformly.");
    120138      //
    121139      // initialFrequencyLabel
    122140      //
     141      this.initialFrequencyLabel.TabIndex = 2;
    123142      this.toolTip.SetToolTip(this.initialFrequencyLabel, "Relative frequency of the symbol in randomly created trees");
    124143      //
     
    126145      //
    127146      this.errorProvider.SetIconAlignment(this.initialFrequencyTextBox, System.Windows.Forms.ErrorIconAlignment.MiddleLeft);
     147      this.initialFrequencyTextBox.Size = new System.Drawing.Size(323, 20);
     148      this.initialFrequencyTextBox.TabIndex = 3;
     149      //
     150      // enabledCheckBox
     151      //
     152      this.enabledCheckBox.TabIndex = 8;
     153      //
     154      // minimumArityLabel
     155      //
     156      this.minimumArityLabel.TabIndex = 4;
     157      this.toolTip.SetToolTip(this.minimumArityLabel, "The minimum arity of the symbol");
     158      //
     159      // maximumArityLabel
     160      //
     161      this.toolTip.SetToolTip(this.maximumArityLabel, "The maximum arity of the symbol");
    128162      //
    129163      // minimumArityTextBox
    130164      //
    131165      this.errorProvider.SetIconAlignment(this.minimumArityTextBox, System.Windows.Forms.ErrorIconAlignment.MiddleLeft);
    132       this.minimumArityTextBox.Size = new System.Drawing.Size(315, 20);
     166      this.minimumArityTextBox.Size = new System.Drawing.Size(327, 20);
     167      this.minimumArityTextBox.TabIndex = 5;
    133168      //
    134169      // maximumArityTextBox
    135170      //
    136171      this.errorProvider.SetIconAlignment(this.maximumArityTextBox, System.Windows.Forms.ErrorIconAlignment.MiddleLeft);
    137       this.maximumArityTextBox.Size = new System.Drawing.Size(315, 20);
     172      this.maximumArityTextBox.Size = new System.Drawing.Size(327, 20);
    138173      //
    139174      // nameTextBox
     
    141176      this.errorProvider.SetIconAlignment(this.nameTextBox, System.Windows.Forms.ErrorIconAlignment.MiddleLeft);
    142177      this.errorProvider.SetIconPadding(this.nameTextBox, 2);
     178      this.nameTextBox.Size = new System.Drawing.Size(302, 20);
     179      //
     180      // infoLabel
     181      //
     182      this.infoLabel.Location = new System.Drawing.Point(401, 3);
    143183      //
    144184      // minTimeOffsetLabel
     
    148188      this.minTimeOffsetLabel.Name = "minTimeOffsetLabel";
    149189      this.minTimeOffsetLabel.Size = new System.Drawing.Size(81, 13);
    150       this.minTimeOffsetLabel.TabIndex = 5;
     190      this.minTimeOffsetLabel.TabIndex = 9;
    151191      this.minTimeOffsetLabel.Text = "Min. time offset:";
    152192      //
     
    157197      this.maxTimeOffsetLabel.Name = "maxTimeOffsetLabel";
    158198      this.maxTimeOffsetLabel.Size = new System.Drawing.Size(84, 13);
    159       this.maxTimeOffsetLabel.TabIndex = 7;
     199      this.maxTimeOffsetLabel.TabIndex = 11;
    160200      this.maxTimeOffsetLabel.Text = "Max. time offset:";
    161201      //
    162202      // minTimeOffsetTextBox
    163203      //
    164       this.minTimeOffsetTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     204      this.minTimeOffsetTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
    165205            | System.Windows.Forms.AnchorStyles.Right)));
    166206      this.minTimeOffsetTextBox.Location = new System.Drawing.Point(93, 127);
    167207      this.minTimeOffsetTextBox.Name = "minTimeOffsetTextBox";
    168       this.minTimeOffsetTextBox.Size = new System.Drawing.Size(315, 20);
    169       this.minTimeOffsetTextBox.TabIndex = 6;
     208      this.minTimeOffsetTextBox.Size = new System.Drawing.Size(327, 20);
     209      this.minTimeOffsetTextBox.TabIndex = 10;
    170210      this.minTimeOffsetTextBox.TextChanged += new System.EventHandler(this.minTimeOffsetTextBox_TextChanged);
    171211      //
    172212      // maxTimeOffsetTextBox
    173213      //
    174       this.maxTimeOffsetTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     214      this.maxTimeOffsetTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
    175215            | System.Windows.Forms.AnchorStyles.Right)));
    176216      this.maxTimeOffsetTextBox.Location = new System.Drawing.Point(93, 153);
    177217      this.maxTimeOffsetTextBox.Name = "maxTimeOffsetTextBox";
    178       this.maxTimeOffsetTextBox.Size = new System.Drawing.Size(315, 20);
    179       this.maxTimeOffsetTextBox.TabIndex = 8;
     218      this.maxTimeOffsetTextBox.Size = new System.Drawing.Size(327, 20);
     219      this.maxTimeOffsetTextBox.TabIndex = 12;
    180220      this.maxTimeOffsetTextBox.TextChanged += new System.EventHandler(this.maxTimeOffsetTextBox_TextChanged);
    181221      //
    182222      // LaggedVariableView
    183223      //
    184       this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    185224      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
    186225      this.Controls.Add(this.minTimeOffsetTextBox);
     
    189228      this.Controls.Add(this.maxTimeOffsetTextBox);
    190229      this.Name = "LaggedVariableView";
    191       this.Size = new System.Drawing.Size(408, 352);
     230      this.Size = new System.Drawing.Size(420, 411);
     231      this.Controls.SetChildIndex(this.enabledCheckBox, 0);
    192232      this.Controls.SetChildIndex(this.maxTimeOffsetTextBox, 0);
    193233      this.Controls.SetChildIndex(this.minTimeOffsetLabel, 0);
  • branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Symbols/LaggedVariableView.cs

    r9708 r17687  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
  • branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Symbols/TimeLagView.Designer.cs

    r9708 r17687  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
  • branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Symbols/TimeLagView.cs

    r9708 r17687  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
  • branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Symbols/VariableConditionView.Designer.cs

    r9708 r17687  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    237237      // variableNamesTabPage
    238238      //
     239      this.variableNamesTabPage.BackColor = System.Drawing.SystemColors.Window;
    239240      this.variableNamesTabPage.Location = new System.Drawing.Point(4, 22);
    240241      this.variableNamesTabPage.Name = "variableNamesTabPage";
     
    243244      this.variableNamesTabPage.TabIndex = 0;
    244245      this.variableNamesTabPage.Text = "Variable Names";
    245       this.variableNamesTabPage.UseVisualStyleBackColor = true;
    246246      //
    247247      // parametersTabPage
    248248      //
     249      this.parametersTabPage.BackColor = System.Drawing.SystemColors.Window;
    249250      this.parametersTabPage.Controls.Add(this.initializationGroupBox);
    250251      this.parametersTabPage.Controls.Add(this.mutationGroupBox);
     
    255256      this.parametersTabPage.TabIndex = 1;
    256257      this.parametersTabPage.Text = "Parameters";
    257       this.parametersTabPage.UseVisualStyleBackColor = true;
    258258      //
    259259      // initializationGroupBox
  • branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Symbols/VariableConditionView.cs

    r9708 r17687  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    5454    private void RegisterVariableNamesViewContentEvents() {
    5555      variableNamesView.Content.ItemsAdded += new CollectionItemsChangedEventHandler<StringValue>(VariableNames_Changed);
    56       variableNamesView.Content.ItemsRemoved += new CollectionItemsChangedEventHandler<StringValue>(VariableNames_Changed);
     56      variableNamesView.Content.ItemsRemoved += new CollectionItemsChangedEventHandler<StringValue>(VariableNames_Removed);
    5757      variableNamesView.Content.CheckedItemsChanged += new CollectionItemsChangedEventHandler<StringValue>(VariableNames_Changed);
    5858      variableNamesView.Content.CollectionReset += new CollectionItemsChangedEventHandler<StringValue>(VariableNames_Changed);
     
    6464    private void DeregisterVariableNamesViewContentEvents() {
    6565      variableNamesView.Content.ItemsAdded -= new CollectionItemsChangedEventHandler<StringValue>(VariableNames_Changed);
    66       variableNamesView.Content.ItemsRemoved -= new CollectionItemsChangedEventHandler<StringValue>(VariableNames_Changed);
     66      variableNamesView.Content.ItemsRemoved -= new CollectionItemsChangedEventHandler<StringValue>(VariableNames_Removed);
    6767      variableNamesView.Content.CheckedItemsChanged -= new CollectionItemsChangedEventHandler<StringValue>(VariableNames_Changed);
    6868      variableNamesView.Content.CollectionReset -= new CollectionItemsChangedEventHandler<StringValue>(VariableNames_Changed);
     
    153153    }
    154154
     155    private void VariableNames_Removed(object sender, CollectionItemsChangedEventArgs<StringValue> e) {
     156      foreach (var newVar in e.Items)
     157        newVar.ValueChanged -= new EventHandler(Variable_ValueChanged);
     158      UpdateContent();
     159    }
     160
    155161    private void Variable_ValueChanged(object sender, EventArgs e) {
    156162      UpdateContent();
  • branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Symbols/VariableView.Designer.cs

    r9708 r17687  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    5151      this.weightInitializationSigmaTextBox = new System.Windows.Forms.TextBox();
    5252      this.mutationGroupBox = new System.Windows.Forms.GroupBox();
     53      this.varChangeProbTextBox = new System.Windows.Forms.TextBox();
     54      this.varChangeProbLabel = new System.Windows.Forms.Label();
    5355      this.multiplicativeWeightChangeLabel = new System.Windows.Forms.Label();
    5456      this.multiplicativeWeightChangeSigmaTextBox = new System.Windows.Forms.TextBox();
     
    6769      // initialFrequencyLabel
    6870      //
     71      this.initialFrequencyLabel.TabIndex = 2;
    6972      this.toolTip.SetToolTip(this.initialFrequencyLabel, "Relative frequency of the symbol in randomly created trees");
    7073      //
     
    7376      this.errorProvider.SetIconAlignment(this.initialFrequencyTextBox, System.Windows.Forms.ErrorIconAlignment.MiddleLeft);
    7477      this.initialFrequencyTextBox.Size = new System.Drawing.Size(311, 20);
     78      this.initialFrequencyTextBox.TabIndex = 3;
     79      //
     80      // enabledCheckBox
     81      //
     82      this.enabledCheckBox.TabIndex = 8;
    7583      //
    7684      // minimumArityLabel
    7785      //
     86      this.minimumArityLabel.TabIndex = 4;
    7887      this.toolTip.SetToolTip(this.minimumArityLabel, "The minimum arity of the symbol");
    7988      //
     
    8695      this.errorProvider.SetIconAlignment(this.minimumArityTextBox, System.Windows.Forms.ErrorIconAlignment.MiddleLeft);
    8796      this.minimumArityTextBox.Size = new System.Drawing.Size(311, 20);
     97      this.minimumArityTextBox.TabIndex = 5;
    8898      //
    8999      // maximumArityTextBox
     
    114124      // weightInitializationMuTextBox
    115125      //
    116       this.weightInitializationMuTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
     126      this.weightInitializationMuTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    117127            | System.Windows.Forms.AnchorStyles.Right)));
    118128      this.weightInitializationMuTextBox.Location = new System.Drawing.Point(92, 19);
     
    126136      // initializationGroupBox
    127137      //
    128       this.initializationGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
     138      this.initializationGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    129139            | System.Windows.Forms.AnchorStyles.Right)));
    130140      this.initializationGroupBox.Controls.Add(this.weightSigmaLabel);
     
    151161      // weightInitializationSigmaTextBox
    152162      //
    153       this.weightInitializationSigmaTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
     163      this.weightInitializationSigmaTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    154164            | System.Windows.Forms.AnchorStyles.Right)));
    155165      this.weightInitializationSigmaTextBox.Location = new System.Drawing.Point(92, 45);
     
    163173      // mutationGroupBox
    164174      //
    165       this.mutationGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    166             | System.Windows.Forms.AnchorStyles.Right)));
     175      this.mutationGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     176            | System.Windows.Forms.AnchorStyles.Right)));
     177      this.mutationGroupBox.Controls.Add(this.varChangeProbTextBox);
     178      this.mutationGroupBox.Controls.Add(this.varChangeProbLabel);
    167179      this.mutationGroupBox.Controls.Add(this.multiplicativeWeightChangeLabel);
    168180      this.mutationGroupBox.Controls.Add(this.multiplicativeWeightChangeSigmaTextBox);
     
    171183      this.mutationGroupBox.Location = new System.Drawing.Point(6, 85);
    172184      this.mutationGroupBox.Name = "mutationGroupBox";
    173       this.mutationGroupBox.Size = new System.Drawing.Size(391, 73);
     185      this.mutationGroupBox.Size = new System.Drawing.Size(391, 97);
    174186      this.mutationGroupBox.TabIndex = 1;
    175187      this.mutationGroupBox.TabStop = false;
    176188      this.mutationGroupBox.Text = "Mutation";
    177189      //
     190      // varChangeProbTextBox
     191      //
     192      this.varChangeProbTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     193            | System.Windows.Forms.AnchorStyles.Right)));
     194      this.varChangeProbTextBox.Location = new System.Drawing.Point(201, 13);
     195      this.varChangeProbTextBox.Name = "varChangeProbTextBox";
     196      this.varChangeProbTextBox.Size = new System.Drawing.Size(184, 20);
     197      this.varChangeProbTextBox.TabIndex = 1;
     198      this.toolTip.SetToolTip(this.varChangeProbTextBox, "The sigma (std.dev.) parameter for the normal distribution to sample an additive " +
     199        "change in weight.");
     200      this.varChangeProbTextBox.TextChanged += new System.EventHandler(this.VarProbTextBox_TextChanged);
     201      //
     202      // varChangeProbLabel
     203      //
     204      this.varChangeProbLabel.AutoSize = true;
     205      this.varChangeProbLabel.Location = new System.Drawing.Point(6, 16);
     206      this.varChangeProbLabel.Name = "varChangeProbLabel";
     207      this.varChangeProbLabel.Size = new System.Drawing.Size(134, 13);
     208      this.varChangeProbLabel.TabIndex = 0;
     209      this.varChangeProbLabel.Text = "Variable change probability";
     210      this.toolTip.SetToolTip(this.varChangeProbLabel, "The probability of changing the referenced variable in [0..1]. Variable reference" +
     211        "s are sampled uniformly.");
     212      //
    178213      // multiplicativeWeightChangeLabel
    179214      //
    180215      this.multiplicativeWeightChangeLabel.AutoSize = true;
    181       this.multiplicativeWeightChangeLabel.Location = new System.Drawing.Point(6, 48);
     216      this.multiplicativeWeightChangeLabel.Location = new System.Drawing.Point(6, 68);
    182217      this.multiplicativeWeightChangeLabel.Name = "multiplicativeWeightChangeLabel";
    183218      this.multiplicativeWeightChangeLabel.Size = new System.Drawing.Size(180, 13);
    184       this.multiplicativeWeightChangeLabel.TabIndex = 2;
     219      this.multiplicativeWeightChangeLabel.TabIndex = 4;
    185220      this.multiplicativeWeightChangeLabel.Text = "Multiplicative weight change (sigma):";
    186221      this.toolTip.SetToolTip(this.multiplicativeWeightChangeLabel, "The sigma parameter for the normal distribution to use to sample a multiplicative" +
     
    189224      // multiplicativeWeightChangeSigmaTextBox
    190225      //
    191       this.multiplicativeWeightChangeSigmaTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
    192             | System.Windows.Forms.AnchorStyles.Right)));
    193       this.multiplicativeWeightChangeSigmaTextBox.Location = new System.Drawing.Point(201, 45);
     226      this.multiplicativeWeightChangeSigmaTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     227            | System.Windows.Forms.AnchorStyles.Right)));
     228      this.multiplicativeWeightChangeSigmaTextBox.Location = new System.Drawing.Point(201, 65);
    194229      this.multiplicativeWeightChangeSigmaTextBox.Name = "multiplicativeWeightChangeSigmaTextBox";
    195230      this.multiplicativeWeightChangeSigmaTextBox.Size = new System.Drawing.Size(184, 20);
    196       this.multiplicativeWeightChangeSigmaTextBox.TabIndex = 3;
     231      this.multiplicativeWeightChangeSigmaTextBox.TabIndex = 5;
    197232      this.toolTip.SetToolTip(this.multiplicativeWeightChangeSigmaTextBox, "The sigma (std.dev.) parameter for the normal distribution to sample a multiplica" +
    198233        "tive change in weight.");
     
    202237      //
    203238      this.additiveWeightChangeLabel.AutoSize = true;
    204       this.additiveWeightChangeLabel.Location = new System.Drawing.Point(6, 22);
     239      this.additiveWeightChangeLabel.Location = new System.Drawing.Point(6, 42);
    205240      this.additiveWeightChangeLabel.Name = "additiveWeightChangeLabel";
    206241      this.additiveWeightChangeLabel.Size = new System.Drawing.Size(157, 13);
    207       this.additiveWeightChangeLabel.TabIndex = 0;
     242      this.additiveWeightChangeLabel.TabIndex = 2;
    208243      this.additiveWeightChangeLabel.Text = "Additive weight change (sigma):";
    209244      this.toolTip.SetToolTip(this.additiveWeightChangeLabel, "The sigma (std.dev.) parameter for the normal distribution to sample an additive " +
     
    212247      // additiveWeightChangeSigmaTextBox
    213248      //
    214       this.additiveWeightChangeSigmaTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
    215             | System.Windows.Forms.AnchorStyles.Right)));
    216       this.additiveWeightChangeSigmaTextBox.Location = new System.Drawing.Point(201, 19);
     249      this.additiveWeightChangeSigmaTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     250            | System.Windows.Forms.AnchorStyles.Right)));
     251      this.additiveWeightChangeSigmaTextBox.Location = new System.Drawing.Point(201, 39);
    217252      this.additiveWeightChangeSigmaTextBox.Name = "additiveWeightChangeSigmaTextBox";
    218253      this.additiveWeightChangeSigmaTextBox.Size = new System.Drawing.Size(184, 20);
    219       this.additiveWeightChangeSigmaTextBox.TabIndex = 1;
     254      this.additiveWeightChangeSigmaTextBox.TabIndex = 3;
    220255      this.toolTip.SetToolTip(this.additiveWeightChangeSigmaTextBox, "The sigma (std.dev.) parameter for the normal distribution to sample an additive " +
    221256        "change in weight.");
     
    224259      // tabControl
    225260      //
    226       this.tabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
    227             | System.Windows.Forms.AnchorStyles.Left) 
     261      this.tabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     262            | System.Windows.Forms.AnchorStyles.Left)
    228263            | System.Windows.Forms.AnchorStyles.Right)));
    229264      this.tabControl.Controls.Add(this.variableNamesTabPage);
     
    232267      this.tabControl.Name = "tabControl";
    233268      this.tabControl.SelectedIndex = 0;
    234       this.tabControl.Size = new System.Drawing.Size(408, 190);
    235       this.tabControl.TabIndex = 5;
     269      this.tabControl.Size = new System.Drawing.Size(408, 216);
     270      this.tabControl.TabIndex = 9;
    236271      //
    237272      // variableNamesTabPage
    238273      //
     274      this.variableNamesTabPage.BackColor = System.Drawing.SystemColors.Window;
    239275      this.variableNamesTabPage.Location = new System.Drawing.Point(4, 22);
    240276      this.variableNamesTabPage.Name = "variableNamesTabPage";
    241277      this.variableNamesTabPage.Padding = new System.Windows.Forms.Padding(3);
    242       this.variableNamesTabPage.Size = new System.Drawing.Size(400, 164);
     278      this.variableNamesTabPage.Size = new System.Drawing.Size(400, 190);
    243279      this.variableNamesTabPage.TabIndex = 0;
    244280      this.variableNamesTabPage.Text = "Variable Names";
    245       this.variableNamesTabPage.UseVisualStyleBackColor = true;
    246281      //
    247282      // parametersTabPage
    248283      //
     284      this.parametersTabPage.BackColor = System.Drawing.SystemColors.Window;
    249285      this.parametersTabPage.Controls.Add(this.mutationGroupBox);
    250286      this.parametersTabPage.Controls.Add(this.initializationGroupBox);
     
    252288      this.parametersTabPage.Name = "parametersTabPage";
    253289      this.parametersTabPage.Padding = new System.Windows.Forms.Padding(3);
    254       this.parametersTabPage.Size = new System.Drawing.Size(400, 164);
     290      this.parametersTabPage.Size = new System.Drawing.Size(400, 190);
    255291      this.parametersTabPage.TabIndex = 1;
    256292      this.parametersTabPage.Text = "Parameters";
    257       this.parametersTabPage.UseVisualStyleBackColor = true;
    258293      //
    259294      // VariableView
    260295      //
    261       this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    262296      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
    263297      this.Controls.Add(this.tabControl);
    264298      this.Name = "VariableView";
    265       this.Size = new System.Drawing.Size(408, 317);
     299      this.Size = new System.Drawing.Size(408, 346);
     300      this.Controls.SetChildIndex(this.enabledCheckBox, 0);
    266301      this.Controls.SetChildIndex(this.maximumArityLabel, 0);
    267302      this.Controls.SetChildIndex(this.maximumArityTextBox, 0);
     
    301336    protected System.Windows.Forms.TabPage parametersTabPage;
    302337    protected System.Windows.Forms.TabControl tabControl;
     338    protected System.Windows.Forms.TextBox varChangeProbTextBox;
     339    protected System.Windows.Forms.Label varChangeProbLabel;
    303340  }
    304341}
  • branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/Symbols/VariableView.cs

    r9708 r17687  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    2929using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Views;
    3030using HeuristicLab.MainForm;
    31 using HeuristicLab.MainForm.WindowsForms;
    3231
    3332
    3433namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Views {
    3534  [View("Variable View")]
    36   [Content(typeof(Variable), true)]
     35  [Content(typeof(VariableBase), true)]
    3736  public partial class VariableView : SymbolView {
    3837    private CheckedItemCollectionView<StringValue> variableNamesView;
    3938
    40     public new Variable Content {
    41       get { return (Variable)base.Content; }
     39    public new VariableBase Content {
     40      get { return (VariableBase)base.Content; }
    4241      set { base.Content = value; }
    4342    }
     
    5554    private void RegisterVariableNamesViewContentEvents() {
    5655      variableNamesView.Content.ItemsAdded += new CollectionItemsChangedEventHandler<StringValue>(VariableNames_Changed);
    57       variableNamesView.Content.ItemsRemoved += new CollectionItemsChangedEventHandler<StringValue>(VariableNames_Changed);
     56      variableNamesView.Content.ItemsRemoved += new CollectionItemsChangedEventHandler<StringValue>(VariableNames_Removed);
    5857      variableNamesView.Content.CheckedItemsChanged += new CollectionItemsChangedEventHandler<StringValue>(VariableNames_Changed);
    5958      variableNamesView.Content.CollectionReset += new CollectionItemsChangedEventHandler<StringValue>(VariableNames_Changed);
     
    6665    private void DeregisterVariableNamesViewContentEvents() {
    6766      variableNamesView.Content.ItemsAdded -= new CollectionItemsChangedEventHandler<StringValue>(VariableNames_Changed);
    68       variableNamesView.Content.ItemsRemoved -= new CollectionItemsChangedEventHandler<StringValue>(VariableNames_Changed);
     67      variableNamesView.Content.ItemsRemoved -= new CollectionItemsChangedEventHandler<StringValue>(VariableNames_Removed);
    6968      variableNamesView.Content.CheckedItemsChanged -= new CollectionItemsChangedEventHandler<StringValue>(VariableNames_Changed);
    7069      variableNamesView.Content.CollectionReset -= new CollectionItemsChangedEventHandler<StringValue>(VariableNames_Changed);
     
    101100      multiplicativeWeightChangeSigmaTextBox.Enabled = Content != null;
    102101      multiplicativeWeightChangeSigmaTextBox.ReadOnly = ReadOnly;
     102      varChangeProbTextBox.Enabled = Content != null;
     103      varChangeProbTextBox.ReadOnly = ReadOnly;
    103104    }
    104105
     
    118119    }
    119120
     121    private void VariableNames_Removed(object sender, CollectionItemsChangedEventArgs<StringValue> e) {
     122      foreach (var newVar in e.Items)
     123        newVar.ValueChanged -= new EventHandler(Variable_ValueChanged);
     124      UpdateContent();
     125    }
     126
    120127    private void Variable_ValueChanged(object sender, EventArgs e) {
    121128      UpdateContent();
     
    126133        Content.Fixed = true;
    127134        DeregisterContentEvents();
    128         Content.VariableNames = variableNamesView.Content.CheckedItems.Select(x => x.Value).ToList();
     135        Content.VariableNames = variableNamesView.Content.CheckedItems.Select(x => x.Value);
     136        Content.AllVariableNames = variableNamesView.Content.Select(x => x.Value);
    129137        RegisterContentEvents();
    130138      }
     
    166174      } else {
    167175        errorProvider.SetError(multiplicativeWeightChangeSigmaTextBox, "Invalid value");
     176      }
     177    }
     178
     179    private void VarProbTextBox_TextChanged(object sender, EventArgs e) {
     180      double prob;
     181      if (double.TryParse(varChangeProbTextBox.Text, out prob) && prob >= 0.0 && prob <= 1.0) {
     182        Content.VariableChangeProbability = prob;
     183        errorProvider.SetError(varChangeProbTextBox, string.Empty);
     184      } else {
     185        errorProvider.SetError(varChangeProbTextBox, "Invalid value");
    168186      }
    169187    }
     
    177195        additiveWeightChangeSigmaTextBox.Text = string.Empty;
    178196        multiplicativeWeightChangeSigmaTextBox.Text = string.Empty;
     197        varChangeProbTextBox.Text = string.Empty;
    179198        // temporarily deregister to prevent circular calling of events
    180199        DeregisterVariableNamesViewContentEvents();
     
    194213        additiveWeightChangeSigmaTextBox.Text = Content.WeightManipulatorSigma.ToString();
    195214        multiplicativeWeightChangeSigmaTextBox.Text = Content.MultiplicativeWeightManipulatorSigma.ToString();
     215        varChangeProbTextBox.Text = Content.VariableChangeProbability.ToString();
    196216      }
    197217      SetEnabledStateOfControls();
    198218    }
    199219    #endregion
     220
    200221  }
    201222}
  • branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/TextualSymbolicDataAnalysisModelView.cs

    r9708 r17687  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
  • branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/TextualSymbolicDataAnalysisModelView.designer.cs

    r10681 r17687  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    5454      this.symbolicExpressionTreeView.Content = null;
    5555      this.symbolicExpressionTreeView.Dock = System.Windows.Forms.DockStyle.Fill;
    56       this.symbolicExpressionTreeView.Font = new System.Drawing.Font("Consolas", 8.25F);
    5756      this.symbolicExpressionTreeView.Location = new System.Drawing.Point(0, 0);
    5857      this.symbolicExpressionTreeView.Name = "symbolicExpressionTreeView";
  • branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/TreeEditDialogs/SymbolicExpressionTreeConstantNodeEditDialog.Designer.cs

    r9708 r17687  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    6767      // oldValueTextBox
    6868      //
    69       this.oldValueTextBox.Location = new System.Drawing.Point(123, 6);
     69      this.oldValueTextBox.Location = new System.Drawing.Point(106, 6);
    7070      this.oldValueTextBox.Name = "oldValueTextBox";
    7171      this.oldValueTextBox.ReadOnly = true;
     
    7575      // newValueTextBox
    7676      //
    77       this.newValueTextBox.Location = new System.Drawing.Point(123, 42);
     77      this.newValueTextBox.Location = new System.Drawing.Point(106, 32);
    7878      this.newValueTextBox.Name = "newValueTextBox";
    7979      this.newValueTextBox.Size = new System.Drawing.Size(131, 20);
     
    8686      //
    8787      this.newValueLabel.AutoSize = true;
    88       this.newValueLabel.Location = new System.Drawing.Point(12, 45);
     88      this.newValueLabel.Location = new System.Drawing.Point(12, 35);
    8989      this.newValueLabel.Name = "newValueLabel";
    9090      this.newValueLabel.Size = new System.Drawing.Size(59, 13);
     
    101101      //
    102102      this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
    103       this.okButton.Location = new System.Drawing.Point(15, 79);
     103      this.okButton.Location = new System.Drawing.Point(81, 66);
    104104      this.okButton.Name = "okButton";
    105105      this.okButton.Size = new System.Drawing.Size(75, 23);
     
    113113      this.cancelButton.CausesValidation = false;
    114114      this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
    115       this.cancelButton.Location = new System.Drawing.Point(179, 79);
     115      this.cancelButton.Location = new System.Drawing.Point(162, 66);
    116116      this.cancelButton.Name = "cancelButton";
    117117      this.cancelButton.Size = new System.Drawing.Size(75, 23);
     
    127127      this.AutoSize = true;
    128128      this.CancelButton = this.cancelButton;
    129       this.ClientSize = new System.Drawing.Size(269, 116);
     129      this.ClientSize = new System.Drawing.Size(248, 101);
    130130      this.ControlBox = false;
    131131      this.Controls.Add(this.cancelButton);
  • branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/TreeEditDialogs/SymbolicExpressionTreeConstantNodeEditDialog.cs

    r9708 r17687  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
  • branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/TreeEditDialogs/SymbolicExpressionTreeNodeInsertDialog.Designer.cs

    r9708 r17687  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    5757      this.okButton = new System.Windows.Forms.Button();
    5858      this.cancelButton = new System.Windows.Forms.Button();
     59      this.variableNameTextBox = new System.Windows.Forms.TextBox();
    5960      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
    6061      this.SuspendLayout();
     
    6364      //
    6465      this.nodeSymbolLabel.AutoSize = true;
    65       this.nodeSymbolLabel.Location = new System.Drawing.Point(13, 13);
     66      this.nodeSymbolLabel.Location = new System.Drawing.Point(19, 13);
    6667      this.nodeSymbolLabel.Name = "nodeSymbolLabel";
    6768      this.nodeSymbolLabel.Size = new System.Drawing.Size(41, 13);
     
    7374      this.allowedSymbolsCombo.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
    7475      this.allowedSymbolsCombo.FormattingEnabled = true;
    75       this.allowedSymbolsCombo.Location = new System.Drawing.Point(120, 10);
     76      this.allowedSymbolsCombo.Location = new System.Drawing.Point(101, 10);
    7677      this.allowedSymbolsCombo.Name = "allowedSymbolsCombo";
    77       this.allowedSymbolsCombo.Size = new System.Drawing.Size(108, 21);
     78      this.allowedSymbolsCombo.Size = new System.Drawing.Size(127, 21);
    7879      this.allowedSymbolsCombo.TabIndex = 1;
    7980      this.allowedSymbolsCombo.SelectedIndexChanged += new System.EventHandler(this.allowedSymbolsCombo_SelectedIndexChanged);
     
    8384      //
    8485      this.variableWeightLabel.AutoSize = true;
    85       this.variableWeightLabel.Location = new System.Drawing.Point(13, 44);
     86      this.variableWeightLabel.Location = new System.Drawing.Point(19, 40);
    8687      this.variableWeightLabel.Name = "variableWeightLabel";
    8788      this.variableWeightLabel.Size = new System.Drawing.Size(41, 13);
     
    9394      //
    9495      this.variableNameLabel.AutoSize = true;
    95       this.variableNameLabel.Location = new System.Drawing.Point(13, 74);
     96      this.variableNameLabel.Location = new System.Drawing.Point(19, 66);
    9697      this.variableNameLabel.Name = "variableNameLabel";
    9798      this.variableNameLabel.Size = new System.Drawing.Size(35, 13);
     
    104105      this.variableNamesCombo.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
    105106      this.variableNamesCombo.FormattingEnabled = true;
    106       this.variableNamesCombo.Location = new System.Drawing.Point(120, 71);
     107      this.variableNamesCombo.Location = new System.Drawing.Point(101, 63);
    107108      this.variableNamesCombo.Name = "variableNamesCombo";
    108       this.variableNamesCombo.Size = new System.Drawing.Size(108, 21);
     109      this.variableNamesCombo.Size = new System.Drawing.Size(127, 21);
    109110      this.variableNamesCombo.TabIndex = 5;
    110111      this.variableNamesCombo.Visible = false;
     
    112113      // variableWeightTextBox
    113114      //
    114       this.variableWeightTextBox.Location = new System.Drawing.Point(120, 41);
     115      this.variableWeightTextBox.Location = new System.Drawing.Point(101, 37);
    115116      this.variableWeightTextBox.Name = "variableWeightTextBox";
    116       this.variableWeightTextBox.Size = new System.Drawing.Size(108, 20);
     117      this.variableWeightTextBox.Size = new System.Drawing.Size(127, 20);
    117118      this.variableWeightTextBox.TabIndex = 6;
    118119      this.variableWeightTextBox.Text = "0.0";
     
    122123      // constantValueTextBox
    123124      //
    124       this.constantValueTextBox.Location = new System.Drawing.Point(120, 41);
     125      this.constantValueTextBox.Location = new System.Drawing.Point(101, 37);
    125126      this.constantValueTextBox.Name = "constantValueTextBox";
    126       this.constantValueTextBox.Size = new System.Drawing.Size(108, 20);
     127      this.constantValueTextBox.Size = new System.Drawing.Size(127, 20);
    127128      this.constantValueTextBox.TabIndex = 7;
    128129      this.constantValueTextBox.Text = "0.0";
     
    133134      //
    134135      this.constantValueLabel.AutoSize = true;
    135       this.constantValueLabel.Location = new System.Drawing.Point(13, 44);
     136      this.constantValueLabel.Location = new System.Drawing.Point(19, 40);
    136137      this.constantValueLabel.Name = "constantValueLabel";
    137138      this.constantValueLabel.Size = new System.Drawing.Size(34, 13);
     
    149150      //
    150151      this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
    151       this.okButton.Location = new System.Drawing.Point(12, 112);
     152      this.okButton.Location = new System.Drawing.Point(72, 98);
    152153      this.okButton.Name = "okButton";
    153154      this.okButton.Size = new System.Drawing.Size(75, 23);
     
    160161      //
    161162      this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
    162       this.cancelButton.Location = new System.Drawing.Point(153, 112);
     163      this.cancelButton.Location = new System.Drawing.Point(153, 98);
    163164      this.cancelButton.Name = "cancelButton";
    164165      this.cancelButton.Size = new System.Drawing.Size(75, 23);
     
    168169      this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click);
    169170      //
     171      // variableNameTextBox
     172      //
     173      this.variableNameTextBox.Location = new System.Drawing.Point(101, 63);
     174      this.variableNameTextBox.Name = "variableNameTextBox";
     175      this.variableNameTextBox.Size = new System.Drawing.Size(127, 20);
     176      this.variableNameTextBox.TabIndex = 11;
     177      this.variableNameTextBox.Visible = false;
     178      //
    170179      // InsertNodeDialog
    171180      //
     
    173182      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
    174183      this.CancelButton = this.cancelButton;
    175       this.ClientSize = new System.Drawing.Size(240, 147);
     184      this.ClientSize = new System.Drawing.Size(241, 133);
    176185      this.ControlBox = false;
     186      this.Controls.Add(this.variableNameTextBox);
    177187      this.Controls.Add(this.cancelButton);
    178188      this.Controls.Add(this.okButton);
     
    208218    private System.Windows.Forms.Button cancelButton;
    209219    private System.Windows.Forms.Button okButton;
     220    private System.Windows.Forms.TextBox variableNameTextBox;
    210221  }
    211222}
  • branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/TreeEditDialogs/SymbolicExpressionTreeNodeInsertDialog.cs

    r9708 r17687  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    2323using System.Collections.Generic;
    2424using System.ComponentModel;
     25using System.Linq;
    2526using System.Text;
    2627using System.Windows.Forms;
     
    3031namespace HeuristicLab.Problems.DataAnalysis.Symbolic.Views {
    3132  public partial class InsertNodeDialog : Form {
     33    public string SelectedVariableName {
     34      get {
     35        var variable = SelectedSymbol as Variable;
     36        if (variable == null)
     37          return string.Empty;
     38        return variable.VariableNames.Any() ? variableNamesCombo.Text : variableNameTextBox.Text;
     39      }
     40    }
     41
    3242    public InsertNodeDialog() {
    3343      InitializeComponent();
     
    4050    }
    4151
    42     public ISymbol SelectedSymbol() {
    43       return (ISymbol)allowedSymbolsCombo.SelectedItem;
     52    public ISymbol SelectedSymbol {
     53      get { return (ISymbol)allowedSymbolsCombo.SelectedItem; }
    4454    }
    4555
     
    5565        constantValueLabel.Visible = true;
    5666        constantValueTextBox.Visible = true;
    57       } else if (symbol is Variable) {
    58         var variable = (Variable)symbol;
    59         foreach (var name in variable.VariableNames) variableNamesCombo.Items.Add(name);
    60         variableNamesCombo.SelectedIndex = 0;
     67      } else if (symbol is VariableBase) {
     68        var variableSymbol = (VariableBase)symbol;
     69        if (variableSymbol.VariableNames.Any()) {
     70          foreach (var name in variableSymbol.VariableNames)
     71            variableNamesCombo.Items.Add(name);
     72          variableNamesCombo.SelectedIndex = 0;
     73          variableNamesCombo.Visible = true;
     74          variableNameTextBox.Visible = false;
     75        } else {
     76          variableNamesCombo.Visible = false;
     77          variableNameTextBox.Visible = true;
     78        }
    6179        variableNameLabel.Visible = true;
    62         variableNamesCombo.Visible = true;
    6380        variableWeightLabel.Visible = true;
    6481        variableWeightTextBox.Visible = true;
  • branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/TreeEditDialogs/SymbolicExpressionTreeVariableNodeEditDialog.Designer.cs

    r9708 r17687  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    5555      this.okButton = new System.Windows.Forms.Button();
    5656      this.cancelButton = new System.Windows.Forms.Button();
     57      this.variableNameTextBox = new System.Windows.Forms.TextBox();
    5758      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
    5859      this.SuspendLayout();
     
    6162      //
    6263      this.originalValueLabel.AutoSize = true;
    63       this.originalValueLabel.Location = new System.Drawing.Point(12, 48);
     64      this.originalValueLabel.Location = new System.Drawing.Point(6, 42);
    6465      this.originalValueLabel.Name = "originalValueLabel";
    6566      this.originalValueLabel.Size = new System.Drawing.Size(72, 13);
     
    6970      // oldValueTextBox
    7071      //
    71       this.oldValueTextBox.Location = new System.Drawing.Point(123, 45);
     72      this.oldValueTextBox.Location = new System.Drawing.Point(101, 39);
    7273      this.oldValueTextBox.Name = "oldValueTextBox";
    7374      this.oldValueTextBox.ReadOnly = true;
     
    7778      // newValueTextBox
    7879      //
    79       this.newValueTextBox.Location = new System.Drawing.Point(123, 82);
     80      this.newValueTextBox.Location = new System.Drawing.Point(101, 65);
    8081      this.newValueTextBox.Name = "newValueTextBox";
    8182      this.newValueTextBox.Size = new System.Drawing.Size(131, 20);
     
    8889      //
    8990      this.newValueLabel.AutoSize = true;
    90       this.newValueLabel.Location = new System.Drawing.Point(12, 85);
     91      this.newValueLabel.Location = new System.Drawing.Point(6, 68);
    9192      this.newValueLabel.Name = "newValueLabel";
    9293      this.newValueLabel.Size = new System.Drawing.Size(59, 13);
     
    103104      //
    104105      this.variableNameLabel.AutoSize = true;
    105       this.variableNameLabel.Location = new System.Drawing.Point(12, 12);
     106      this.variableNameLabel.Location = new System.Drawing.Point(6, 15);
    106107      this.variableNameLabel.Name = "variableNameLabel";
    107108      this.variableNameLabel.Size = new System.Drawing.Size(76, 13);
     
    114115      this.variableNamesCombo.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
    115116      this.variableNamesCombo.FormattingEnabled = true;
    116       this.variableNamesCombo.Location = new System.Drawing.Point(123, 9);
     117      this.variableNamesCombo.Location = new System.Drawing.Point(101, 12);
    117118      this.variableNamesCombo.Name = "variableNamesCombo";
    118119      this.variableNamesCombo.Size = new System.Drawing.Size(131, 21);
     
    126127      //
    127128      this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
    128       this.okButton.Location = new System.Drawing.Point(15, 119);
     129      this.okButton.Location = new System.Drawing.Point(75, 98);
    129130      this.okButton.Name = "okButton";
    130131      this.okButton.Size = new System.Drawing.Size(75, 23);
     
    138139      this.cancelButton.CausesValidation = false;
    139140      this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
    140       this.cancelButton.Location = new System.Drawing.Point(179, 119);
     141      this.cancelButton.Location = new System.Drawing.Point(156, 98);
    141142      this.cancelButton.Name = "cancelButton";
    142143      this.cancelButton.Size = new System.Drawing.Size(75, 23);
     
    146147      this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click);
    147148      //
     149      // variableNameTextBox
     150      //
     151      this.variableNameTextBox.Location = new System.Drawing.Point(101, 12);
     152      this.variableNameTextBox.Name = "variableNameTextBox";
     153      this.variableNameTextBox.Size = new System.Drawing.Size(131, 20);
     154      this.variableNameTextBox.TabIndex = 12;
     155      this.variableNameTextBox.Visible = false;
     156      //
    148157      // VariableNodeEditDialog
    149158      //
     
    152161      this.AutoSize = true;
    153162      this.CancelButton = this.cancelButton;
    154       this.ClientSize = new System.Drawing.Size(269, 154);
     163      this.ClientSize = new System.Drawing.Size(244, 134);
    155164      this.ControlBox = false;
     165      this.Controls.Add(this.variableNameTextBox);
    156166      this.Controls.Add(this.cancelButton);
    157167      this.Controls.Add(this.okButton);
     
    188198    public System.Windows.Forms.TextBox newValueTextBox;
    189199    public System.Windows.Forms.ComboBox variableNamesCombo;
     200    private System.Windows.Forms.TextBox variableNameTextBox;
    190201  }
    191202}
  • branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/TreeEditDialogs/SymbolicExpressionTreeVariableNodeEditDialog.cs

    r9708 r17687  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    2222using System;
    2323using System.ComponentModel;
     24using System.Linq;
    2425using System.Text;
    2526using System.Windows.Forms;
     
    3334      get { return variableTreeNode; }
    3435      set {
    35         if (InvokeRequired)
    36           Invoke(new Action<SymbolicExpressionTreeNode>(x => variableTreeNode = (VariableTreeNode)x), value);
    37         else
     36        if (InvokeRequired) {
     37          Invoke(new Action<SymbolicExpressionTreeNode>(x =>
     38          {
     39            variableTreeNode = (VariableTreeNode) x;
     40            variableNameTextBox.Text = variableTreeNode.VariableName;
     41          }), value);
     42        } else {
    3843          variableTreeNode = value;
     44          variableNameTextBox.Text = variableTreeNode.VariableName;
     45        }
    3946      }
     47    }
     48
     49    public string SelectedVariableName {
     50      get { return variableNamesCombo.Visible ? variableNamesCombo.Text : variableNameTextBox.Text; }
    4051    }
    4152
     
    4354      InitializeComponent();
    4455      oldValueTextBox.TabStop = false; // cannot receive focus using tab key
    45 
    4656      NewNode = (VariableTreeNode)node; // will throw an invalid cast exception if node is not of the correct type
    4757      InitializeFields();
     
    5767        variableNameLabel.Visible = true;
    5868        variableNamesCombo.Visible = true;
    59         foreach (var name in variableTreeNode.Symbol.VariableNames) variableNamesCombo.Items.Add(name);
    60         variableNamesCombo.SelectedIndex = variableNamesCombo.Items.IndexOf(variableTreeNode.VariableName);
     69        if (variableTreeNode.Symbol.VariableNames.Any()) {
     70          foreach (var name in variableTreeNode.Symbol.VariableNames)
     71            variableNamesCombo.Items.Add(name);
     72          variableNamesCombo.SelectedIndex = variableNamesCombo.Items.IndexOf(variableTreeNode.VariableName);
     73          variableNamesCombo.Visible = true;
     74          variableNameTextBox.Visible = false;
     75        } else {
     76          variableNamesCombo.Visible = false;
     77          variableNameTextBox.Visible = true;
     78        }
    6179      }
    6280    }
     
    93111    #region combo box validation and events
    94112    private void variableNamesCombo_Validating(object sender, CancelEventArgs e) {
     113      if (variableNamesCombo.Items.Count == 0) return;
    95114      if (variableNamesCombo.Items.Contains(variableNamesCombo.SelectedItem)) return;
    96115      e.Cancel = true;
     
    119138    private void OnDialogValidated(object sender, EventArgs e) {
    120139      double weight = double.Parse(newValueTextBox.Text);
    121       var variableName = (string)variableNamesCombo.SelectedItem;
    122140      // we impose an extra validation condition: that the weight/value be different than the original ones
     141      var variableName = SelectedVariableName;
    123142      if (variableTreeNode.Weight.Equals(weight) && variableTreeNode.VariableName.Equals(variableName)) return;
    124143      variableTreeNode.Weight = weight;
  • branches/1837_Sliding Window GP/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/displayModelFrame.html

    r7446 r17687  
    1 <!-- this file is derived from sample.html from the MathJax distribution -->
    2 <!-- Copyright (c) 2009-2011 Design Science, Inc. -->
     1<!-- this file is derived from sample_tex.html from the MathJax distribution -->
     2<!-- Copyright (c) 2010-2015 The MathJax Consortium -->
    33<!-- adapted by HEAL for HeuristicLab-->
    44<!DOCTYPE html>
    55<html>
    66<head>
    7   <!-- title change by HEAL -->
    8   <title>Symbolic Expression Tree</title>
    9   <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    10   <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
    11   <script type="text/x-mathjax-config">
    12   MathJax.Hub.Config({
    13     extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
    14     jax: ["input/TeX","output/HTML-CSS"],
    15     tex2jax: {inlineMath: [["$","$"],["\\(","\\)"]]},
    16     imageFont: null
    17   });
    18  
    19 </script>
    20   <script type="text/javascript" src="./MathJax.js"></script>
    21   <!-- begin changes by HEAL -->
    22   <script type="text/javascript">
    23   function refreshModel() {
    24     var model = document.getElementById("model");
    25     MathJax.Hub.Queue(["Typeset",MathJax.Hub,model]);
    26   }
    27 </script>
    28   <!-- end changes by HEAL -->
    29   <style>
    30 h1 {text-align:center}
    31 h2 {
    32   font-weight: bold;
    33   background-color: #DDDDDD;
    34   padding: .2em .5em;
    35   margin-top: 1.5em;
    36   border-top: 3px solid #666666;
    37   border-bottom: 2px solid #999999;
    38 }
    39 </style>
     7    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
     8    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
     9    <meta name="viewport" content="width=device-width, initial-scale=1" />
     10
     11    <!-- title change by HEAL -->
     12    <title>Symbolic Expression Tree</title>
     13
     14    <script type="text/x-mathjax-config">
     15        MathJax.Hub.Config({
     16        extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
     17        jax: ["input/TeX","output/SVG"],
     18        tex2jax: {inlineMath: [["$","$"],["\\(","\\)"]]},
     19        "HTML-CSS": {preferredFont: "STIX-Web"},
     20        MathMenu: { showLocale:false},
     21        imageFont: null
     22        });
     23    </script>
     24
     25    <script type="text/javascript" async
     26            src="./MathJax/MathJax.js?config=TeX-AMS_SVG&locale=en">
     27    </script>
     28    <script type="text/javascript">
     29        <!-- necessary to re-typeset when the model is changed-->
     30        function refreshModel() {
     31            var model = document.getElementById("model");
     32            <!-- see https://docs.mathjax.org/en/v1.1-latest/typeset.html -->
     33            MathJax.Hub.Queue(["Typeset",MathJax.Hub,model]);
     34        }
     35    </script>
    4036</head>
    4137<body id="body">
    42   <noscript>
    43     <div style="color: #CC0000; text-align: center">
    44       <b>Warning: <a href="http://www.mathjax.org/">MathJax</a> requires JavaScript to process
    45         the mathematics on this page.<br />
    46         If your browser supports JavaScript, be sure it is enabled.</b>
    47     </div>
    48     <hr>
    49   </noscript>
    50   <p id="model">
    51   </p>
     38    <noscript>
     39        <div style="color: #CC0000; text-align: center">
     40            <b>
     41                Warning: <a href="http://www.mathjax.org/">MathJax</a> requires JavaScript to process
     42                the mathematics on this page.<br />
     43                If your browser supports JavaScript, be sure it is enabled.
     44            </b>
     45        </div>
     46        <hr>
     47    </noscript>
     48    <p id="model">$\cos(x^2)$
     49    </p>
    5250</body>
    5351</html>
Note: See TracChangeset for help on using the changeset viewer.