Index: trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/NonlinearRegression/NonlinearRegression.cs
===================================================================
--- trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/NonlinearRegression/NonlinearRegression.cs	(revision 14316)
+++ trunk/sources/HeuristicLab.Algorithms.DataAnalysis/3.4/NonlinearRegression/NonlinearRegression.cs	(revision 14319)
@@ -22,4 +22,5 @@
 using System;
 using System.Linq;
+using HeuristicLab.Analysis;
 using HeuristicLab.Common;
 using HeuristicLab.Core;
@@ -47,4 +48,5 @@
     private const string SetSeedRandomlyParameterName = "SetSeedRandomly";
     private const string SeedParameterName = "Seed";
+    private const string InitParamsRandomlyParameterName = "InitializeParametersRandomly";
 
     public IFixedValueParameter<StringValue> ModelStructureParameter {
@@ -65,4 +67,8 @@
     public IFixedValueParameter<IntValue> RestartsParameter {
       get { return (IFixedValueParameter<IntValue>)Parameters[RestartsParameterName]; }
+    }
+
+    public IFixedValueParameter<BoolValue> InitParametersRandomlyParameter {
+      get { return (IFixedValueParameter<BoolValue>)Parameters[InitParamsRandomlyParameterName]; }
     }
 
@@ -90,4 +96,9 @@
       get { return SetSeedRandomlyParameter.Value.Value; }
       set { SetSeedRandomlyParameter.Value.Value = value; }
+    }
+
+    public bool InitializeParametersRandomly {
+      get { return InitParametersRandomlyParameter.Value.Value; }
+      set { InitParametersRandomlyParameter.Value.Value = value; }
     }
 
@@ -102,7 +113,21 @@
       Parameters.Add(new FixedValueParameter<StringValue>(ModelStructureParameterName, "The function for which the parameters must be fit (only numeric constants are tuned).", new StringValue("1.0 * x*x + 0.0")));
       Parameters.Add(new FixedValueParameter<IntValue>(IterationsParameterName, "The maximum number of iterations for constants optimization.", new IntValue(200)));
-      Parameters.Add(new FixedValueParameter<IntValue>(RestartsParameterName, "The number of independent random restarts", new IntValue(10)));
+      Parameters.Add(new FixedValueParameter<IntValue>(RestartsParameterName, "The number of independent random restarts (>0)", new IntValue(10)));
       Parameters.Add(new FixedValueParameter<IntValue>(SeedParameterName, "The PRNG seed value.", new IntValue()));
       Parameters.Add(new FixedValueParameter<BoolValue>(SetSeedRandomlyParameterName, "Switch to determine if the random number seed should be initialized randomly.", new BoolValue(true)));
+      Parameters.Add(new FixedValueParameter<BoolValue>(InitParamsRandomlyParameterName, "Switch to determine if the real-valued model parameters should be initialized randomly in each restart.", new BoolValue(false)));
+
+      SetParameterHiddenState();
+
+      InitParametersRandomlyParameter.Value.ValueChanged += (sender, args) => {
+        SetParameterHiddenState();
+      };
+    }
+
+    private void SetParameterHiddenState() {
+      var hide = !InitializeParametersRandomly;
+      RestartsParameter.Hidden = hide;
+      SeedParameter.Hidden = hide;
+      SetSeedRandomlyParameter.Hidden = hide;
     }
 
@@ -117,4 +142,11 @@
       if (!Parameters.ContainsKey(SetSeedRandomlyParameterName))
         Parameters.Add(new FixedValueParameter<BoolValue>(SetSeedRandomlyParameterName, "Switch to determine if the random number seed should be initialized randomly.", new BoolValue(true)));
+      if (!Parameters.ContainsKey(InitParamsRandomlyParameterName))
+        Parameters.Add(new FixedValueParameter<BoolValue>(InitParamsRandomlyParameterName, "Switch to determine if the numeric parameters of the model should be initialized randomly.", new BoolValue(false)));
+
+      SetParameterHiddenState();
+      InitParametersRandomlyParameter.Value.ValueChanged += (sender, args) => {
+        SetParameterHiddenState();
+      };
       #endregion
     }
@@ -126,13 +158,31 @@
     #region nonlinear regression
     protected override void Run() {
-      if (SetSeedRandomly) Seed = (new System.Random()).Next();
-      var rand = new MersenneTwister((uint)Seed);
-
-      var bestSolution = CreateRegressionSolution(Problem.ProblemData, ModelStructure, Iterations, rand);
-      for (int r = 0; r < Restarts; r++) {
-        var solution = CreateRegressionSolution(Problem.ProblemData, ModelStructure, Iterations, rand);
-        if (solution.TrainingRootMeanSquaredError < bestSolution.TrainingRootMeanSquaredError) {
-          bestSolution = solution;
+      IRegressionSolution bestSolution = null;
+      if (InitializeParametersRandomly) {
+        var qualityTable = new DataTable("RMSE table");
+        qualityTable.VisualProperties.YAxisLogScale = true;
+        var trainRMSERow = new DataRow("RMSE (train)");
+        trainRMSERow.VisualProperties.ChartType = DataRowVisualProperties.DataRowChartType.Points;
+        var testRMSERow = new DataRow("RMSE test");
+        testRMSERow.VisualProperties.ChartType = DataRowVisualProperties.DataRowChartType.Points;
+
+        qualityTable.Rows.Add(trainRMSERow);
+        qualityTable.Rows.Add(testRMSERow);
+        Results.Add(new Result(qualityTable.Name, qualityTable.Name + " for all restarts", qualityTable));
+        if (SetSeedRandomly) Seed = (new System.Random()).Next();
+        var rand = new MersenneTwister((uint)Seed);
+        bestSolution = CreateRegressionSolution(Problem.ProblemData, ModelStructure, Iterations, rand);
+        trainRMSERow.Values.Add(bestSolution.TrainingRootMeanSquaredError);
+        testRMSERow.Values.Add(bestSolution.TestRootMeanSquaredError);
+        for (int r = 0; r < Restarts; r++) {
+          var solution = CreateRegressionSolution(Problem.ProblemData, ModelStructure, Iterations, rand);
+          trainRMSERow.Values.Add(solution.TrainingRootMeanSquaredError);
+          testRMSERow.Values.Add(solution.TestRootMeanSquaredError);
+          if (solution.TrainingRootMeanSquaredError < bestSolution.TrainingRootMeanSquaredError) {
+            bestSolution = solution;
+          }
         }
+      } else {
+        bestSolution = CreateRegressionSolution(Problem.ProblemData, ModelStructure, Iterations);
       }
 
@@ -154,5 +204,5 @@
     /// <param name="random">Optional random number generator for random initialization of numeric constants.</param>
     /// <returns></returns>
-    public static ISymbolicRegressionSolution CreateRegressionSolution(IRegressionProblemData problemData, string modelStructure, int maxIterations, IRandom random = null) {
+    public static ISymbolicRegressionSolution CreateRegressionSolution(IRegressionProblemData problemData, string modelStructure, int maxIterations, IRandom rand = null) {
       var parser = new InfixExpressionParser();
       var tree = parser.Parse(modelStructure);
@@ -161,7 +211,9 @@
 
       // initialize constants randomly
-      if (random != null) {
+      if (rand != null) {
         foreach (var node in tree.IterateNodesPrefix().OfType<ConstantTreeNode>()) {
-          node.Value = NormalDistributedRandom.NextDouble(random, 0, 1);
+          double f = Math.Exp(NormalDistributedRandom.NextDouble(rand, 0, 1));
+          double s = rand.NextDouble() < 0.5 ? -1 : 1;
+          node.Value = s * node.Value * f;
         }
       }
