View Javadoc
1   /*
2    * Licensed to the Hipparchus project under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The Hipparchus project licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    *
9    *      https://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
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 SQPOptionTest {
24  
25      @Test
26      public void testSettersDouble() {
27          // GIVEN
28          final SQPOption option = new SQPOption();
29          // WHEN
30          final double expectedValue = 1.;
31          option.setB(expectedValue);
32          option.setEps(expectedValue);
33          option.setMu(expectedValue);
34          option.setRhoCons(expectedValue);
35          option.setSigmaMax(expectedValue);
36          // THEN
37          final double tolerance = 0.;
38          Assert.assertEquals(expectedValue, option.getB(), tolerance);
39          Assert.assertEquals(expectedValue, option.getEps(), tolerance);
40          Assert.assertEquals(expectedValue, option.getMu(), tolerance);
41          Assert.assertEquals(expectedValue, option.getRhoCons(), tolerance);
42          Assert.assertEquals(expectedValue, option.getSigmaMax(), tolerance);
43      }
44  
45      @Test
46      public void testSettersBoolean() {
47          // GIVEN
48          final SQPOption option = new SQPOption();
49          // WHEN
50          final boolean expectedValue = true;
51          option.setUseFunHessian(expectedValue);
52          // THEN
53          Assert.assertEquals(expectedValue, option.useFunHessian());
54      }
55  
56      @Test
57      public void testSettersIntegers() {
58          // GIVEN
59          final SQPOption option = new SQPOption();
60          // WHEN
61          final int expectedValue = 10;
62          option.setConvCriteria(expectedValue);
63          option.setMaxLineSearchIteration(expectedValue);
64          option.setQpMaxLoop(expectedValue);
65          // THEN
66          Assert.assertEquals(expectedValue, option.getConvCriteria());
67          Assert.assertEquals(expectedValue, option.getMaxLineSearchIteration());
68          Assert.assertEquals(expectedValue, option.getQpMaxLoop());
69      }
70  
71  }