001/*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements.  See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License.  You may obtain a copy of the License at
008 *
009 *      http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017
018package org.apache.commons.math3.analysis.solvers;
019
020
021/** The kinds of solutions that a {@link BracketedUnivariateSolver
022 * (bracketed univariate real) root-finding algorithm} may accept as solutions.
023 * This basically controls whether or not under-approximations and
024 * over-approximations are allowed.
025 *
026 * <p>If all solutions are accepted ({@link #ANY_SIDE}), then the solution
027 * that the root-finding algorithm returns for a given root may be equal to the
028 * actual root, but it may also be an approximation that is slightly smaller
029 * or slightly larger than the actual root. Root-finding algorithms generally
030 * only guarantee that the returned solution is within the requested
031 * tolerances. In certain cases however, in particular for
032 * {@link org.apache.commons.math3.ode.events.EventHandler state events} of
033 * {@link org.apache.commons.math3.ode.ODEIntegrator ODE solvers}, it
034 * may be necessary to guarantee that a solution is returned that lies on a
035 * specific side the solution.</p>
036 *
037 * @see BracketedUnivariateSolver
038 * @since 3.0
039 */
040public enum AllowedSolution {
041    /** There are no additional side restriction on the solutions for
042     * root-finding. That is, both under-approximations and over-approximations
043     * are allowed. So, if a function f(x) has a root at x = x0, then the
044     * root-finding result s may be smaller than x0, equal to x0, or greater
045     * than x0.
046     */
047    ANY_SIDE,
048
049    /** Only solutions that are less than or equal to the actual root are
050     * acceptable as solutions for root-finding. In other words,
051     * over-approximations are not allowed. So, if a function f(x) has a root
052     * at x = x0, then the root-finding result s must satisfy s &lt;= x0.
053     */
054    LEFT_SIDE,
055
056    /** Only solutions that are greater than or equal to the actual root are
057     * acceptable as solutions for root-finding. In other words,
058     * under-approximations are not allowed. So, if a function f(x) has a root
059     * at x = x0, then the root-finding result s must satisfy s &gt;= x0.
060     */
061    RIGHT_SIDE,
062
063    /** Only solutions for which values are less than or equal to zero are
064     * acceptable as solutions for root-finding. So, if a function f(x) has
065     * a root at x = x0, then the root-finding result s must satisfy f(s) &lt;= 0.
066     */
067    BELOW_SIDE,
068
069    /** Only solutions for which values are greater than or equal to zero are
070     * acceptable as solutions for root-finding. So, if a function f(x) has
071     * a root at x = x0, then the root-finding result s must satisfy f(s) &gt;= 0.
072     */
073    ABOVE_SIDE;
074
075}