1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.hipparchus.optim.nonlinear.vector.constrained;
18
19
20 import org.junit.Assert;
21 import org.junit.Test;
22
23 public class ADMMQPOptionTest {
24
25 @Test
26 public void testSettersDouble() {
27
28 final ADMMQPOption option = new ADMMQPOption();
29
30 final double expectedValue = 1.;
31 option.setAlpha(expectedValue);
32 option.setEps(expectedValue);
33 option.setEpsInfeasible(expectedValue);
34 option.setRhoMax(expectedValue);
35 option.setRhoMin(expectedValue);
36 option.setRhoMax(expectedValue);
37 option.setSigma(expectedValue);
38
39 final double tolerance = 0.;
40 Assert.assertEquals(expectedValue, option.getAlpha(), tolerance);
41 Assert.assertEquals(expectedValue, option.getEps(), tolerance);
42 Assert.assertEquals(expectedValue, option.getEpsInfeasible(), tolerance);
43 Assert.assertEquals(expectedValue, option.getRhoMax(), tolerance);
44 Assert.assertEquals(expectedValue, option.getRhoMin(), tolerance);
45 Assert.assertEquals(expectedValue, option.getSigma(), tolerance);
46 }
47
48 @Test
49 public void testSettersBoolean() {
50
51 final ADMMQPOption option = new ADMMQPOption();
52
53 final boolean expectedValue = true;
54 option.setPolishing(expectedValue);
55 option.setUpdateRho(expectedValue);
56 option.setScaling(expectedValue);
57
58 Assert.assertEquals(expectedValue, option.isPolishing());
59 Assert.assertEquals(expectedValue, option.updateRho());
60 Assert.assertEquals(expectedValue, option.isScaling());
61 }
62
63 @Test
64 public void testSettersIntegers() {
65
66 final ADMMQPOption option = new ADMMQPOption();
67
68 final int expectedValue = 10;
69 option.setMaxRhoIteration(expectedValue);
70 option.setPolishingIteration(expectedValue);
71 option.setScaleMaxIteration(expectedValue);
72
73 Assert.assertEquals(expectedValue, option.getMaxRhoIteration());
74 Assert.assertEquals(expectedValue, option.getPolishIteration());
75 Assert.assertEquals(expectedValue, option.getScaleMaxIteration());
76 }
77
78 }