Free cookie consent management tool by TermsFeed Policy Generator

Changeset 345 for branches/3.0/sources


Ignore:
Timestamp:
06/26/08 15:30:16 (16 years ago)
Author:
gkronber
Message:
  • merged r338 r341 and r343 from the ticket-specific trunk into the HL3.0 stable branch
  • fixed serialization and display of floating point numbers in HL3.0 stable plugins HeuristicLab.Functions and HeuristicLab.DataAnalysis

(ticket #175)

Location:
branches/3.0/sources
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • branches/3.0/sources/HeuristicLab.Constraints/DoubleBoundedConstraint.cs

    r139 r345  
    136136      XmlNode node = base.GetXmlNode(name, document, persistedObjects);
    137137      XmlAttribute lb = document.CreateAttribute("LowerBound");
    138       lb.Value = LowerBound.ToString(CultureInfo.InvariantCulture);
     138      lb.Value = LowerBound.ToString("r", CultureInfo.InvariantCulture);
    139139      XmlAttribute lbi = document.CreateAttribute("LowerBoundIncluded");
    140140      lbi.Value = lowerBoundIncluded.ToString();
     
    142142      lbe.Value = lowerBoundEnabled.ToString();
    143143      XmlAttribute ub = document.CreateAttribute("UpperBound");
    144       ub.Value = upperBound.ToString(CultureInfo.InvariantCulture);
     144      ub.Value = upperBound.ToString("r", CultureInfo.InvariantCulture);
    145145      XmlAttribute ubi = document.CreateAttribute("UpperBoundIncluded");
    146146      ubi.Value = upperBoundIncluded.ToString();
  • branches/3.0/sources/HeuristicLab.Constraints/DoubleBoundedConstraintView.cs

    r2 r345  
    6969        ubEnabledCheckBox.Enabled = false;
    7070      } else {
    71         lbTextBox.Text = DoubleBoundedConstraint.LowerBound + "";
     71        lbTextBox.Text = DoubleBoundedConstraint.LowerBound.ToString("r");
    7272        lbTextBox.Enabled = DoubleBoundedConstraint.LowerBoundEnabled;
    7373        lbIncludedCheckBox.Checked = DoubleBoundedConstraint.LowerBoundIncluded;
     
    7676        lbEnabledCheckBox.Enabled = true;
    7777
    78         ubTextBox.Text = DoubleBoundedConstraint.UpperBound + "";
     78        ubTextBox.Text = DoubleBoundedConstraint.UpperBound.ToString("r");
    7979        ubTextBox.Enabled = DoubleBoundedConstraint.UpperBoundEnabled;
    8080        ubIncludedCheckBox.Checked = DoubleBoundedConstraint.UpperBoundIncluded;
  • branches/3.0/sources/HeuristicLab.Data/ArrayDataBaseView.Designer.cs

    r2 r345  
    105105    private System.Windows.Forms.Label sizeLabel;
    106106    private System.Windows.Forms.TextBox lengthTextBox;
    107     private System.Windows.Forms.DataGridView dataGridView;
     107    protected System.Windows.Forms.DataGridView dataGridView;
    108108  }
    109109}
  • branches/3.0/sources/HeuristicLab.Data/ArrayDataBaseView.cs

    r2 r345  
    6464        dataGridView.RowCount = length;
    6565        for (int i = 0; i < length; i++) {
    66           dataGridView.Rows[i].Cells[0].Value = ArrayDataBase.Data.GetValue(i); ;
     66          dataGridView.Rows[i].Cells[0].Value = ArrayDataBase.Data.GetValue(i);
    6767        }
    6868      } else {
  • branches/3.0/sources/HeuristicLab.Data/ConstrainedDoubleDataView.cs

    r2 r345  
    6262      } else {
    6363        dataTextBox.Enabled = true;
    64         dataTextBox.Text = ConstrainedDoubleData.ToString();
     64        dataTextBox.Text = ConstrainedDoubleData.Data.ToString("r");
    6565      }
    6666    }
  • branches/3.0/sources/HeuristicLab.Data/DoubleArrayData.cs

    r2 r345  
    6565      for(int i = 0; i < Data.Length; i++) {
    6666        builder.Append(";");
    67         builder.Append(Data[i].ToString(format));
     67        builder.Append(Data[i].ToString("r", format));
    6868      }
    6969      if(builder.Length > 0)
  • branches/3.0/sources/HeuristicLab.Data/DoubleArrayDataView.cs

    r2 r345  
    3737    public DoubleArrayDataView() {
    3838      InitializeComponent();
     39      // round-trip format for all cells
     40      dataGridView.DefaultCellStyle.Format = "r";
    3941    }
    4042    public DoubleArrayDataView(DoubleArrayData doubleArrayData)
  • branches/3.0/sources/HeuristicLab.Data/DoubleData.cs

    r2 r345  
    5454    public override XmlNode GetXmlNode(string name, XmlDocument document, IDictionary<Guid,IStorable> persistedObjects) {
    5555      XmlNode node = base.GetXmlNode(name, document, persistedObjects);
    56       node.InnerText = Data.ToString(CultureInfo.InvariantCulture.NumberFormat);
     56      node.InnerText = Data.ToString("r", CultureInfo.InvariantCulture.NumberFormat);
    5757      return node;
    5858    }
  • branches/3.0/sources/HeuristicLab.Data/DoubleDataView.cs

    r2 r345  
    5959      } else {
    6060        dataTextBox.Enabled = true;
    61         dataTextBox.Text = DoubleData.ToString();
     61        dataTextBox.Text = DoubleData.Data.ToString("r");
    6262      }
    6363    }
  • branches/3.0/sources/HeuristicLab.Data/DoubleMatrixData.cs

    r2 r345  
    8181        for (int j = 0; j < Data.GetLength(1); j++) {
    8282          builder.Append(";");
    83           builder.Append(Data[i, j].ToString(format));
     83          builder.Append(Data[i, j].ToString("r", format));
    8484        }
    8585      }
  • branches/3.0/sources/HeuristicLab.Data/DoubleMatrixDataView.cs

    r2 r345  
    3737    public DoubleMatrixDataView() {
    3838      InitializeComponent();
     39      // round-trip format for all cells
     40      dataGridView.DefaultCellStyle.Format = "r";
    3941    }
    4042    public DoubleMatrixDataView(DoubleMatrixData doubleMatrixData)
  • branches/3.0/sources/HeuristicLab.Data/MatrixDataBaseView.Designer.cs

    r2 r345  
    132132    private System.Windows.Forms.Label rowsLabel;
    133133    private System.Windows.Forms.TextBox rowsTextBox;
    134     private System.Windows.Forms.DataGridView dataGridView;
     134    protected System.Windows.Forms.DataGridView dataGridView;
    135135    private System.Windows.Forms.TextBox columnsTextBox;
    136136    private System.Windows.Forms.Label columnsLabel;
  • branches/3.0/sources/HeuristicLab.DataAnalysis/Dataset.cs

    r278 r345  
    6666    public double[] Samples {
    6767      get { return samples; }
    68       set { 
     68      set {
    6969        samples = value;
    7070        CreateDictionaries();
     
    8181    public Dataset() {
    8282      Name = "-";
    83       VariableNames = new string[] {"Var0"};
     83      VariableNames = new string[] { "Var0" };
    8484      Columns = 1;
    8585      Rows = 1;
     
    146146      rows = int.Parse(node.Attributes["Dimension1"].Value, CultureInfo.InvariantCulture.NumberFormat);
    147147      columns = int.Parse(node.Attributes["Dimension2"].Value, CultureInfo.InvariantCulture.NumberFormat);
    148      
     148
    149149      VariableNames = ParseVariableNamesString(node.Attributes["VariableNames"].Value);
    150150
     
    154154      for(int row = 0; row < rows; row++) {
    155155        for(int column = 0; column < columns; column++) {
    156           if(double.TryParse(tokens[row * columns + column], NumberStyles.Float, CultureInfo.InvariantCulture.NumberFormat, out samples[row*columns + column]) == false) {
     156          if(double.TryParse(tokens[row * columns + column], NumberStyles.Float, CultureInfo.InvariantCulture.NumberFormat, out samples[row * columns + column]) == false) {
    157157            throw new FormatException("Can't parse " + tokens[row * columns + column] + " as double value.");
    158158          }
     
    171171        for(int column = 0; column < columns; column++) {
    172172          builder.Append(";");
    173           builder.Append(samples[row*columns+column].ToString(format));
     173          builder.Append(samples[row * columns + column].ToString("r",format));
    174174        }
    175175      }
     
    180180    private string GetVariableNamesString() {
    181181      string s = "";
    182       for (int i = 0; i < variableNames.Length; i++) {
     182      for(int i = 0; i < variableNames.Length; i++) {
    183183        s += variableNames[i] + "; ";
    184184      }
    185185
    186       if (variableNames.Length > 0) {
     186      if(variableNames.Length > 0) {
    187187        s = s.TrimEnd(';', ' ');
    188188      }
     
    192192    private string[] ParseVariableNamesString(string p) {
    193193      p = p.Trim();
    194       string[] tokens = p.Split(new char[] {';'}, StringSplitOptions.RemoveEmptyEntries);
     194      string[] tokens = p.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
    195195      return tokens;
    196196    }
    197197
    198198    public double GetMean(int column) {
    199       return GetMean(column, 0, Rows-1);
     199      return GetMean(column, 0, Rows - 1);
    200200    }
    201201
     
    216216
    217217    public double GetRange(int column) {
    218       return GetRange(column, 0, Rows-1);
     218      return GetRange(column, 0, Rows - 1);
    219219    }
    220220
  • branches/3.0/sources/HeuristicLab.DataAnalysis/DatasetView.cs

    r278 r345  
    4141      InitializeComponent();
    4242      openFileDialog = new OpenFileDialog();
     43
     44      dataGridView.DefaultCellStyle.Format = "r";
    4345    }
    4446
  • branches/3.0/sources/HeuristicLab.Functions/FunctionView.cs

    r2 r345  
    285285
    286286      public void Visit(Constant constant) {
    287         prefix += currentIndend + "[T]Constant(" + constant.Value.Data.ToString() + ";0;0)";
     287        prefix += currentIndend + "[T]Constant(" + constant.Value.Data.ToString("r") + ";0;0)";
    288288      }
    289289
     
    333333
    334334      public void Visit(HeuristicLab.Functions.Variable variable) {
    335         prefix += currentIndend + "[T]Variable(" + variable.Weight + ";" + variable.VariableIndex + ";" + -variable.SampleOffset + ")";
     335        prefix += currentIndend + "[T]Variable(" + variable.Weight.ToString("r") + ";" + variable.VariableIndex.ToString("r") + ";" + (-variable.SampleOffset).ToString("r") + ")";
    336336      }
    337337
  • branches/3.0/sources/HeuristicLab.Random/NormalDistributedRandom.cs

    r139 r345  
    516516
    517517      XmlNode muNode = document.CreateNode(XmlNodeType.Element, "Mu", null);
    518       muNode.InnerText = mu.ToString(CultureInfo.InvariantCulture);
     518      muNode.InnerText = mu.ToString("r", CultureInfo.InvariantCulture);
    519519      node.AppendChild(muNode);
    520520
    521521      XmlNode sigmaNode = document.CreateNode(XmlNodeType.Element, "Sigma", null);
    522       sigmaNode.InnerText = sigma.ToString(CultureInfo.InvariantCulture);
     522      sigmaNode.InnerText = sigma.ToString("r", CultureInfo.InvariantCulture);
    523523      node.AppendChild(sigmaNode);
    524524
Note: See TracChangeset for help on using the changeset viewer.