public class SQPActiveSetMinimizer extends Object implements ConstrainedMinimizer<ConstrainedOptimProblem,IterativeSolution<Vector>>
Represent equality residuals as functions equal to zero and supply
less-than constraints as residuals less than or equal to zero in
ConstrainedOptimProblem. The solver converts the latter internally
to greater-than constraints; if supplying explicit initial inequality
multipliers, use nonnegative multipliers in that internal convention.
solve(problem) prepares a solution object; search(x0) runs
iterations. Supply a feasible starting point of the objective's domain dimension.
The three-vector overload takes x0, equality multipliers, and inequality
multipliers in that order, with one multiplier per constraint.
This solver builds numerical derivatives when only function values are supplied. Smoothness, scaling and tolerances matter. An iteration limit can return the current iterate without certifying convergence: independently check the objective and every constraint residual. Infeasible QP subproblems can raise an exception; do not replace such a failure with zero weights or a zero-valued objective. Keep separate solution objects for separate searches.
The helper problem encodes nonnegativity. Start inside its feasible region, explicitly initialize the inequality multipliers to zero for this interior optimum, and verify the known minimizer as well as feasibility.
import dev.nm.analysis.function.rn2r1.AbstractBivariateRealFunction;
import dev.nm.algebra.linear.vector.doubles.Vector;
import dev.nm.algebra.linear.vector.doubles.dense.DenseVector;
import dev.nm.solver.IterativeSolution;
import dev.nm.solver.multivariate.constrained.problem.NonNegativityConstraintOptimProblem;
import dev.nm.solver.multivariate.constrained.general.sqp.activeset.SQPActiveSetMinimizer;
AbstractBivariateRealFunction objective = new AbstractBivariateRealFunction() {
public double evaluate(double x, double y) {
return (x - 5) * (x - 5) + (y - 3) * (y - 3);
}
};
SQPActiveSetMinimizer optimizer = new SQPActiveSetMinimizer(1e-10, 100);
IterativeSolution<Vector> solution = optimizer.solve(new NonNegativityConstraintOptimProblem(objective));
Vector x = solution.search(new DenseVector(2.0, 2.0), new DenseVector(0), new DenseVector(2, 0.0));
assert x.get(1) >= -1e-8 && x.get(2) >= -1e-8;
assert Math.abs(x.get(1) - 5) < 1e-5 : x;
assert Math.abs(x.get(2) - 3) < 1e-5 : x;
assert objective.evaluate(x) < 1e-10 : objective.evaluate(x);
| Modifier and Type | Class and Description |
|---|---|
class |
SQPActiveSetMinimizer.Solution
This is the solution to a general minimization with only inequality
constraints using the SQP Active Set algorithm.
|
static interface |
SQPActiveSetMinimizer.VariationFactory
This factory constructs a new instance of
SQPASVariation for each
SQP problem. |
| Modifier and Type | Field and Description |
|---|---|
protected double |
epsilon1 |
protected double |
epsilon2 |
protected int |
maxIterations |
| Constructor and Description |
|---|
SQPActiveSetMinimizer(double epsilon1,
double epsilon2,
int maxIterations)
Construct an SQP Active Set minimizer to solve general minimization
problems with inequality constraints.
|
SQPActiveSetMinimizer(double epsilon1,
int maxIterations)
Construct an SQP Active Set minimizer to solve general minimization
problems with inequality constraints.
|
SQPActiveSetMinimizer(SQPActiveSetMinimizer.VariationFactory variant,
double epsilon1,
double epsilon2,
int maxIterations)
Construct an SQP Active Set minimizer to solve general minimization
problems with inequality constraints.
|
| Modifier and Type | Method and Description |
|---|---|
SQPActiveSetMinimizer.Solution |
solve(ConstrainedOptimProblem problem)
Solve an optimization problem, e.g.,
OptimProblem. |
protected final double epsilon1
protected final double epsilon2
protected final int maxIterations
public SQPActiveSetMinimizer(SQPActiveSetMinimizer.VariationFactory variant, double epsilon1, double epsilon2, int maxIterations)
variant - a factory that constructs a new instance of
SQPASVariation for each problemepsilon1 - a precision parameter: when a number |x| ≤ ε,
it is considered 0; for the SQP solverepsilon2 - a precision parameter: when a number |x| ≤ ε,
it is considered 0; for the embedded QP solver; suggested value = 0.maxIterations - the maximum number of iterationspublic SQPActiveSetMinimizer(double epsilon1,
double epsilon2,
int maxIterations)
epsilon1 - a precision parameter: when a number |x| ≤ ε,
it is considered 0; for the SQP solverepsilon2 - a precision parameter: when a number |x| ≤ ε,
it is considered 0; for the embedded QP solver; suggested value = 0.maxIterations - the maximum number of iterationspublic SQPActiveSetMinimizer(double epsilon1,
int maxIterations)
epsilon1 - a precision parameter: when a number |x| ≤ ε,
it is considered 0; for the SQP solvermaxIterations - the maximum number of iterationspublic SQPActiveSetMinimizer.Solution solve(ConstrainedOptimProblem problem) throws Exception
OptimizerOptimProblem.solve in interface Optimizer<ConstrainedOptimProblem,IterativeSolution<Vector>>problem - an optimization problemException - when there is an error solving the problemCopyright © 2010-2026 NM Group. All Rights Reserved.