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  import org.hipparchus.optim.OptimizationData;
20  import org.hipparchus.util.Precision;
21  
22  /** Options for dual active-set method.
23   */
24  public class QPDualActiveSolverOption implements OptimizationData  {
25  
26      /** Default tolerance for constraint satisfaction */
27      public static final double DEFAULT_EPSILON = Precision.EPSILON;//>0
28  
29       /** Default Matrix Mode */
30      public static final QPMatrixMode DEFAULT_MATRIX_MODE = QPMatrixMode.FULL;
31  
32      /**
33      *  Default Relaxed feasibility tolerance used only when both the primal and dual
34       * step are not available. In that numerically stalled case, a target
35       * constraint whose violation does not exceed this value is accepted as
36       * numerically feasible.
37       */
38      public static final double DEFAULT_EPSILON_RELAXATION = 1.0e-12;//>0
39  
40  
41      /** Tolerance for constraint satisfaction */
42      private double eps;
43  
44      /**
45       * Relaxed feasibility tolerance used only when both the primal and dual
46       * step are not available for ill conditioning problems. In that numerically stalled case, a target
47       * constraint whose violation does not exceed this value is accepted as
48       * numerically feasible. For the major part of the problems choosing 10.0*eps is enough
49       */
50      private double epsRelaxation;
51  
52      /** Matrix Mode */
53      private QPMatrixMode matrixMode;
54  
55  
56      public QPDualActiveSolverOption()
57      {
58          this.eps=DEFAULT_EPSILON;
59          this.epsRelaxation=DEFAULT_EPSILON_RELAXATION;
60          this.matrixMode=DEFAULT_MATRIX_MODE;
61      }
62  
63      /** Set tolerance for convergence
64       *  typical 1.0e-16 to 1.0e-9
65       * @param eps tolerance for convergence
66       */
67      public void setEps(final double eps) {
68          this.eps = eps;
69      }
70  
71      /** get tolerance for convergence and active constraint evaluation.
72       * @return tolerance for convergence and active constraint evaluation
73       */
74      public double getEps() {
75          return eps;
76      }
77  
78       /** Set tolerance convergence for constraint in case of degeneracy
79       *  typical 10.0*eps
80       * @param epsRelaxation  tolerance for convergence
81       */
82      public void setEpsRelaxation(final double epsRelaxation) {
83          this.epsRelaxation = epsRelaxation;
84      }
85  
86      /** get tolerance for convergence for constraint in case of degeneracy.
87       * @return tolerance for convergence for constraint in case of degeneracy
88       */
89      public double getEpsRelaxation() {
90          return epsRelaxation;
91      }
92  
93       /** Set MatrixMode.
94        *
95        * @param matrixMode  matrix mode
96        */
97      public void setMatrixMode(final QPMatrixMode matrixMode)
98      {
99          this.matrixMode=matrixMode;
100     }
101 
102     /** Get MatrixMode
103      * @return matric mode
104      */
105      public QPMatrixMode getMatrixMode()
106     {
107       return  this.matrixMode;
108     }
109 }