org.apache.commons.math3.optimization.linear

## Interface LinearOptimizer

- All Known Implementing Classes:
    AbstractLinearOptimizer, SimplexSolver

      public interface LinearOptimizer

  This interface represents an optimization algorithm for linear problems.

  Optimization algorithms find the input point set that either `maximize or minimize` an objective function. In the linear case the form of the function is restricted to

       c1x1 + ... cnxn = v

  and there may be linear constraints too, of one of the forms:
  - c1x1 + ... cnxn = v
  - c1x1 + ... cnxn <= v
  - c1x1 + ... cnxn >= v
  - l1x1 + ... lnxn + lcst = r1x1 + ... rnxn + rcst
  - l1x1 + ... lnxn + lcst <= r1x1 + ... rnxn + rcst
  - l1x1 + ... lnxn + lcst >= r1x1 + ... rnxn + rcst
  where the ci, li or ri are the coefficients of the constraints, the xi are the coordinates of the current point and v is the value of the constraint.
  Since:
    2.0
  Version:
    $Id: LinearOptimizer.java 1244107 2012-02-14 16:17:55Z erans $

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `getIterations()` Get the number of iterations realized by the algorithm.
    `int` | `getMaxIterations()` Get the maximal number of iterations of the algorithm.
    `PointValuePair` | `optimize(LinearObjectiveFunction f, Collection<LinearConstraint> constraints, GoalType goalType, boolean restrictToNonNegative)` Optimizes an objective function.
    `void` | `setMaxIterations(int maxIterations)` Set the maximal number of iterations of the algorithm.

- - ### Method Detail

    - #### setMaxIterations

          void setMaxIterations(int maxIterations)

      Set the maximal number of iterations of the algorithm.
      Parameters:
        `maxIterations` - maximal number of function calls

    - #### getMaxIterations

          int getMaxIterations()

      Get the maximal number of iterations of the algorithm.
      Returns:
        maximal number of iterations

    - #### getIterations

          int getIterations()

      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.

      Returns:
        number of iterations

    - #### optimize

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

      Optimizes an objective function.
      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

Copyright © 2003-2012 The Apache Software Foundation. All Rights Reserved.