Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/27/09 15:42:04 (15 years ago)
Author:
epitzer
Message:

Migration of DataAnalysis, GP, GP.StructureIdentification and Modeling to new Persistence-3.3 (#603)

Location:
trunk/sources/HeuristicLab.DataAnalysis/3.3
Files:
3 edited
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.DataAnalysis/3.3/Dataset.cs

    r1786 r1914  
    2727using System.Globalization;
    2828using System.Text;
     29using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2930
    3031namespace HeuristicLab.DataAnalysis {
    3132  public sealed class Dataset : ItemBase {
    3233
     34    [Storable]
    3335    private string name;
     36
     37    [Storable]
     38    private int rows;
     39
     40    [Storable]
     41    private int columns;
     42
     43    [Storable]
     44    private string[] variableNames;
     45
     46    [Storable]
     47    private double[] scalingFactor;
     48
     49    [Storable]
     50    private double[] scalingOffset;
     51
     52    [Storable]
    3453    private double[] samples;
    35     private int rows;
    36     private int columns;
     54
    3755    private Dictionary<int, Dictionary<int, double>>[] cachedMeans;
    3856    private Dictionary<int, Dictionary<int, double>>[] cachedRanges;
    39     private double[] scalingFactor;
    40     private double[] scalingOffset;
     57
     58    [Storable]
     59    private object CreateDictionaries_Persistence {
     60      get { return null; }
     61      set { CreateDictionaries(); }
     62    }
    4163
    4264    public string Name {
     
    93115      }
    94116    }
    95 
    96     private string[] variableNames;
    97117
    98118    public Dataset() {
     
    145165    }
    146166
    147     public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid, IStorable> persistedObjects) {
    148       XmlNode node = base.GetXmlNode(name, document, persistedObjects);
    149       XmlAttribute problemName = document.CreateAttribute("Name");
    150       problemName.Value = Name;
    151       node.Attributes.Append(problemName);
    152       XmlAttribute dim1 = document.CreateAttribute("Dimension1");
    153       dim1.Value = rows.ToString(CultureInfo.InvariantCulture.NumberFormat);
    154       node.Attributes.Append(dim1);
    155       XmlAttribute dim2 = document.CreateAttribute("Dimension2");
    156       dim2.Value = columns.ToString(CultureInfo.InvariantCulture.NumberFormat);
    157       node.Attributes.Append(dim2);
    158       XmlAttribute variableNames = document.CreateAttribute("VariableNames");
    159       variableNames.Value = GetVariableNamesString();
    160       node.Attributes.Append(variableNames);
    161       XmlAttribute scalingFactorsAttribute = document.CreateAttribute("ScalingFactors");
    162       scalingFactorsAttribute.Value = GetString(scalingFactor);
    163       node.Attributes.Append(scalingFactorsAttribute);
    164       XmlAttribute scalingOffsetsAttribute = document.CreateAttribute("ScalingOffsets");
    165       scalingOffsetsAttribute.Value = GetString(scalingOffset);
    166       node.Attributes.Append(scalingOffsetsAttribute);
    167       node.InnerText = ToString(CultureInfo.InvariantCulture.NumberFormat);
    168       return node;
    169     }
    170 
    171     public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
    172       base.Populate(node, restoredObjects);
    173       Name = node.Attributes["Name"].Value;
    174       rows = int.Parse(node.Attributes["Dimension1"].Value, CultureInfo.InvariantCulture.NumberFormat);
    175       columns = int.Parse(node.Attributes["Dimension2"].Value, CultureInfo.InvariantCulture.NumberFormat);
    176 
    177       variableNames = ParseVariableNamesString(node.Attributes["VariableNames"].Value);
    178       if (node.Attributes["ScalingFactors"] != null)
    179         scalingFactor = ParseDoubleString(node.Attributes["ScalingFactors"].Value);
    180       else {
    181         scalingFactor = new double[columns]; // compatibility with old serialization format
    182         for (int i = 0; i < scalingFactor.Length; i++) scalingFactor[i] = 1.0;
    183       }
    184       if (node.Attributes["ScalingOffsets"] != null)
    185         scalingOffset = ParseDoubleString(node.Attributes["ScalingOffsets"].Value);
    186       else {
    187         scalingOffset = new double[columns]; // compatibility with old serialization format
    188         for (int i = 0; i < scalingOffset.Length; i++) scalingOffset[i] = 0.0;
    189       }
    190 
    191       string[] tokens = node.InnerText.Split(';');
    192       if (tokens.Length != rows * columns) throw new FormatException();
    193       samples = new double[rows * columns];
    194       for (int row = 0; row < rows; row++) {
    195         for (int column = 0; column < columns; column++) {
    196           if (double.TryParse(tokens[row * columns + column], NumberStyles.Float, CultureInfo.InvariantCulture.NumberFormat, out samples[row * columns + column]) == false) {
    197             throw new FormatException("Can't parse " + tokens[row * columns + column] + " as double value.");
    198           }
    199         }
    200       }
    201       CreateDictionaries();
    202     }
    203 
    204167    public override string ToString() {
    205168      return ToString(CultureInfo.CurrentCulture.NumberFormat);
     
    216179      if (builder.Length > 0) builder.Remove(0, 1);
    217180      return builder.ToString();
    218     }
    219 
    220     private string GetVariableNamesString() {
    221       string s = "";
    222       for (int i = 0; i < variableNames.Length; i++) {
    223         s += variableNames[i] + "; ";
    224       }
    225 
    226       if (variableNames.Length > 0) {
    227         s = s.TrimEnd(';', ' ');
    228       }
    229       return s;
    230     }
    231     private string GetString(double[] xs) {
    232       string s = "";
    233       for (int i = 0; i < xs.Length; i++) {
    234         s += xs[i].ToString("r", CultureInfo.InvariantCulture) + "; ";
    235       }
    236 
    237       if (xs.Length > 0) {
    238         s = s.TrimEnd(';', ' ');
    239       }
    240       return s;
    241     }
    242 
    243     private string[] ParseVariableNamesString(string p) {
    244       p = p.Trim();
    245       string[] tokens = p.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
    246       for (int i = 0; i < tokens.Length; i++) tokens[i] = tokens[i].Trim();
    247       return tokens;
    248     }
    249     private double[] ParseDoubleString(string s) {
    250       s = s.Trim();
    251       string[] ss = s.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
    252       double[] xs = new double[ss.Length];
    253       for (int i = 0; i < xs.Length; i++) {
    254         xs[i] = double.Parse(ss[i], CultureInfo.InvariantCulture);
    255       }
    256       return xs;
    257181    }
    258182
  • trunk/sources/HeuristicLab.DataAnalysis/3.3/HeuristicLab.DataAnalysis-3.3.csproj

    r1907 r1914  
    66    <ProductVersion>9.0.30729</ProductVersion>
    77    <SchemaVersion>2.0</SchemaVersion>
    8     <ProjectGuid>{7DD3A97A-56E9-462F-90E2-A351FE7AF5C2}</ProjectGuid>
     8    <ProjectGuid>{6AD536AE-B4CC-4424-B0A2-20CECE88CE57}</ProjectGuid>
    99    <OutputType>Library</OutputType>
    1010    <AppDesignerFolder>Properties</AppDesignerFolder>
    1111    <RootNamespace>HeuristicLab.DataAnalysis</RootNamespace>
    12     <AssemblyName>HeuristicLab.DataAnalysis-3.2</AssemblyName>
     12    <AssemblyName>HeuristicLab.DataAnalysis-3.3</AssemblyName>
    1313    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
    1414    <FileAlignment>512</FileAlignment>
     
    3232    <ErrorReport>prompt</ErrorReport>
    3333    <WarningLevel>4</WarningLevel>
    34     <DocumentationFile>bin\Release\HeuristicLab.DataAnalysis-3.2.XML</DocumentationFile>
     34    <DocumentationFile>bin\Release\HeuristicLab.DataAnalysis-3.3.xml</DocumentationFile>
    3535  </PropertyGroup>
    3636  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
     
    107107  </ItemGroup>
    108108  <ItemGroup>
    109     <ProjectReference Include="..\..\HeuristicLab.Core\3.2\HeuristicLab.Core-3.2.csproj">
    110       <Project>{F43B59AB-2B8C-4570-BC1E-15592086517C}</Project>
    111       <Name>HeuristicLab.Core-3.2</Name>
     109    <ProjectReference Include="..\..\HeuristicLab.Core\3.3\HeuristicLab.Core-3.3.csproj">
     110      <Project>{C36BD924-A541-4A00-AFA8-41701378DDC5}</Project>
     111      <Name>HeuristicLab.Core-3.3</Name>
    112112    </ProjectReference>
    113     <ProjectReference Include="..\..\HeuristicLab.Data\3.2\HeuristicLab.Data-3.2.csproj">
    114       <Project>{F473D9AF-3F09-4296-9F28-3C65118DAFFA}</Project>
    115       <Name>HeuristicLab.Data-3.2</Name>
     113    <ProjectReference Include="..\..\HeuristicLab.Data\3.3\HeuristicLab.Data-3.3.csproj">
     114      <Project>{BBAB9DF5-5EF3-4BA8-ADE9-B36E82114937}</Project>
     115      <Name>HeuristicLab.Data-3.3</Name>
    116116    </ProjectReference>
    117     <ProjectReference Include="..\..\HeuristicLab.Operators\3.2\HeuristicLab.Operators-3.2.csproj">
    118       <Project>{A9983BA2-B3B2-475E-8E2C-62050B71D1C5}</Project>
    119       <Name>HeuristicLab.Operators-3.2</Name>
     117    <ProjectReference Include="..\..\HeuristicLab.Operators\3.3\HeuristicLab.Operators-3.3.csproj">
     118      <Project>{23DA7FF4-D5B8-41B6-AA96-F0561D24F3EE}</Project>
     119      <Name>HeuristicLab.Operators-3.3</Name>
     120    </ProjectReference>
     121    <ProjectReference Include="..\..\HeuristicLab.Persistence\3.3\HeuristicLab.Persistence-3.3.csproj">
     122      <Project>{102BC7D3-0EF9-439C-8F6D-96FF0FDB8E1B}</Project>
     123      <Name>HeuristicLab.Persistence-3.3</Name>
    120124    </ProjectReference>
    121125    <ProjectReference Include="..\..\HeuristicLab.PluginInfrastructure\HeuristicLab.PluginInfrastructure.csproj">
     
    123127      <Name>HeuristicLab.PluginInfrastructure</Name>
    124128    </ProjectReference>
    125     <ProjectReference Include="..\..\HeuristicLab.Random\3.2\HeuristicLab.Random-3.2.csproj">
    126       <Project>{47019A74-F7F7-482E-83AA-D3F4F777E879}</Project>
    127       <Name>HeuristicLab.Random-3.2</Name>
     129    <ProjectReference Include="..\..\HeuristicLab.Random\3.3\HeuristicLab.Random-3.3.csproj">
     130      <Project>{F4539FB6-4708-40C9-BE64-0A1390AEA197}</Project>
     131      <Name>HeuristicLab.Random-3.3</Name>
    128132    </ProjectReference>
    129133  </ItemGroup>
  • trunk/sources/HeuristicLab.DataAnalysis/3.3/HeuristicLabDataAnalysisPlugin.cs

    r1529 r1914  
    2626
    2727namespace HeuristicLab.DataAnalysis {
    28   [ClassInfo(Name = "HeuristicLab.DataAnalysis-3.2")]
    29   [PluginFile(Filename = "HeuristicLab.DataAnalysis-3.2.dll", Filetype = PluginFileType.Assembly)]
    30   [Dependency(Dependency = "HeuristicLab.Core-3.2")]
    31   [Dependency(Dependency = "HeuristicLab.Data-3.2")]
     28  [ClassInfo(Name = "HeuristicLab.DataAnalysis-3.3")]
     29  [PluginFile(Filename = "HeuristicLab.DataAnalysis-3.3.dll", Filetype = PluginFileType.Assembly)]
     30  [Dependency(Dependency = "HeuristicLab.Core-3.3")]
     31  [Dependency(Dependency = "HeuristicLab.Data-3.3")]
     32  [Dependency(Dependency = "HeuristicLab.Operators-3.3")]
     33  [Dependency(Dependency = "HeuristicLab.Persistence-3.3")]
    3234  public class HeuristicLabDataAnalysisPlugin : PluginBase {
    3335  }
  • trunk/sources/HeuristicLab.DataAnalysis/3.3/Properties/AssemblyInfo.frame

    r581 r1914  
    5555// by using the '*' as shown below:
    5656// [assembly: AssemblyVersion("1.0.*")]
    57 [assembly: AssemblyVersion("3.2.0.$WCREV$")]
    58 [assembly: AssemblyFileVersion("3.2.0.$WCREV$")]
     57[assembly: AssemblyVersion("3.3.0.$WCREV$")]
     58[assembly: AssemblyFileVersion("3.3.0.$WCREV$")]
    5959[assembly: AssemblyBuildDate("$WCNOW$")]
Note: See TracChangeset for help on using the changeset viewer.