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.jupiter.api.Test;
21  
22  import static org.junit.jupiter.api.Assertions.assertEquals;
23  
24  class SQPOptionTest {
25  
26      @Test
27      void testSettersDouble() {
28          // GIVEN
29          final SQPOption option = new SQPOption();
30          // WHEN
31          final double expectedValue = 1.;
32          option.setB(expectedValue);
33          option.setEps(expectedValue);
34          option.setMu(expectedValue);
35          option.setRhoCons(expectedValue);
36          option.setSigmaMax(expectedValue);
37          // THEN
38          final double tolerance = 0.;
39          assertEquals(expectedValue, option.getB(), tolerance);
40          assertEquals(expectedValue, option.getEps(), tolerance);
41          assertEquals(expectedValue, option.getMu(), tolerance);
42          assertEquals(expectedValue, option.getRhoCons(), tolerance);
43          assertEquals(expectedValue, option.getSigmaMax(), tolerance);
44      }
45  
46      @Test
47      void testSettersBoolean() {
48          // GIVEN
49          final SQPOption option = new SQPOption();
50          // WHEN
51          final boolean expectedValue = true;
52          option.setUseFunHessian(expectedValue);
53          // THEN
54          assertEquals(expectedValue, option.useFunHessian());
55      }
56  
57      @Test
58      void testSettersIntegers() {
59          // GIVEN
60          final SQPOption option = new SQPOption();
61          // WHEN
62          final int expectedValue = 10;
63          option.setConvCriteria(expectedValue);
64          option.setMaxLineSearchIteration(expectedValue);
65          option.setQpMaxLoop(expectedValue);
66          // THEN
67          assertEquals(expectedValue, option.getConvCriteria());
68          assertEquals(expectedValue, option.getMaxLineSearchIteration());
69          assertEquals(expectedValue, option.getQpMaxLoop());
70      }
71  
72  }