Free cookie consent management tool by TermsFeed Policy Generator

Changeset 15912


Ignore:
Timestamp:
04/19/18 13:43:53 (7 years ago)
Author:
rhanghof
Message:

#2913:

  • Added a RegressionInstanceProvider for Matlab instances.
  • Added an import dialog for importing Matlab data.
  • Added some classes which represents different Matlab specific datatypes.
  • Added a Matlab connector which contains a set of commands for interacting with the Matlab bridge.
Location:
branches/2913_MatlabScriptProblemInstanceProvider
Files:
21 added
3 edited

Legend:

Unmodified
Added
Removed
  • branches/2913_MatlabScriptProblemInstanceProvider/HeuristicLab.Problems.Instances.DataAnalysis.Views/3.3/HeuristicLab.Problems.Instances.DataAnalysis.Views-3.3.csproj

    r15185 r15912  
    123123      <DependentUpon>RegressionImportDialog.cs</DependentUpon>
    124124    </Compile>
     125    <Compile Include="Regression\Matlab\RegressionMatlabImportDialog.cs">
     126      <SubType>Form</SubType>
     127    </Compile>
     128    <Compile Include="Regression\Matlab\RegressionMatlabImportDialog.Designer.cs">
     129      <DependentUpon>RegressionMatlabImportDialog.cs</DependentUpon>
     130    </Compile>
    125131    <Compile Include="TimeSeriesPrognosisImportDialog.cs">
    126132      <SubType>Form</SubType>
     
    215221      <Private>False</Private>
    216222    </ProjectReference>
     223  </ItemGroup>
     224  <ItemGroup>
     225    <EmbeddedResource Include="RegressionInstanceProviderView.resx">
     226      <DependentUpon>RegressionInstanceProviderView.cs</DependentUpon>
     227    </EmbeddedResource>
     228    <EmbeddedResource Include="Regression\Matlab\RegressionMatlabImportDialog.resx">
     229      <DependentUpon>RegressionMatlabImportDialog.cs</DependentUpon>
     230    </EmbeddedResource>
    217231  </ItemGroup>
    218232  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  • branches/2913_MatlabScriptProblemInstanceProvider/HeuristicLab.Problems.Instances.DataAnalysis.Views/3.3/RegressionInstanceProviderView.cs

    r15583 r15912  
    2525using HeuristicLab.MainForm;
    2626using HeuristicLab.Problems.DataAnalysis;
     27using HeuristicLab.Problems.Instances.DataAnalysis.Regression.Matlab;
     28using HeuristicLab.Problems.Instances.DataAnalysis.Views.Regression.Matlab;
    2729
    2830namespace HeuristicLab.Problems.Instances.DataAnalysis.Views {
     
    4143
    4244    protected override void importButton_Click(object sender, EventArgs e) {
     45      if (Content is RegressionMatlabInstanceProvider) {
     46        ImportMatlabData();
     47      } else {
     48        ImportCSVData();
     49      }
     50    }
     51
     52    private void ImportCSVData() {
    4353      var importTypeDialog = new RegressionImportDialog();
    4454      if (importTypeDialog.ShowDialog() == DialogResult.OK) {
     
    7686      }
    7787    }
     88
     89
     90    private void ImportMatlabData() {
     91      var importTypeDialog = new RegressionMatlabImportDialog();
     92      if (importTypeDialog.ShowDialog() == DialogResult.OK) {
     93        IRegressionProblemData instance = null;
     94
     95        Task.Factory.StartNew(() => {
     96          var mainForm = (MainForm.WindowsForms.MainForm)MainFormManager.MainForm;
     97          // lock active view and show progress bar
     98          IContentView activeView = (IContentView)MainFormManager.MainForm.ActiveView;
     99
     100          try {
     101            var progress = mainForm.AddOperationProgressToContent(activeView.Content,
     102              "Loading problem instance.");
     103
     104            Content.ProgressChanged +=
     105              (o, args) => { progress.ProgressValue = args.ProgressPercentage / 100.0; };
     106
     107            instance = (Content as RegressionMatlabInstanceProvider).ImportData(importTypeDialog.Path, importTypeDialog.ImportType, importTypeDialog.SelectedVariables);
     108          } catch (Exception ex) {
     109            ErrorWhileParsing(ex);
     110            return;
     111          } finally {
     112            mainForm.RemoveOperationProgressFromContent(activeView.Content);
     113          }
     114
     115          try {
     116            GenericConsumer.Load(instance);
     117          } catch (Exception ex) {
     118            ErrorWhileLoading(ex, importTypeDialog.Path);
     119          } finally {
     120            Invoke((Action)(() => instancesComboBox.SelectedIndex = -1));
     121          }
     122        });
     123      }
     124    }   
    78125  }
    79126}
  • branches/2913_MatlabScriptProblemInstanceProvider/HeuristicLab.Problems.Instances.DataAnalysis/3.3/HeuristicLab.Problems.Instances.DataAnalysis-3.3.csproj

    r14790 r15912  
    114114      <SpecificVersion>False</SpecificVersion>
    115115      <HintPath>..\..\bin\ALGLIB-3.7.0.dll</HintPath>
     116    </Reference>
     117    <Reference Include="Interop.MLApp, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
     118      <SpecificVersion>False</SpecificVersion>
     119      <EmbedInteropTypes>True</EmbedInteropTypes>
     120      <HintPath>..\..\bin\Interop.MLApp.dll</HintPath>
    116121    </Reference>
    117122    <Reference Include="System" />
     
    157162    <Compile Include="Regression\FeatureSelection\FeatureSelection.cs" />
    158163    <Compile Include="Regression\FeatureSelection\FeatureSelectionInstanceProvider.cs" />
     164    <Compile Include="Regression\Matlab\Api\IMatlabConnector.cs" />
     165    <Compile Include="Regression\Matlab\Api\MatlabApiFactory.cs" />
     166    <Compile Include="Regression\Matlab\Api\MatlabConnector.cs" />
     167    <Compile Include="Regression\Matlab\RegressionMatlabImportType.cs" />
     168    <Compile Include="Regression\Matlab\RegressionMatlabInstanceProvider.cs" />
     169    <Compile Include="Regression\Matlab\Api\Types\IMLTimeseries.cs" />
     170    <Compile Include="Regression\Matlab\Api\Types\IMLValueVariable.cs" />
     171    <Compile Include="Regression\Matlab\Api\Types\IMLVariable.cs" />
     172    <Compile Include="Regression\Matlab\Api\Types\MLDatatype.cs" />
     173    <Compile Include="Regression\Matlab\Api\Types\MLDouble.cs" />
     174    <Compile Include="Regression\Matlab\Api\Types\MLDoubleArray.cs" />
     175    <Compile Include="Regression\Matlab\Api\Types\MLTimeseries.cs" />
    159176    <Compile Include="Regression\MibaFriction\CF3.cs" />
    160177    <Compile Include="Regression\MibaFriction\Wear1.cs" />
Note: See TracChangeset for help on using the changeset viewer.