Index: branches/3087_Ceres_Integration/HeuristicLab.ExtLibs/HeuristicLab.NativeInterpreter/0.1/HeuristicLab.NativeInterpreter-0.1/DllImporter.cs
===================================================================
--- branches/3087_Ceres_Integration/HeuristicLab.ExtLibs/HeuristicLab.NativeInterpreter/0.1/HeuristicLab.NativeInterpreter-0.1/DllImporter.cs	(revision 17783)
+++ branches/3087_Ceres_Integration/HeuristicLab.ExtLibs/HeuristicLab.NativeInterpreter/0.1/HeuristicLab.NativeInterpreter-0.1/DllImporter.cs	(revision 17844)
@@ -1,3 +1,5 @@
 ﻿using System;
+using System.IO;
+using System.IO.Compression;
 using System.Runtime.InteropServices;
 
@@ -5,17 +7,74 @@
   [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
   public struct NativeInstruction {
-    public byte opcode;
-    public ushort narg;
-    public int childIndex;
-    public double value;
-    public double weight;
-
-    public IntPtr buf;
-    public IntPtr data;
+    public byte OpCode;
+    public ushort Arity;
+    public ushort Length;
+    public double Value;
+    public IntPtr Data;
+    public bool Optimize;
   }
 
+  // proxy structure to pass information from Ceres back to the caller
+  [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
+  public struct OptimizationSummary {
+    public double InitialCost; // value of the objective function before the optimization
+    public double FinalCost; // value of the objective function after the optimization
+    public int SuccessfulSteps; // number of minimizer iterations in which the step was accepted
+    public int UnsuccessfulSteps; // number of minimizer iterations in which the step was rejected
+    public int InnerIterationSteps; // number of times inner iterations were performed
+    public int ResidualEvaluations; // number of residual only evaluations
+    public int JacobianEvaluations; // number of Jacobian (and residual) evaluations
+  };
+
+  public enum MinimizerType : int {
+    LINE_SEARCH = 0,
+    TRUST_REGION = 1
+  }
+
+  public enum LinearSolverType : int {
+    DENSE_NORMAL_CHOLESKY = 0,
+    DENSE_QR = 1,
+    SPARSE_NORMAL_CHOLESKY = 2,
+    DENSE_SCHUR = 3,
+    SPARSE_SCHUR = 4,
+    ITERATIVE_SCHUR = 5,
+    CGNR = 6
+  }
+
+  public enum TrustRegionStrategyType : int {
+    LEVENBERG_MARQUARDT = 0,
+    DOGLEG = 1
+  }
+
+  public enum DoglegType : int {
+    TRADITIONAL_DOGLEG = 0,
+    SUBSPACE_DOGLEG = 1
+  }
+
+  public enum LineSearchDirectionType : int {
+    STEEPEST_DESCENT = 0,
+    NONLINEAR_CONJUGATE_GRADIENT = 1,
+    LBFGS = 2,
+    BFSG = 3
+  }
+
+  [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
+  public struct SolverOptions {
+    public int Iterations;
+    public int UseNonmonotonicSteps;
+    public int Minimizer; // type of minimizer (trust region or line search)
+    public int LinearSolver; // type of linear solver
+    public int TrustRegionStrategy; // levenberg-marquardt or dogleg
+    public int Dogleg; // type of dogleg (traditional or subspace)
+    public int LineSearchDirection; // line search direction type (BFGS, LBFGS, etc)
+    public int Algorithm;
+  };
+
   public static class NativeWrapper {
-    private const string x86dll = "hl-native-interpreter-msvc-x86.dll";
-    private const string x64dll = "hl-native-interpreter-msvc-x64.dll";
+    private const string x86zip = "hl-native-interpreter-x86.zip";
+    private const string x64zip = "hl-native-interpreter-x64.zip";
+
+    private const string x86dll = "hl-native-interpreter-x86.dll";
+    private const string x64dll = "hl-native-interpreter-x64.dll";
 
     private readonly static bool is64;
@@ -23,43 +82,45 @@
     static NativeWrapper() {
       is64 = Environment.Is64BitProcess;
+
+      //using (var zip = new FileStream(is64 ? x64zip : x86zip, FileMode.Open)) {
+      //  using (var archive = new ZipArchive(zip, ZipArchiveMode.Read)) {
+      //    foreach (var entry in archive.Entries) {
+      //      if (File.Exists(entry.Name)) {
+      //        File.Delete(entry.Name);
+      //      }
+      //    }
+      //    ZipFileExtensions.ExtractToDirectory(archive, Environment.CurrentDirectory);
+      //  }
+      //}
     }
 
-    public static double GetValue(NativeInstruction[] code, int len, int row) {
-      return is64 ? GetValue64(code, len, row) : GetValue32(code, len, row);
+    public static void GetValues(NativeInstruction[] code, int[] rows, double[] result, double[] target, SolverOptions options, ref OptimizationSummary summary) {
+      if (is64)
+        GetValues64(code, code.Length, rows, rows.Length, options, result, target, ref summary);
+      else
+        GetValues32(code, code.Length, rows, rows.Length, options, result, target, ref summary);
     }
 
-    public static void GetValues(NativeInstruction[] code, int len, int[] rows, int nRows, double[] result) {
+    public static void GetValuesVarPro(NativeInstruction[] code, int[] termIndices, int[] rows, double[] coefficients,
+      double[] result, double[] target, SolverOptions options, ref OptimizationSummary summary) {
       if (is64)
-        GetValues64(code, len, rows, nRows, result);
+        GetValuesVarPro64(code, code.Length, termIndices, termIndices.Length, rows, rows.Length, coefficients, options, result, target, ref summary);
       else
-        GetValues32(code, len, rows, nRows, result);
-    }
-
-    public static void GetValuesVectorized(NativeInstruction[] code, int len, int[] rows, int nRows, double[] result) {
-      if (is64)
-        GetValuesVectorized64(code, len, rows, nRows, result);
-      else
-        GetValuesVectorized32(code, len, rows, nRows, result);
+        GetValuesVarPro32(code, code.Length, termIndices, termIndices.Length, rows, rows.Length, coefficients, options, result, target, ref summary);
     }
 
     // x86
-    [DllImport(x86dll, EntryPoint = "GetValue", CallingConvention = CallingConvention.Cdecl)]
-    internal static extern double GetValue32(NativeInstruction[] code, int len, int row);
-
     [DllImport(x86dll, EntryPoint = "GetValues", CallingConvention = CallingConvention.Cdecl)]
-    internal static extern void GetValues32(NativeInstruction[] code, int len, int[] rows, int nRows, double[] result);
-
-    [DllImport(x86dll, EntryPoint = "GetValuesVectorized", CallingConvention = CallingConvention.Cdecl)]
-    internal static extern void GetValuesVectorized32(NativeInstruction[] code, int len, int[] rows, int nRows, double[] result);
+    internal static extern void GetValues32([In, Out] NativeInstruction[] code, int len, int[] rows, int nRows, SolverOptions options, [In, Out] double[] result, double[] target, ref OptimizationSummary summary);
 
     // x64
-    [DllImport(x64dll, EntryPoint = "GetValue", CallingConvention = CallingConvention.Cdecl)]
-    internal static extern double GetValue64(NativeInstruction[] code, int len, int row);
+    [DllImport(x64dll, EntryPoint = "GetValues", CallingConvention = CallingConvention.Cdecl)]
+    internal static extern void GetValues64([In, Out] NativeInstruction[] code, int len, int[] rows, int nRows, SolverOptions options, [In, Out] double[] result, double[] target, ref OptimizationSummary summary);
 
-    [DllImport(x64dll, EntryPoint = "GetValues", CallingConvention = CallingConvention.Cdecl)]
-    internal static extern void GetValues64(NativeInstruction[] code, int len, int[] rows, int nRows, double[] result);
+    [DllImport(x86dll, EntryPoint = "GetValuesVarPro", CallingConvention = CallingConvention.Cdecl)]
+    internal static extern void GetValuesVarPro32([In, Out] NativeInstruction[] code, int len, int[] termIndices, int nTerms, int[] rows, int nRows, [In, Out] double[] coefficients, SolverOptions options, [In, Out] double[] result, double[] target, ref OptimizationSummary summary);
 
-    [DllImport(x64dll, EntryPoint = "GetValuesVectorized", CallingConvention = CallingConvention.Cdecl)]
-    internal static extern void GetValuesVectorized64(NativeInstruction[] code, int len, int[] rows, int nRows, double[] result);
+    [DllImport(x64dll, EntryPoint = "GetValuesVarPro", CallingConvention = CallingConvention.Cdecl)]
+    internal static extern void GetValuesVarPro64([In, Out] NativeInstruction[] code, int len, int[] termIndices, int nTerms, int[] rows, int nRows, [In, Out] double[] coefficients, SolverOptions options, [In, Out] double[] result, double[] target, ref OptimizationSummary summary);
   }
 }
Index: branches/3087_Ceres_Integration/HeuristicLab.ExtLibs/HeuristicLab.NativeInterpreter/0.1/HeuristicLab.NativeInterpreter-0.1/Plugin.cs
===================================================================
--- branches/3087_Ceres_Integration/HeuristicLab.ExtLibs/HeuristicLab.NativeInterpreter/0.1/HeuristicLab.NativeInterpreter-0.1/Plugin.cs	(revision 17783)
+++ branches/3087_Ceres_Integration/HeuristicLab.ExtLibs/HeuristicLab.NativeInterpreter/0.1/HeuristicLab.NativeInterpreter-0.1/Plugin.cs	(revision 17844)
@@ -20,4 +20,7 @@
 #endregion
 
+using System;
+using System.IO;
+
 using HeuristicLab.PluginInfrastructure;
 
@@ -25,7 +28,15 @@
   [Plugin("HeuristicLab.NativeInterpreter", "Provides a native (C++) interpreter for symbolic expression trees", "0.0.0.1")]
   [PluginFile("HeuristicLab.Problems.DataAnalysis.Symbolic.NativeInterpreter-0.1.dll", PluginFileType.Assembly)]
-  [PluginFile("hl-native-interpreter-msvc-x86.dll", PluginFileType.NativeDll)]
-  [PluginFile("hl-native-interpreter-msvc-x64.dll", PluginFileType.NativeDll)]
   public class HeuristicLabNativeInterpreterPlugin : PluginBase {
+    public override void OnLoad() {
+      base.OnLoad();
+      // add path for native dlls to PATH env variable
+
+      var is64 = Environment.Is64BitProcess;
+      string nativeDllPath = Path.Combine(Environment.CurrentDirectory, is64 ? "x64" : "x86");
+      var envPath = Environment.GetEnvironmentVariable("PATH");
+      if (!envPath.Contains(nativeDllPath))
+        Environment.SetEnvironmentVariable("PATH", envPath + ";" + nativeDllPath);
+    }
   }
 }
