diff --git a/src/Numerics/Optimization/LevenbergMarquardtMinimizer.cs b/src/Numerics/Optimization/LevenbergMarquardtMinimizer.cs
index f340515d..526ca1df 100644
--- a/src/Numerics/Optimization/LevenbergMarquardtMinimizer.cs
+++ b/src/Numerics/Optimization/LevenbergMarquardtMinimizer.cs
@@ -10,7 +10,7 @@ namespace MathNet.Numerics.Optimization
///
/// The scale factor for initial mu
///
- public static double InitialMu { get; set; }
+ public double InitialMu { get; set; } = 1E-3;
public LevenbergMarquardtMinimizer(double initialMu = 1E-3, double gradientTolerance = 1E-15, double stepTolerance = 1E-15, double functionTolerance = 1E-15, int maximumIterations = -1)
: base(gradientTolerance, stepTolerance, functionTolerance, maximumIterations)
@@ -51,7 +51,7 @@ namespace MathNet.Numerics.Optimization
/// The stopping threshold for L2 norm of the residuals.
/// The max iterations.
/// The result of the Levenberg-Marquardt minimization
- public static NonlinearMinimizationResult Minimum(IObjectiveModel objective, Vector initialGuess,
+ public NonlinearMinimizationResult Minimum(IObjectiveModel objective, Vector initialGuess,
Vector lowerBound = null, Vector upperBound = null, Vector scales = null, List isFixed = null,
double initialMu = 1E-3, double gradientTolerance = 1E-15, double stepTolerance = 1E-15, double functionTolerance = 1E-15, int maximumIterations = -1)
{
diff --git a/src/Numerics/Optimization/NonlinearMinimizerBase.cs b/src/Numerics/Optimization/NonlinearMinimizerBase.cs
index 94206596..b1a7f1f8 100644
--- a/src/Numerics/Optimization/NonlinearMinimizerBase.cs
+++ b/src/Numerics/Optimization/NonlinearMinimizerBase.cs
@@ -9,39 +9,39 @@ namespace MathNet.Numerics.Optimization
///
/// The stopping threshold for the function value or L2 norm of the residuals.
///
- public static double FunctionTolerance { get; set; }
+ public double FunctionTolerance { get; set; }
///
/// The stopping threshold for L2 norm of the change of the parameters.
///
- public static double StepTolerance { get; set; }
+ public double StepTolerance { get; set; }
///
/// The stopping threshold for infinity norm of the gradient.
///
- public static double GradientTolerance { get; set; }
+ public double GradientTolerance { get; set; }
///
/// The maximum number of iterations.
///
- public static int MaximumIterations { get; set; }
+ public int MaximumIterations { get; set; }
///
/// The lower bound of the parameters.
///
- public static Vector LowerBound { get; private set; }
+ public Vector LowerBound { get; private set; }
///
/// The upper bound of the parameters.
///
- public static Vector UpperBound { get; private set; }
+ public Vector UpperBound { get; private set; }
///
/// The scale factors for the parameters.
///
- public static Vector Scales { get; private set; }
+ public Vector Scales { get; private set; }
- private static bool IsBounded => LowerBound != null || UpperBound != null || Scales != null;
+ private bool IsBounded => LowerBound != null || UpperBound != null || Scales != null;
protected NonlinearMinimizerBase(double gradientTolerance = 1E-18, double stepTolerance = 1E-18, double functionTolerance = 1E-18, int maximumIterations = -1)
{
@@ -51,7 +51,7 @@ namespace MathNet.Numerics.Optimization
MaximumIterations = maximumIterations;
}
- protected static void ValidateBounds(Vector parameters, Vector lowerBound = null, Vector upperBound = null, Vector scales = null)
+ protected void ValidateBounds(Vector parameters, Vector lowerBound = null, Vector upperBound = null, Vector scales = null)
{
if (parameters == null)
{
@@ -93,14 +93,14 @@ namespace MathNet.Numerics.Optimization
Scales = scales;
}
- protected static double EvaluateFunction(IObjectiveModel objective, Vector Pint)
+ protected double EvaluateFunction(IObjectiveModel objective, Vector Pint)
{
var Pext = ProjectToExternalParameters(Pint);
objective.EvaluateAt(Pext);
return objective.Value;
}
- protected static Tuple, Matrix> EvaluateJacobian(IObjectiveModel objective, Vector Pint)
+ protected Tuple, Matrix> EvaluateJacobian(IObjectiveModel objective, Vector Pint)
{
var gradient = objective.Gradient;
var hessian = objective.Hessian;
@@ -161,7 +161,7 @@ namespace MathNet.Numerics.Optimization
// Except when it is initial guess, the parameters argument is always internal parameter.
// So, first map the parameters argument to the external parameters in order to calculate function values.
- protected static Vector ProjectToInternalParameters(Vector Pext)
+ protected Vector ProjectToInternalParameters(Vector Pext)
{
var Pint = Pext.Clone();
@@ -209,7 +209,7 @@ namespace MathNet.Numerics.Optimization
return Pint;
}
- protected static Vector ProjectToExternalParameters(Vector Pint)
+ protected Vector ProjectToExternalParameters(Vector Pint)
{
var Pext = Pint.Clone();
@@ -257,7 +257,7 @@ namespace MathNet.Numerics.Optimization
return Pext;
}
- protected static Vector ScaleFactorsOfJacobian(Vector Pint)
+ protected Vector ScaleFactorsOfJacobian(Vector Pint)
{
var scale = Vector.Build.Dense(Pint.Count, 1.0);
diff --git a/src/Numerics/Optimization/TrustRegion/TrustRegionMinimizerBase.cs b/src/Numerics/Optimization/TrustRegion/TrustRegionMinimizerBase.cs
index f6e9fbdd..d003b5b0 100644
--- a/src/Numerics/Optimization/TrustRegion/TrustRegionMinimizerBase.cs
+++ b/src/Numerics/Optimization/TrustRegion/TrustRegionMinimizerBase.cs
@@ -10,12 +10,12 @@ namespace MathNet.Numerics.Optimization.TrustRegion
///
/// The trust region subproblem.
///
- public static ITrustRegionSubproblem Subproblem;
+ public ITrustRegionSubproblem Subproblem;
///
/// The stopping threshold for the trust region radius.
///
- public static double RadiusTolerance { get; set; }
+ public double RadiusTolerance { get; set; }
public TrustRegionMinimizerBase(ITrustRegionSubproblem subproblem,
double gradientTolerance = 1E-8, double stepTolerance = 1E-8, double functionTolerance = 1E-8, double radiusTolerance = 1E-8, int maximumIterations = -1)
@@ -59,7 +59,7 @@ namespace MathNet.Numerics.Optimization.TrustRegion
/// The stopping threshold for trust region radius
/// The max iterations.
///
- public static NonlinearMinimizationResult Minimum(ITrustRegionSubproblem subproblem, IObjectiveModel objective, Vector initialGuess,
+ public NonlinearMinimizationResult Minimum(ITrustRegionSubproblem subproblem, IObjectiveModel objective, Vector initialGuess,
Vector lowerBound = null, Vector upperBound = null, Vector scales = null, List isFixed = null,
double gradientTolerance = 1E-8, double stepTolerance = 1E-8, double functionTolerance = 1E-8, double radiusTolerance = 1E-18, int maximumIterations = -1)
{