Access static field in a static way

This commit is contained in:
Alex Herbert 2023-11-21 18:53:41 +00:00
parent 3620d60718
commit 68a21f7fb1
2 changed files with 10 additions and 8 deletions

View File

@ -24,6 +24,7 @@ import org.apache.commons.math4.legacy.optim.MaxEval;
import org.apache.commons.math4.legacy.optim.PointValuePair;
import org.apache.commons.math4.legacy.optim.nonlinear.scalar.GoalType;
import org.apache.commons.math4.legacy.optim.nonlinear.scalar.ObjectiveFunction;
import org.apache.commons.math4.legacy.optim.nonlinear.scalar.noderiv.OptimTestUtils.FourExtrema;
import org.apache.commons.math4.legacy.core.MathArrays;
import org.apache.commons.math4.core.jdkmath.JdkMath;
import org.junit.Assert;
@ -65,7 +66,7 @@ public class SimplexOptimizerMultiDirectionalTest {
GoalType.MINIMIZE,
105,
Simplex.alongAxes(OptimTestUtils.point(2, 0.2, 1e-2)),
new PointValuePair(new double[] {f.xM, f.yP}, f.valueXmYp),
new PointValuePair(new double[] {FourExtrema.xM, FourExtrema.yP}, FourExtrema.valueXmYp),
1e-6);
}
@Test
@ -76,7 +77,7 @@ public class SimplexOptimizerMultiDirectionalTest {
GoalType.MAXIMIZE,
100,
Simplex.alongAxes(OptimTestUtils.point(2, 0.2, 1e-2)),
new PointValuePair(new double[] {f.xM, f.yM}, f.valueXmYm),
new PointValuePair(new double[] {FourExtrema.xM, FourExtrema.yM}, FourExtrema.valueXmYm),
1e-6);
}
@Test
@ -87,7 +88,7 @@ public class SimplexOptimizerMultiDirectionalTest {
GoalType.MINIMIZE,
100,
Simplex.alongAxes(OptimTestUtils.point(2, 0.2, 1e-2)),
new PointValuePair(new double[] {f.xP, f.yM}, f.valueXpYm),
new PointValuePair(new double[] {FourExtrema.xP, FourExtrema.yM}, FourExtrema.valueXpYm),
1e-6);
}
@Test
@ -98,7 +99,7 @@ public class SimplexOptimizerMultiDirectionalTest {
GoalType.MAXIMIZE,
110,
Simplex.alongAxes(OptimTestUtils.point(2, 0.2, 1e-2)),
new PointValuePair(new double[] {f.xP, f.yP}, f.valueXpYp),
new PointValuePair(new double[] {FourExtrema.xP, FourExtrema.yP}, FourExtrema.valueXpYp),
1e-6);
}

View File

@ -28,6 +28,7 @@ import org.apache.commons.math4.legacy.optim.PointValuePair;
import org.apache.commons.math4.legacy.optim.nonlinear.scalar.GoalType;
import org.apache.commons.math4.legacy.optim.nonlinear.scalar.LeastSquaresConverter;
import org.apache.commons.math4.legacy.optim.nonlinear.scalar.ObjectiveFunction;
import org.apache.commons.math4.legacy.optim.nonlinear.scalar.noderiv.OptimTestUtils.FourExtrema;
import org.apache.commons.math4.legacy.core.MathArrays;
import org.junit.Assert;
import org.junit.Test;
@ -136,7 +137,7 @@ public class SimplexOptimizerNelderMeadTest {
GoalType.MINIMIZE,
105,
Simplex.alongAxes(OptimTestUtils.point(2, 0.2, 1e-2)),
new PointValuePair(new double[] {f.xM, f.yP}, f.valueXmYp),
new PointValuePair(new double[] {FourExtrema.xM, FourExtrema.yP}, FourExtrema.valueXmYp),
1e-6);
}
@Test
@ -147,7 +148,7 @@ public class SimplexOptimizerNelderMeadTest {
GoalType.MAXIMIZE,
100,
Simplex.alongAxes(OptimTestUtils.point(2, 0.2, 1e-2)),
new PointValuePair(new double[] {f.xM, f.yM}, f.valueXmYm),
new PointValuePair(new double[] {FourExtrema.xM, FourExtrema.yM}, FourExtrema.valueXmYm),
1e-6);
}
@Test
@ -158,7 +159,7 @@ public class SimplexOptimizerNelderMeadTest {
GoalType.MINIMIZE,
100,
Simplex.alongAxes(OptimTestUtils.point(2, 0.2, 1e-2)),
new PointValuePair(new double[] {f.xP, f.yM}, f.valueXpYm),
new PointValuePair(new double[] {FourExtrema.xP, FourExtrema.yM}, FourExtrema.valueXpYm),
1e-6);
}
@Test
@ -169,7 +170,7 @@ public class SimplexOptimizerNelderMeadTest {
GoalType.MAXIMIZE,
110,
Simplex.alongAxes(OptimTestUtils.point(2, 0.2, 1e-2)),
new PointValuePair(new double[] {f.xP, f.yP}, f.valueXpYp),
new PointValuePair(new double[] {FourExtrema.xP, FourExtrema.yP}, FourExtrema.valueXpYp),
1e-6);
}