Top Description Methods
org.apache.commons.math3.optimization.linear

public Interface LinearOptimizer

Known Direct Implementers
org.apache.commons.math3.optimization.linear.AbstractLinearOptimizer
Annotations
@Deprecated
Imports
java.util.Collection, org.apache.commons.math3.exception.MathIllegalStateException, org.apache.commons.math3.optimization.GoalType, .PointValuePair

Deprecated

As of 3.1 (to be removed in 4.0).

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: 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

Method Summary

Modifier and TypeMethod and Description
public int

Returns:

number of iterations
getIterations
()

Get the number of iterations realized by the algorithm.

public int

Returns:

maximal number of iterations
getMaxIterations
()

Get the maximal number of iterations of the algorithm.

public PointValuePair

Returns:

point/value pair giving the optimal value for objective function
optimize
(LinearObjectiveFunction
linear objective function
f
,
Collection<LinearConstraint>
linear constraints
constraints
,
GoalType
type of optimization goal: either GoalType#MAXIMIZE or GoalType#MINIMIZE
goalType
,
boolean
whether to restrict the variables to non-negative values
restrictToNonNegative
)
Deprecated as a consequence of LinearObjectiveFunction, GoalType and PointValuePair being deprecated.

Optimizes an objective function.

public void
setMaxIterations(int
maximal number of function calls
maxIterations
)

Set the maximal number of iterations of the algorithm.

Method Detail

getIterationsback to summary
public 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:int

number of iterations

getMaxIterationsback to summary
public int getMaxIterations()

Get the maximal number of iterations of the algorithm.

Returns:int

maximal number of iterations

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

Deprecated

as a consequence of LinearObjectiveFunction, GoalType and PointValuePair being deprecated. See corresponding docs for further information.

Optimizes an objective function.

Parameters
f:LinearObjectiveFunction

linear objective function

constraints:Collection<LinearConstraint>

linear constraints

goalType:GoalType

type of optimization goal: either GoalType#MAXIMIZE or GoalType#MINIMIZE

restrictToNonNegative:boolean

whether to restrict the variables to non-negative values

Returns:PointValuePair

point/value pair giving the optimal value for objective function

Exceptions
MathIllegalStateException:
if no solution fulfilling the constraints can be found in the allowed number of iterations
setMaxIterationsback to summary
public void setMaxIterations(int maxIterations)

Set the maximal number of iterations of the algorithm.

Parameters
maxIterations:int

maximal number of function calls