AbstractLinearOptimizer (Apache Commons Math 3.3 API)

org.apache.commons.math3.optimization.linear

## Class AbstractLinearOptimizer

- java.lang.Object
- - org.apache.commons.math3.optimization.linear.AbstractLinearOptimizer

- All Implemented Interfaces:
    LinearOptimizer
  Direct Known Subclasses:
    SimplexSolver

  Deprecated.
  As of 3.1 (to be removed in 4.0).

      @Deprecated
      public abstract class AbstractLinearOptimizer
      extends Object
      implements LinearOptimizer

  Base class for implementing linear optimizers.

  This base class handles the boilerplate methods associated to thresholds settings and iterations counters.

  Since:
    2.0
  Version:
    $Id: AbstractLinearOptimizer.java 1422230 2012-12-15 12:11:13Z erans $

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `DEFAULT_MAX_ITERATIONS` Deprecated. Default maximal number of iterations allowed.

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `AbstractLinearOptimizer()` Deprecated. Simple constructor with default settings.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected abstract PointValuePair` | `doOptimize()` Deprecated. Perform the bulk of optimization algorithm.
    `protected Collection<LinearConstraint>` | `getConstraints()` Deprecated.
    `protected LinearObjectiveFunction` | `getFunction()` Deprecated.
    `protected GoalType` | `getGoalType()` Deprecated.
    `int` | `getIterations()` Deprecated. Get the number of iterations realized by the algorithm.
    `int` | `getMaxIterations()` Deprecated. Get the maximal number of iterations of the algorithm.
    `protected void` | `incrementIterationsCounter()` Deprecated. Increment the iterations counter by 1.
    `PointValuePair` | `optimize(LinearObjectiveFunction f, Collection<LinearConstraint> constraints, GoalType goalType, boolean restrictToNonNegative)` Deprecated. Optimizes an objective function.
    `protected boolean` | `restrictToNonNegative()` Deprecated.
    `void` | `setMaxIterations(int maxIterations)` Deprecated. Set the maximal number of iterations of the algorithm.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### DEFAULT_MAX_ITERATIONS

          public static final int DEFAULT_MAX_ITERATIONS

      Deprecated.
      Default maximal number of iterations allowed.
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### AbstractLinearOptimizer

          protected AbstractLinearOptimizer()

      Deprecated.
      Simple constructor with default settings.

      The maximal number of evaluation is set to its default value.

  - ### Method Detail

    - #### restrictToNonNegative

          protected boolean restrictToNonNegative()

      Deprecated.
      Returns:
        `true` if the variables are restricted to non-negative values.

    - #### getGoalType

          protected GoalType getGoalType()

      Deprecated.
      Returns:
        the optimization type.

    - #### getFunction

          protected LinearObjectiveFunction getFunction()

      Deprecated.
      Returns:
        the optimization type.

    - #### getConstraints

          protected Collection<LinearConstraint> getConstraints()

      Deprecated.
      Returns:
        the optimization type.

    - #### setMaxIterations

          public void setMaxIterations(int maxIterations)

      Deprecated.
      Set the maximal number of iterations of the algorithm.
      Specified by:
        `setMaxIterations` in interface `LinearOptimizer`
      Parameters:
        `maxIterations` - maximal number of function calls

    - #### getMaxIterations

          public int getMaxIterations()

      Deprecated.
      Get the maximal number of iterations of the algorithm.
      Specified by:
        `getMaxIterations` in interface `LinearOptimizer`
      Returns:
        maximal number of iterations

    - #### getIterations

          public int getIterations()

      Deprecated.
      Get the number of iterations realized by the algorithm.

      The number of evaluations corresponds to the last call to the `optimize` method. It is 0 if the method has not been called yet.

      Specified by:
        `getIterations` in interface `LinearOptimizer`
      Returns:
        number of iterations

    - #### incrementIterationsCounter

          protected void incrementIterationsCounter()
                                             throws MaxCountExceededException

      Deprecated.
      Increment the iterations counter by 1.
      Throws:
        `MaxCountExceededException` - if the maximal number of iterations is exceeded

    - #### optimize

          public PointValuePair optimize(LinearObjectiveFunction f,
                                Collection<LinearConstraint> constraints,
                                GoalType goalType,
                                boolean restrictToNonNegative)
                                  throws MathIllegalStateException

      Deprecated.
      Optimizes an objective function.
      Specified by:
        `optimize` in interface `LinearOptimizer`
      Parameters:
        `f` - linear objective function
        `constraints` - linear constraints
        `goalType` - type of optimization goal: either `GoalType.MAXIMIZE` or `GoalType.MINIMIZE`
        `restrictToNonNegative` - whether to restrict the variables to non-negative values
      Returns:
        point/value pair giving the optimal value for objective function
      Throws:
        `MathIllegalStateException` - if no solution fulfilling the constraints can be found in the allowed number of iterations

    - #### doOptimize

          protected abstract PointValuePair doOptimize()
                                                throws MathIllegalStateException

      Deprecated.
      Perform the bulk of optimization algorithm.
      Returns:
        the point/value pair giving the optimal value for objective function
      Throws:
        `MathIllegalStateException` - if no solution fulfilling the constraints can be found in the allowed number of iterations

Copyright © 2003–2014 The Apache Software Foundation. All rights reserved.