Index: branches/OptimizationNetworks/HeuristicLab.Networks/3.3/FeatureSelection Network/FeatureSelectionConnector.cs
===================================================================
--- branches/OptimizationNetworks/HeuristicLab.Networks/3.3/FeatureSelection Network/FeatureSelectionConnector.cs	(revision 12323)
+++ branches/OptimizationNetworks/HeuristicLab.Networks/3.3/FeatureSelection Network/FeatureSelectionConnector.cs	(revision 12323)
@@ -0,0 +1,46 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Networks.Programmable;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Networks {
+  [Item("Feature Selection Connector", "")]
+  [StorableClass]
+  public class FeatureSelectionConnector : ProgrammableNode {
+    protected override string CodeTemplate {
+      get { return ReadCodeTemplate("HeuristicLab.Networks.FeatureSelection_Network.FeatureSelectionConnectorCode.cs"); }
+    }
+
+    [StorableConstructor]
+    protected FeatureSelectionConnector(bool deserializing) : base(deserializing) { }
+    protected FeatureSelectionConnector(FeatureSelectionConnector original, Cloner cloner) : base(original, cloner) { }
+    public FeatureSelectionConnector() : base("FeatureSelectionConnector") { }
+    public FeatureSelectionConnector(string name) : base(name) { }
+    public FeatureSelectionConnector(string name, string description) : base(name, description) { }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new FeatureSelectionConnector(this, cloner);
+    }
+  }
+}
Index: branches/OptimizationNetworks/HeuristicLab.Networks/3.3/FeatureSelection Network/FeatureSelectionConnectorCode.cs
===================================================================
--- branches/OptimizationNetworks/HeuristicLab.Networks/3.3/FeatureSelection Network/FeatureSelectionConnectorCode.cs	(revision 12323)
+++ branches/OptimizationNetworks/HeuristicLab.Networks/3.3/FeatureSelection Network/FeatureSelectionConnectorCode.cs	(revision 12323)
@@ -0,0 +1,77 @@
+﻿using System;
+using System.Linq;
+using System.Threading;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Core.Networks;
+using HeuristicLab.Data;
+using HeuristicLab.Encodings.BinaryVectorEncoding;
+using HeuristicLab.Problems.DataAnalysis;
+
+namespace HeuristicLab.Networks.FeatureSelection_Network {
+  [Item("FeatureSelectionConnector", "")]
+  public sealed class FeatureSelectionConnectorCode : Node {
+    private FeatureSelectionConnectorCode(FeatureSelectionConnectorCode original, Cloner cloner) : base(original, cloner) { }
+    public FeatureSelectionConnectorCode()
+      : base() {
+      if (Ports.Count == 0)
+        Initialize();
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new FeatureSelectionConnectorCode(this, cloner);
+    }
+
+    public void Initialize() {
+      var parameters = new MessagePort("Parameters");
+      Ports.Add(parameters);
+      parameters.Parameters.Add(new PortParameter<IRegressionProblemData>("ProblemData") { Type = PortParameterType.Input });
+
+      var selectionPort = new MessagePort("Selection Connector");
+      Ports.Add(selectionPort);
+      selectionPort.Parameters.Add(new PortParameter<BinaryVector>("Selection") { Type = PortParameterType.Input });
+      selectionPort.Parameters.Add(new PortParameter<DoubleValue>("Quality") { Type = PortParameterType.Input | PortParameterType.Output });
+
+      var regressionPort = new MessagePort("Regression Connector");
+      Ports.Add(regressionPort);
+      regressionPort.Parameters.Add(new PortParameter<IRegressionProblemData>("ProblemData") { Type = PortParameterType.Output });
+      regressionPort.Parameters.Add(new PortParameter<IRegressionSolution>("Linear regression solution") { Type = PortParameterType.Input });
+      RegisterEvents();
+    }
+
+    public void RegisterEvents() {
+      var selection = (IMessagePort)Ports["Selection Connector"];
+      selection.MessageReceived += Selection_MessageReceived;
+    }
+    public void DeregisterEvents() {
+      var selection = (IMessagePort)Ports["Selection Connector"];
+      selection.MessageReceived -= Selection_MessageReceived;
+    }
+
+    private void Selection_MessageReceived(object sender, EventArgs<IMessage, CancellationToken> e) {
+      // get parameters
+      var parametersPort = (IMessagePort)Ports["Parameters"];
+      var parameters = parametersPort.PrepareMessage();
+      parametersPort.SendMessage(parameters, e.Value2);
+      var problemData = (IRegressionProblemData)parameters["ProblemData"];
+      problemData = (IRegressionProblemData)problemData.Clone();
+
+      // build coordinates
+      var selectionMsg = e.Value;
+      var selection = (BinaryVector)selectionMsg["Selection"];
+      var allowedVariables = problemData.InputVariables;
+      foreach (var t in selection.Zip(allowedVariables, Tuple.Create)) {
+        problemData.InputVariables.SetItemCheckedState(t.Item2, t.Item1);
+      }
+
+      // solve Regression
+      var regressionConPort = (IMessagePort)Ports["Regression Connector"];
+      var regressionMsg = regressionConPort.PrepareMessage();
+      regressionMsg["ProblemData"] = problemData;
+      regressionConPort.SendMessage(regressionMsg, e.Value2);
+      var solution = (IRegressionSolution)regressionMsg["Linear regression solution"];
+
+      selectionMsg["Quality"] = new DoubleValue(solution.TestNormalizedMeanSquaredError);
+    }
+  }
+}
Index: branches/OptimizationNetworks/HeuristicLab.Networks/3.3/FeatureSelection Network/FeatureSelectionNetwork.cs
===================================================================
--- branches/OptimizationNetworks/HeuristicLab.Networks/3.3/FeatureSelection Network/FeatureSelectionNetwork.cs	(revision 12323)
+++ branches/OptimizationNetworks/HeuristicLab.Networks/3.3/FeatureSelection Network/FeatureSelectionNetwork.cs	(revision 12323)
@@ -0,0 +1,47 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Networks.Programmable;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Networks {
+  [Creatable("Optimization Networks")]
+  [Item("Feature Selection Network", "")]
+  [StorableClass]
+  public class FeatureSelectionNetwork : ProgrammableNetwork {
+    protected override string CodeTemplate {
+      get { return ReadCodeTemplate("HeuristicLab.Networks.FeatureSelection_Network.FeatureSelectionNetworkCode.cs"); }
+    }
+
+    [StorableConstructor]
+    protected FeatureSelectionNetwork(bool deserializing) : base(deserializing) { }
+    protected FeatureSelectionNetwork(FeatureSelectionNetwork original, Cloner cloner) : base(original, cloner) { }
+    public FeatureSelectionNetwork() : base("FeatureSelectionNetwork") { }
+    public FeatureSelectionNetwork(string name) : base(name) { }
+    public FeatureSelectionNetwork(string name, string description) : base(name, description) { }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new FeatureSelectionNetwork(this, cloner);
+    }
+  }
+}
Index: branches/OptimizationNetworks/HeuristicLab.Networks/3.3/FeatureSelection Network/FeatureSelectionNetworkCode.cs
===================================================================
--- branches/OptimizationNetworks/HeuristicLab.Networks/3.3/FeatureSelection Network/FeatureSelectionNetworkCode.cs	(revision 12323)
+++ branches/OptimizationNetworks/HeuristicLab.Networks/3.3/FeatureSelection Network/FeatureSelectionNetworkCode.cs	(revision 12323)
@@ -0,0 +1,153 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Linq;
+using System.Threading;
+using HeuristicLab.Algorithms.DataAnalysis;
+using HeuristicLab.Algorithms.GeneticAlgorithm;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Core.Networks;
+using HeuristicLab.Data;
+using HeuristicLab.Encodings.BinaryVectorEncoding;
+using HeuristicLab.Networks.FeatureSelection_Network;
+using HeuristicLab.Networks.Programmable;
+using HeuristicLab.Problems.DataAnalysis;
+using HeuristicLab.Problems.Instances.DataAnalysis;
+using HeuristicLab.Random;
+
+namespace HeuristicLab.Networks {
+  [Creatable("Optimization Networks")]
+  [Item("Feature Selection Network 2", "An optimization network which contains a binary GA and a LR.")]
+  public sealed class CompiledFeatureSelectionNetwork : Network {
+    private CompiledFeatureSelectionNetwork(CompiledFeatureSelectionNetwork original, Cloner cloner) : base(original, cloner) { }
+    public CompiledFeatureSelectionNetwork()
+      : base() {
+      if (Nodes.Count == 0)
+        Initialize();
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new CompiledFeatureSelectionNetwork(this, cloner);
+    }
+
+    public void Initialize() {
+
+
+      #region ParametersNode
+      var paramsNode = new UserDefinedNode("ParametersNode");
+      Nodes.Add(paramsNode);
+
+      var paramsPort = new MessagePort("Parameters");
+      paramsNode.Ports.Add(paramsPort);
+
+      var rand = new MersenneTwister();
+      var normRand = new NormalDistributedRandom(rand, 0, 1);
+      var instanceProvider = new FeatureSelectionInstanceProvider();
+      var problemData = instanceProvider.LoadData(new FeatureSelection(100, 0.1, 0.2, rand, normRand));
+
+      paramsPort.Parameters.Add(new PortParameter<IRegressionProblemData>("ProblemData") {
+        Type = PortParameterType.Output,
+        DefaultValue = problemData
+      });
+      paramsPort.Parameters.Add(new PortParameter<IntValue>("Length") {
+        Type = PortParameterType.Output,
+        DefaultValue = new IntValue(problemData.AllowedInputVariables.Count())
+      });
+      #endregion
+
+      #region Selection Node
+      var selectionNode = new AlgorithmNode("SelectionNode");
+      Nodes.Add(selectionNode);
+
+      var configPort = new ConfigurationPort("ConfigureSelection");
+      selectionNode.Ports.Add(configPort);
+
+      configPort.Parameters.Add(new PortParameter<IRegressionProblemData>("ProblemData") {
+        Type = PortParameterType.Input
+      });
+
+      var evaluatePort = new MessagePort("EvaluateSelection");
+      selectionNode.Ports.Add(evaluatePort);
+
+      evaluatePort.Parameters.Add(new PortParameter<BinaryVector>("Selection") {
+        Type = PortParameterType.Output
+      });
+      evaluatePort.Parameters.Add(new PortParameter<DoubleValue>("Quality") {
+        Type = PortParameterType.Output | PortParameterType.Input
+      });
+
+      Func<BinaryVector, double> eval = vector => {
+        // hook returns test quality!, LR optimizes training quality only!
+
+        var msg = evaluatePort.PrepareMessage();
+        msg["Selection"] = vector;
+        evaluatePort.SendMessage(msg, new CancellationToken(false));
+
+        return ((DoubleValue)msg["Quality"]).Value;
+      };
+
+      var selectionGa = new GeneticAlgorithm();
+      var selectionProb = new SelectionProblem(eval, false);
+
+      selectionGa.Problem = selectionProb;
+      selectionGa.MaximumGenerations.Value = 50;
+      selectionGa.PopulationSize.Value = 10;
+      selectionGa.Mutator = selectionGa.MutatorParameter.ValidValues.Where(x => x.Name == "SinglePositionBitflipManipulator").First();
+      selectionNode.Algorithm = selectionGa;
+
+      #endregion
+
+      #region RegressionNode
+      var regressionNode = new AlgorithmNode("Regression");
+      Nodes.Add(regressionNode);
+
+      var executePort = new ExecutionPort("Execute");
+      regressionNode.Ports.Add(executePort);
+
+      executePort.Parameters.Add(new PortParameter<IRegressionProblemData>("ProblemData") {
+        Type = PortParameterType.Input
+      });
+      executePort.Parameters.Add(new PortParameter<IRegressionSolution>("Linear regression solution") {
+        Type = PortParameterType.Output
+      });
+
+      var linReg = new LinearRegression();
+      regressionNode.Algorithm = linReg;
+      #endregion
+
+      #region Connector
+      var featureSelectionConnector = (INode)new FeatureSelectionConnectorCode();
+      Nodes.Add(featureSelectionConnector);
+      #endregion
+
+      #region Wire Ports
+      configPort.ConnectedPort = paramsPort;
+      evaluatePort.ConnectedPort = (IMessagePort)featureSelectionConnector.Ports["Selection Connector"];
+      ((IMessagePort)featureSelectionConnector.Ports["Parameters"]).ConnectedPort = paramsPort;
+      ((IMessagePort)featureSelectionConnector.Ports["Regression Connector"]).ConnectedPort = executePort;
+
+      paramsPort.SendMessage(paramsPort.PrepareMessage());
+      #endregion
+    }
+  }
+}
Index: branches/OptimizationNetworks/HeuristicLab.Networks/3.3/FeatureSelection Network/SelectionProblem.cs
===================================================================
--- branches/OptimizationNetworks/HeuristicLab.Networks/3.3/FeatureSelection Network/SelectionProblem.cs	(revision 12323)
+++ branches/OptimizationNetworks/HeuristicLab.Networks/3.3/FeatureSelection Network/SelectionProblem.cs	(revision 12323)
@@ -0,0 +1,49 @@
+﻿using System;
+using HeuristicLab.Common;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using HeuristicLab.Encodings.BinaryVectorEncoding;
+using HeuristicLab.Optimization;
+using HeuristicLab.Parameters;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.Networks.FeatureSelection_Network {
+  public class SelectionProblem : SingleObjectiveBasicProblem<BinaryVectorEncoding> {
+    private Func<BinaryVector, double> eval;
+
+    public virtual int Length {
+      get { return Encoding.Length; }
+      set { Encoding.Length = value; }
+    }
+
+    protected SelectionProblem(SelectionProblem original, Cloner cloner)
+      : base(original, cloner) {
+    }
+    [StorableConstructor]
+    protected SelectionProblem(bool deserializing) : base(deserializing) { }
+
+    public SelectionProblem(Func<BinaryVector, double> eval, bool maximization)
+      : base() {
+      this.maximization = maximization;
+      this.eval = eval;
+
+
+      var lengthParam = new ValueParameter<IntValue>("Length");
+      lengthParam.ValueChanged += (o, s) => { Length = lengthParam.Value.Value; };
+      Parameters.Add(lengthParam);
+    }
+
+    public override IDeepCloneable Clone(Cloner cloner) {
+      return new SelectionProblem(this, cloner);
+    }
+
+    public override double Evaluate(Individual individual, IRandom random) {
+      return eval(individual.BinaryVector());
+    }
+
+    private readonly bool maximization;
+    public override bool Maximization {
+      get { return maximization; }
+    }
+  }
+}
Index: branches/OptimizationNetworks/HeuristicLab.Networks/3.3/HeuristicLab.Networks-3.3.csproj
===================================================================
--- branches/OptimizationNetworks/HeuristicLab.Networks/3.3/HeuristicLab.Networks-3.3.csproj	(revision 12232)
+++ branches/OptimizationNetworks/HeuristicLab.Networks/3.3/HeuristicLab.Networks-3.3.csproj	(revision 12323)
@@ -84,4 +84,9 @@
       <Private>False</Private>
     </Reference>
+    <Reference Include="HeuristicLab.Algorithms.DataAnalysis-3.4, Version=3.4.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Algorithms.DataAnalysis-3.4.dll</HintPath>
+      <Private>False</Private>
+    </Reference>
     <Reference Include="HeuristicLab.Algorithms.GeneticAlgorithm-3.3">
       <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Algorithms.GeneticAlgorithm-3.3.dll</HintPath>
@@ -142,8 +147,20 @@
       <Private>False</Private>
     </Reference>
+    <Reference Include="HeuristicLab.Problems.DataAnalysis-3.4, Version=3.4.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Problems.DataAnalysis-3.4.dll</HintPath>
+      <Private>False</Private>
+    </Reference>
     <Reference Include="HeuristicLab.Problems.Instances-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
       <SpecificVersion>False</SpecificVersion>
       <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Problems.Instances-3.3.dll</HintPath>
       <Private>False</Private>
+      <EmbedInteropTypes>False</EmbedInteropTypes>
+    </Reference>
+    <Reference Include="HeuristicLab.Problems.Instances.DataAnalysis-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Problems.Instances.DataAnalysis-3.3.dll</HintPath>
+      <EmbedInteropTypes>False</EmbedInteropTypes>
+      <Private>False</Private>
     </Reference>
     <Reference Include="HeuristicLab.Problems.Knapsack-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
@@ -155,4 +172,9 @@
       <SpecificVersion>False</SpecificVersion>
       <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Problems.TravelingSalesman-3.3.dll</HintPath>
+      <Private>False</Private>
+    </Reference>
+    <Reference Include="HeuristicLab.Random-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Random-3.3.dll</HintPath>
       <Private>False</Private>
     </Reference>
@@ -180,4 +202,9 @@
     <Compile Include="ConfigurationPort.cs" />
     <Compile Include="ExecutionPort.cs" />
+    <Compile Include="FeatureSelection Network\FeatureSelectionConnector.cs" />
+    <Compile Include="FeatureSelection Network\FeatureSelectionConnectorCode.cs" />
+    <Compile Include="FeatureSelection Network\FeatureSelectionNetwork.cs" />
+    <Compile Include="FeatureSelection Network\FeatureSelectionNetworkCode.cs" />
+    <Compile Include="FeatureSelection Network\SelectionProblem.cs" />
     <Compile Include="IAlgorithmNode.cs" />
     <Compile Include="IConfigurationPort.cs" />
