Skip to content

Commit 9b389d5

Browse files
committed
refactor: Use non-zero initial error when the parameter value is zero for imporved performance and resilience
1 parent f7a0d71 commit 9b389d5

File tree

2 files changed

+1
-17
lines changed

2 files changed

+1
-17
lines changed

minuit2.net/ParameterConfigurationExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public static MnUserParameterState AsState(this IEnumerable<ParameterConfigurati
1111

1212
private static void Add(this MnUserParameterState state, ParameterConfiguration parameter)
1313
{
14-
state.Add(parameter.Name, parameter.Value, parameter.Value * 0.01);
14+
state.Add(parameter.Name, parameter.Value, parameter.Value == 0 ? 1 : parameter.Value * 0.01);
1515

1616
if (parameter.IsFixed)
1717
state.Fix(parameter.Name);

test/minuit2.net.UnitTests/The_simplex_minimizer.fails_for_the_following_challenging_problems.verified.txt

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -31,22 +31,6 @@
3131
BoxBodProblem.WithoutDerivatives (Fast),
3232
BoxBodProblem.WithoutDerivatives (Rigorous),
3333
BoxBodProblem.WithoutDerivatives (VeryRigorous),
34-
FletcherPowellProblem.WithGradient (Balanced),
35-
FletcherPowellProblem.WithGradient (Fast),
36-
FletcherPowellProblem.WithGradient (Rigorous),
37-
FletcherPowellProblem.WithGradient (VeryRigorous),
38-
FletcherPowellProblem.WithGradientAndHessian (Balanced),
39-
FletcherPowellProblem.WithGradientAndHessian (Fast),
40-
FletcherPowellProblem.WithGradientAndHessian (Rigorous),
41-
FletcherPowellProblem.WithGradientAndHessian (VeryRigorous),
42-
FletcherPowellProblem.WithGradientHessianAndHessianDiagonal (Balanced),
43-
FletcherPowellProblem.WithGradientHessianAndHessianDiagonal (Fast),
44-
FletcherPowellProblem.WithGradientHessianAndHessianDiagonal (Rigorous),
45-
FletcherPowellProblem.WithGradientHessianAndHessianDiagonal (VeryRigorous),
46-
FletcherPowellProblem.WithoutDerivatives (Balanced),
47-
FletcherPowellProblem.WithoutDerivatives (Fast),
48-
FletcherPowellProblem.WithoutDerivatives (Rigorous),
49-
FletcherPowellProblem.WithoutDerivatives (VeryRigorous),
5034
Mgh09Problem.WithGradient (Balanced),
5135
Mgh09Problem.WithGradient (Fast),
5236
Mgh09Problem.WithGradient (Rigorous),

0 commit comments

Comments
 (0)