User Manual 4.6 Optimization : Différence entre versions
(→Package Overview) |
|||
(9 révisions intermédiaires par le même utilisateur non affichées) | |||
Ligne 26 : | Ligne 26 : | ||
=== Package Overview === | === Package Overview === | ||
The optimization functionalities for joptimizer are organized in the following packages: | The optimization functionalities for joptimizer are organized in the following packages: | ||
− | *<code>fr.cnes.sirius.patrius.math.optim.joptimizer.algebra</code> | + | *<code>fr.cnes.sirius.patrius.math.optim.joptimizer.algebra</code> compounds the classes with the algebra functionalities. |
− | *<code>fr.cnes.sirius.patrius.math.optim.joptimizer.functions</code> | + | *<code>fr.cnes.sirius.patrius.math.optim.joptimizer.functions</code> compounds the classes with the optimization functions. |
− | *<code>fr.cnes.sirius.patrius.math.optim.joptimizer.optimizers</code> | + | *<code>fr.cnes.sirius.patrius.math.optim.joptimizer.optimizers</code> compounds the classes with the optimizers. |
− | *<code>fr.cnes.sirius.patrius.math.optim.joptimizer.solvers</code> | + | *<code>fr.cnes.sirius.patrius.math.optim.joptimizer.solvers</code> compounds the classes with the solvers. |
− | *<code>fr.cnes.sirius.patrius.math.optim.joptimizer.util</code> | + | *<code>fr.cnes.sirius.patrius.math.optim.joptimizer.util</code> compounds the utility classes. |
== Features Description == | == Features Description == | ||
+ | Features descritpion for the joptimizer package. | ||
=== Optimizers === | === Optimizers === | ||
The <code>JOptimizer</code> class implements the convex optimizer (see "S.Boyd and L.Vandenberghe, Convex Optimization"). | The <code>JOptimizer</code> class implements the convex optimizer (see "S.Boyd and L.Vandenberghe, Convex Optimization"). | ||
Ligne 285 : | Ligne 286 : | ||
== Contents == | == Contents == | ||
=== Interfaces === | === Interfaces === | ||
− | The | + | The interfaces related to the joptimizer are listed here : |
{| class="wikitable" | {| class="wikitable" | ||
Ligne 295 : | Ligne 296 : | ||
|'''BarrierFunction''' | |'''BarrierFunction''' | ||
|Interface for the barrier function used by a given barrier optimization method. | |Interface for the barrier function used by a given barrier optimization method. | ||
− | |[{{JavaDoc4.6}}/fr/cnes/sirius/patrius/math/optim/joptimizer/BarrierFunction.html ...] | + | |[{{JavaDoc4.6}}/fr/cnes/sirius/patrius/math/optim/joptimizer/functions/BarrierFunction.html ...] |
|- | |- | ||
|'''ConvexMultivariateRealFunction''' | |'''ConvexMultivariateRealFunction''' | ||
|Interface for convex multivariate real functions. | |Interface for convex multivariate real functions. | ||
− | |[{{JavaDoc4.6}}/fr/cnes/sirius/patrius/math/optim/joptimizer/ConvexMultivariateRealFunction.html ...] | + | |[{{JavaDoc4.6}}/fr/cnes/sirius/patrius/math/optim/joptimizer/functions/ConvexMultivariateRealFunction.html ...] |
|- | |- | ||
|'''MatrixRescaler''' | |'''MatrixRescaler''' | ||
|An interface to classes that implement an algorithm to rescale matrices. | |An interface to classes that implement an algorithm to rescale matrices. | ||
− | |[{{JavaDoc4.6}}/fr/cnes/sirius/patrius/math/optim/joptimizer/MatrixRescaler.html ...] | + | |[{{JavaDoc4.6}}/fr/cnes/sirius/patrius/math/optim/joptimizer/algebra/MatrixRescaler.html ...] |
|- | |- | ||
|'''StrictlyConvexMultivariateRealFunction''' | |'''StrictlyConvexMultivariateRealFunction''' | ||
|Interface for striclty convex multivariate real functions. | |Interface for striclty convex multivariate real functions. | ||
− | |[{{JavaDoc4.6}}/fr/cnes/sirius/patrius/math/optim/joptimizer/StrictlyConvexMultivariateRealFunction.html ...] | + | |[{{JavaDoc4.6}}/fr/cnes/sirius/patrius/math/optim/joptimizer/functions/StrictlyConvexMultivariateRealFunction.html ...] |
|- | |- | ||
|'''TwiceDifferentiableMultivariateRealFunction''' | |'''TwiceDifferentiableMultivariateRealFunction''' | ||
|Interface for twice-differentiable multivariate functions. | |Interface for twice-differentiable multivariate functions. | ||
− | |[{{JavaDoc4.6}}/fr/cnes/sirius/patrius/math/optim/joptimizer/TwiceDifferentiableMultivariateRealFunction.html ...] | + | |[{{JavaDoc4.6}}/fr/cnes/sirius/patrius/math/optim/joptimizer/functions/TwiceDifferentiableMultivariateRealFunction.html ...] |
|} | |} | ||
=== Classes === | === Classes === | ||
− | The | + | The classes related to the joptimizer are listed here : |
{| class="wikitable" | {| class="wikitable" | ||
Ligne 323 : | Ligne 324 : | ||
! scope="col"| Javadoc | ! scope="col"| Javadoc | ||
|- | |- | ||
− | |''' | + | |'''AlgebraUtils''' |
− | | | + | |Algebraic utility operations |
− | |[{{JavaDoc4.6}}/fr/cnes/sirius/patrius/math/optim/joptimizer/ | + | |[{{JavaDoc4.6}}/fr/cnes/sirius/patrius/math/optim/joptimizer/algebra/AlgebraUtils.html ...] |
+ | |- | ||
+ | |'''CholeskyFactorization''' | ||
+ | |Implements the Cholesky L.L[T] factorization and inverse for symmetric and positive matrix. | ||
+ | |[{{JavaDoc4.6}}/fr/cnes/sirius/patrius/math/optim/joptimizer/algebra/CholeskyFactorization.html ...] | ||
+ | |- | ||
+ | |'''Matrix1NornRescaler''' | ||
+ | |Calculates the matrix rescaling factors so that the 1-norm of each row and each column of the scaled matrix asymptotically converges to one. | ||
+ | |[{{JavaDoc4.6}}/fr/cnes/sirius/patrius/math/optim/joptimizer/algebra/Matrix1NornRescaler.html ...] | ||
+ | |- | ||
+ | |'''FunctionsUtils''' | ||
+ | |Utility class for optimization function building. | ||
+ | |[{{JavaDoc4.6}}/fr/cnes/sirius/patrius/math/optim/joptimizer/functions/FunctionsUtils.html ...] | ||
+ | |- | ||
+ | |'''LinearMultivariateRealFunction''' | ||
+ | |Represents a function f(x) = q.x + r. | ||
+ | |[{{JavaDoc4.6}}/fr/cnes/sirius/patrius/math/optim/joptimizer/functions/LinearMultivariateRealFunction.html ...] | ||
+ | |- | ||
+ | |'''LogarithmicBarrier''' | ||
+ | |Default barrier function for the barrier method algorithm. | ||
+ | |[{{JavaDoc4.6}}/fr/cnes/sirius/patrius/math/optim/joptimizer/functions/LogarithmicBarrier.html ...] | ||
+ | |- | ||
+ | |'''PDQuadraticMultivariateRealFunction''' | ||
+ | |Extends the class QuadraticMultivariateRealFunction with P symmetric and positive definite. | ||
+ | |[{{JavaDoc4.6}}/fr/cnes/sirius/patrius/math/optim/joptimizer/functions/PDQuadraticMultivariateRealFunction.html ...] | ||
+ | |- | ||
+ | |'''PSDQuadraticMultivariateRealFunction''' | ||
+ | |Extends the class QuadraticMultivariateRealFunction with P symmetric and positive semi-definite. | ||
+ | |[{{JavaDoc4.6}}/fr/cnes/sirius/patrius/math/optim/joptimizer/functions/PSDQuadraticMultivariateRealFunction.html ...] | ||
+ | |- | ||
+ | |'''QuadraticMultivariateRealFunction''' | ||
+ | |Represents a quadratic multivariate function in the form of f(x):= 1/2 x.P.x + q.x + r. | ||
+ | |[{{JavaDoc4.6}}/fr/cnes/sirius/patrius/math/optim/joptimizer/functions/QuadraticMultivariateRealFunction.html ...] | ||
|- | |- | ||
|'''AbstractLPOptimizationRequestHandler''' | |'''AbstractLPOptimizationRequestHandler''' | ||
|Abstract class for Linear Problem Optimization Request Handler. | |Abstract class for Linear Problem Optimization Request Handler. | ||
− | |[{{JavaDoc4.6}}/fr/cnes/sirius/patrius/math/optim/joptimizer/AbstractLPOptimizationRequestHandler.html ...] | + | |[{{JavaDoc4.6}}/fr/cnes/sirius/patrius/math/optim/joptimizer/optimizers/AbstractLPOptimizationRequestHandler.html ...] |
|- | |- | ||
|'''BarrierMethod''' | |'''BarrierMethod''' | ||
|Implements the Barrier Method. | |Implements the Barrier Method. | ||
− | |[{{JavaDoc4.6}}/fr/cnes/sirius/patrius/math/optim/joptimizer/BarrierMethod.html ...] | + | |[{{JavaDoc4.6}}/fr/cnes/sirius/patrius/math/optim/joptimizer/optimizers/BarrierMethod.html ...] |
|- | |- | ||
|'''BasicPhaseIBM''' | |'''BasicPhaseIBM''' | ||
|Implements the Basic Phase I Method as a Barried Method. | |Implements the Basic Phase I Method as a Barried Method. | ||
− | |[{{JavaDoc4.6}}/fr/cnes/sirius/patrius/math/optim/joptimizer/BasicPhaseIBM.html ...] | + | |[{{JavaDoc4.6}}/fr/cnes/sirius/patrius/math/optim/joptimizer/optimizers/BasicPhaseIBM.html ...] |
|- | |- | ||
|'''BasicPhaseILPPDM''' | |'''BasicPhaseILPPDM''' | ||
|Implements the Basic Phase I Method form LP problems as a Primal-Dual Method. | |Implements the Basic Phase I Method form LP problems as a Primal-Dual Method. | ||
− | |[{{JavaDoc4.6}}/fr/cnes/sirius/patrius/math/optim/joptimizer/BasicPhaseILPPDM.html ...] | + | |[{{JavaDoc4.6}}/fr/cnes/sirius/patrius/math/optim/joptimizer/optimizers/BasicPhaseILPPDM.html ...] |
|- | |- | ||
|'''BasicPhaseIPDM''' | |'''BasicPhaseIPDM''' | ||
|Implements the Basic Phase I Method as a Primal-Dual Method. | |Implements the Basic Phase I Method as a Primal-Dual Method. | ||
− | |[{{JavaDoc4.6}}/fr/cnes/sirius/patrius/math/optim/joptimizer/BasicPhaseIPDM | + | |[{{JavaDoc4.6}}/fr/cnes/sirius/patrius/math/optim/joptimizer/optimizers/BasicPhaseIPDM.html ...] |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
|- | |- | ||
|'''JOptimizer''' | |'''JOptimizer''' | ||
|Implements the convex optimizer. | |Implements the convex optimizer. | ||
− | |[{{JavaDoc4.6}}/fr/cnes/sirius/patrius/math/optim/joptimizer/JOptimizer | + | |[{{JavaDoc4.6}}/fr/cnes/sirius/patrius/math/optim/joptimizer/optimizers/JOptimizer.html ...] |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
|- | |- | ||
|'''LPPresolver''' | |'''LPPresolver''' | ||
|Presolver for a linear problem. | |Presolver for a linear problem. | ||
− | |[{{JavaDoc4.6}}/fr/cnes/sirius/patrius/math/optim/joptimizer/LPPresolver.html ...] | + | |[{{JavaDoc4.6}}/fr/cnes/sirius/patrius/math/optim/joptimizer/optimizers/LPPresolver.html ...] |
|- | |- | ||
|'''LPPrimalDualMethod''' | |'''LPPrimalDualMethod''' | ||
|Implements the Primal-dual interior-point method for linear problems. | |Implements the Primal-dual interior-point method for linear problems. | ||
− | |[{{JavaDoc4.6}}/fr/cnes/sirius/patrius/math/optim/joptimizer/LPPrimalDualMethod.html ...] | + | |[{{JavaDoc4.6}}/fr/cnes/sirius/patrius/math/optim/joptimizer/optimizers/LPPrimalDualMethod.html ...] |
|- | |- | ||
|'''LPStandardConverter''' | |'''LPStandardConverter''' | ||
|Converts a general LP problem into a strictly standard or quasi standard form. | |Converts a general LP problem into a strictly standard or quasi standard form. | ||
− | |[{{JavaDoc4.6}}/fr/cnes/sirius/patrius/math/optim/joptimizer/LPStandardConverter | + | |[{{JavaDoc4.6}}/fr/cnes/sirius/patrius/math/optim/joptimizer/optimizers/LPStandardConverter.html ...] |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
|- | |- | ||
|'''NewtonLEConstrainedFSP''' | |'''NewtonLEConstrainedFSP''' | ||
|Linear equality constrained newton optimizer, with feasible starting point. | |Linear equality constrained newton optimizer, with feasible starting point. | ||
− | |[{{JavaDoc4.6}}/fr/cnes/sirius/patrius/math/optim/joptimizer/NewtonLEConstrainedFSP.html ...] | + | |[{{JavaDoc4.6}}/fr/cnes/sirius/patrius/math/optim/joptimizer/optimizers/NewtonLEConstrainedFSP.html ...] |
|- | |- | ||
|'''NewtonLEConstrainedISP''' | |'''NewtonLEConstrainedISP''' | ||
|Linear equality constrained newton optimizer, with infeasible starting point. | |Linear equality constrained newton optimizer, with infeasible starting point. | ||
− | |[{{JavaDoc4.6}}/fr/cnes/sirius/patrius/math/optim/joptimizer/NewtonLEConstrainedISP.html ...] | + | |[{{JavaDoc4.6}}/fr/cnes/sirius/patrius/math/optim/joptimizer/optimizers/NewtonLEConstrainedISP.html ...] |
|- | |- | ||
|'''NewtonUnconstrained''' | |'''NewtonUnconstrained''' | ||
|Unconstrained newton optimizer. | |Unconstrained newton optimizer. | ||
− | |[{{JavaDoc4.6}}/fr/cnes/sirius/patrius/math/optim/joptimizer/NewtonUnconstrained.html ...] | + | |[{{JavaDoc4.6}}/fr/cnes/sirius/patrius/math/optim/joptimizer/optimizers/NewtonUnconstrained.html ...] |
|- | |- | ||
|'''OptimizationRequest''' | |'''OptimizationRequest''' | ||
|Implements an optimization problem. | |Implements an optimization problem. | ||
− | |[{{JavaDoc4.6}}/fr/cnes/sirius/patrius/math/optim/joptimizer/OptimizationRequest.html ...] | + | |[{{JavaDoc4.6}}/fr/cnes/sirius/patrius/math/optim/joptimizer/optimizers/OptimizationRequest.html ...] |
|- | |- | ||
|'''OptimizationRequestHandler''' | |'''OptimizationRequestHandler''' | ||
|Generic class for optimization process. | |Generic class for optimization process. | ||
− | |[{{JavaDoc4.6}}/fr/cnes/sirius/patrius/math/optim/joptimizer/OptimizationRequestHandler.html ...] | + | |[{{JavaDoc4.6}}/fr/cnes/sirius/patrius/math/optim/joptimizer/optimizers/OptimizationRequestHandler.html ...] |
|- | |- | ||
|'''OptimizationResponse''' | |'''OptimizationResponse''' | ||
|Optimization process output: stores the solution as well as an exit code. | |Optimization process output: stores the solution as well as an exit code. | ||
− | |[{{JavaDoc4.6}}/fr/cnes/sirius/patrius/math/optim/joptimizer/OptimizationResponse.html ...] | + | |[{{JavaDoc4.6}}/fr/cnes/sirius/patrius/math/optim/joptimizer/optimizers/OptimizationResponse.html ...] |
|- | |- | ||
|'''PrimalDualMethod''' | |'''PrimalDualMethod''' | ||
|Implements a primal-dual interior-point method. | |Implements a primal-dual interior-point method. | ||
− | |[{{JavaDoc4.6}}/fr/cnes/sirius/patrius/math/optim/joptimizer/PrimalDualMethod.html ...] | + | |[{{JavaDoc4.6}}/fr/cnes/sirius/patrius/math/optim/joptimizer/optimizers/PrimalDualMethod.html ...] |
|- | |- | ||
− | |''' | + | |'''AbstractKKTSolver''' |
− | | | + | |Abstract class for solving KKT systems. |
− | |[{{JavaDoc4.6}}/fr/cnes/sirius/patrius/math/optim/joptimizer/ | + | |[{{JavaDoc4.6}}/fr/cnes/sirius/patrius/math/optim/joptimizer/solvers/AbstractKKTSolver.html ...] |
+ | |- | ||
+ | |'''AugmentedKKTSolver''' | ||
+ | |Extension of AbstractKKTSolver for singular matrix. | ||
+ | |[{{JavaDoc4.6}}/fr/cnes/sirius/patrius/math/optim/joptimizer/solvers/AugmentedKKTSolver.html ...] | ||
+ | |- | ||
+ | |'''BasicKKTSolver''' | ||
+ | |Extension of AbstractKKTSolver for the basic solver. | ||
+ | |[{{JavaDoc4.6}}/fr/cnes/sirius/patrius/math/optim/joptimizer/solvers/BasicKKTSolver.html ...] | ||
+ | |- | ||
+ | |'''UpperDiagonalHKKTSolver''' | ||
+ | |Extends the class AbstractKKTSolver for upper diagonal matrix. | ||
+ | |[{{JavaDoc4.6}}/fr/cnes/sirius/patrius/math/optim/joptimizer/solvers/UpperDiagonalHKKTSolver.html ...] | ||
+ | |- | ||
+ | |'''ArrayUtils''' | ||
+ | |Class offering operations on arrays, primitive arrays (like int[]) and primitive wrapper arrays (like Integer[]). | ||
+ | |[{{JavaDoc4.6}}/fr/cnes/sirius/patrius/math/optim/joptimizer/util/ArrayUtils.html ...] | ||
+ | |- | ||
+ | |'''MutableInt''' | ||
+ | |A mutable (int) wrapper. | ||
+ | |[{{JavaDoc4.6}}/fr/cnes/sirius/patrius/math/optim/joptimizer/util/MutableInt.html ...] | ||
+ | |- | ||
+ | |'''Utils''' | ||
+ | |Utility class. | ||
+ | |[{{JavaDoc4.6}}/fr/cnes/sirius/patrius/math/optim/joptimizer/util/Utils.html ...] | ||
|} | |} | ||
[[Category:User_Manual_4.6_Mathematics]] | [[Category:User_Manual_4.6_Mathematics]] |
Version actuelle en date du 7 mai 2021 à 07:37
Introduction
Scope
This section describes PATRIUS optimization features.
It will focus on the JOptimizer functionalities, which provides solvers for general convex optimization problems.
Javadoc
The optimization classes are available in the package fr.cnes.sirius.patrius.math.optim
.
Library | Javadoc |
---|---|
Patrius | Package fr.cnes.sirius.patrius.math.optim |
Links
None as of now.
Useful Documents
None as of now.
Package Overview
The optimization functionalities for joptimizer are organized in the following packages:
fr.cnes.sirius.patrius.math.optim.joptimizer.algebra
compounds the classes with the algebra functionalities.fr.cnes.sirius.patrius.math.optim.joptimizer.functions
compounds the classes with the optimization functions.fr.cnes.sirius.patrius.math.optim.joptimizer.optimizers
compounds the classes with the optimizers.fr.cnes.sirius.patrius.math.optim.joptimizer.solvers
compounds the classes with the solvers.fr.cnes.sirius.patrius.math.optim.joptimizer.util
compounds the utility classes.
Features Description
Features descritpion for the joptimizer package.
Optimizers
The JOptimizer
class implements the convex optimizer (see "S.Boyd and L.Vandenberghe, Convex Optimization").
The algorithm selection is implemented as a Chain of Responsibility pattern, and this class is the client of the chain.
The different methods implemented to solve the convex optimization problem are:
- Interior point methods
PrimalDualMethod
: primal-dual interior-point method.LPPrimalDualMethod
: primal-dual interior-point method for linear problems.BarrierMethod
- Quality constrained minimization
NewtonLEConstrainedFSP
: linear equality constrained newton optimizer, with a feasible starting point.NewtonLEConstrainedISP
: linear equality constrained newton optimizer, with an infeasible starting point.
- Unconstrained minimization
NewtonUnconstrained
: unconstrained newton optimizer.
Optimization problem
The OptimizationRequest
class has all the setting field's necessaires to define an optimization problem.
The LPOptimizationRequest
is an extension of this class for linear optimization problems.
The general form of a linear problem is (1):
min(c) s.t. A.x = b lb <= x <= ub
The OptimizationResponse
is the class with the getters and setters to set and get the response after the optimization.
The LPOptimizationResponse
is the extended class applied to linear problems.
Standard converter
The LPStandardConverter
converts a general linear problem stated in the form (2):
min(c) s.t. G.x < h A.x = b lb <= x <= ub
to the (strictly)standard form:
min(c) s.t. A.x = b x >= 0
or to the (quasi)standard form (1).
Presolver
The LPPresolver
implements a presolver for a linear problem in the form (1).
It applies a set of techniques to the linear programming problem before a linear programming solver solves it. This set of techniques aims at reducing the size of the LP problem by eliminating redundant constraints and variables and identifying possible infeasibility and unboundedness of the problem.
Solvers
The AbstractKKTSolver
implements a solver for the KKT system:
H.v + [A]T.w = -g A.v = -h
where H is a square and symmetric matrix.
The following classes are an extension of AbstractKKTSolver
:
AugmentedKKTSolver
(for singular H)BasicKKTSolver
UpperDiagonalHKKTSolver
(for upper diagonal H)
Functions
Different functions are implemented, all of them twice differentiable.
- Linear functions
The LinearMultivariateRealFunction
represents a function in the form of:
f(x) = q.x + r
- Quadratic functions
The QuadraticMultivariateRealFunction
represents a function in the form of:
f(x) := 1/2 x.P.x + q.x + r
where x, q ∈ R n, P is a symmetric nXn matrix and r ∈ R.
With the extended PSDQuadraticMultivariateRealFunction
and PDQuadraticMultivariateRealFunction
classes for P symmetric and positive semi-definite, and P symmetric and positive definite, respectively.
- Barrier functions
The LogarithmicBarrier
is the default barrier function for the barrier method algorithm.
If fi(x) are the inequalities of the problem, then the function:
Φ(x) = − ∑_i (log(−fi(x)))
Algebra
Factorization
The CholeskyFactorization
implements the Cholesky L . L[T] factorization and inverse for symmetric and positive matrix:
Q = L.L[T]
with L lower-triangular.
Rescaler
The Matrix1NornRescaler
calculates the matrix rescaling factors, so that the 1-norm of each row and each column of the scaled matrix asymptotically converges to one.
Getting Started
Example 1
Example of a linear problem optimized by the primal-dual interior-point method.
The problem is:
min(-100x + y) s.t. x - y = 0 0 <= x <= 1 0 <= y <= 1
First, the definition of the variables:
final double[] c = new double[] { -100, 1 } final double[][] a = new double[][] { { 1, -1 } } final double[] b = new double[] { 0 } final double[] lb = new double[] { 0, 0 } final double[] ub = new double[] { 1, 1 }
Definition of the optimization problem by setting the variables:
final LPOptimizationRequest or = new LPOptimizationRequest() or.setC(c) or.setA(a) or.setB(b) or.setLb(lb) or.setUb(ub)
Additional parameters (tolerance, check the solution accuracy, etc) can also be setted:
or.setCheckKKTSolutionAccuracy(true) or.setToleranceFeas(1.E-7) or.setTolerance(1.E-7) or.setDumpProblem(true) or.setRescalingDisabled(true)
Definition of the optimizer and setting the optimization problem:
LPPrimalDualMethod opt = new LPPrimalDualMethod() opt.setLPOptimizationRequest(or)
Optimization and check that it has not failed:
final int returnCode = opt.optimize() if (returnCode == OptimizationResponse.FAILED) { fail() }
Recuperate the response and the solution:
final LPOptimizationResponse response = opt.getLPOptimizationResponse() final double[] sol = response.getSolution()
Validation:
final RealVector cVector = new ArrayRealVector(c) final RealVector solVector = new ArrayRealVector(sol) final double value = cVector.dotProduct(solVector) assertEquals(2, sol.length) assertEquals(1, sol[0], or.getTolerance()) assertEquals(1, sol[1], or.getTolerance()) assertEquals(-99, value, or.getTolerance())
Example 2
Example of the optimization of a linear objective function with quadratic constraints.
The problem is:
min(-e.x) s.t. 1/2 x.P.x < v x + y + z = 1 x > 0 y > 0 z > 0
Definition of the linear objective function:
final double[] e = { -0.018, -0.025, -0.01 } final LinearMultivariateRealFunction objectiveFunction = new LinearMultivariateRealFunction(e, 0)
Definition of the quadratic and linear constraints:
final double[][] p = { { 1.68, 0.34, 0.38 }, { 0.34, 3.09, -1.59 }, { 0.38, -1.59, 1.54 } } final double v = 0.3 final PDQuadraticMultivariateRealFunction qc0 = new PDQuadraticMultivariateRealFunction(p, null,-v) final LinearMultivariateRealFunction lc0 = new LinearMultivariateRealFunction(new double[] { -1, 0, 0 }, 0) final LinearMultivariateRealFunction lc1 = new LinearMultivariateRealFunction(new double[] { 0, -1, 0 }, 0) final LinearMultivariateRealFunction lc2 = new LinearMultivariateRealFunction(new double[] { 0, 0, -1 }, 0) final ConvexMultivariateRealFunction[] constraints = new ConvexMultivariateRealFunction[] { qc0, lc0, lc1, lc2 }
Definition of the equality constraint:
final double[][] a = {{ 1, 1, 1 }} final double[] b = { 1 }
Definition of the optimization problem and setting the parameters:
final OptimizationRequest or = new OptimizationRequest() or.setF0(objectiveFunction) or.setFi(constraints) or.setA(a) or.setB(b) or.setToleranceFeas(1.e-6) // additional parameter
Definition of the optimizer and setting the optimization problem:
final JOptimizer opt = new JOptimizer() opt.setLPOptimizationRequest(or)
Optimization and check that it has not failed:
final int returnCode = opt.optimize() if (returnCode == OptimizationResponse.FAILED) { fail() }
Recuperate the response and the solution:
final LPOptimizationResponse response = opt.getLPOptimizationResponse() final double[] sol = response.getSolution()
Validation:
assertEquals(1., sol[0] + sol[1] + sol[2], 1.e-6) assertTrue(sol[0] > 0) assertTrue(sol[1] > 0) assertTrue(sol[2] > 0) final RealVector xVector = MatrixUtils.createRealVector(sol) final RealMatrix pMatrix = MatrixUtils.createRealMatrix(p) final double xPx = xVector.dotProduct(pMatrix.operate(xVector)) assertTrue(0.5 * xPx < v)
Contents
Interfaces
The interfaces related to the joptimizer are listed here :
Interface | Summary | Javadoc |
---|---|---|
BarrierFunction | Interface for the barrier function used by a given barrier optimization method. | ... |
ConvexMultivariateRealFunction | Interface for convex multivariate real functions. | ... |
MatrixRescaler | An interface to classes that implement an algorithm to rescale matrices. | ... |
StrictlyConvexMultivariateRealFunction | Interface for striclty convex multivariate real functions. | ... |
TwiceDifferentiableMultivariateRealFunction | Interface for twice-differentiable multivariate functions. | ... |
Classes
The classes related to the joptimizer are listed here :
Class | Summary | Javadoc |
---|---|---|
AlgebraUtils | Algebraic utility operations | ... |
CholeskyFactorization | Implements the Cholesky L.L[T] factorization and inverse for symmetric and positive matrix. | ... |
Matrix1NornRescaler | Calculates the matrix rescaling factors so that the 1-norm of each row and each column of the scaled matrix asymptotically converges to one. | ... |
FunctionsUtils | Utility class for optimization function building. | ... |
LinearMultivariateRealFunction | Represents a function f(x) = q.x + r. | ... |
LogarithmicBarrier | Default barrier function for the barrier method algorithm. | ... |
PDQuadraticMultivariateRealFunction | Extends the class QuadraticMultivariateRealFunction with P symmetric and positive definite. | ... |
PSDQuadraticMultivariateRealFunction | Extends the class QuadraticMultivariateRealFunction with P symmetric and positive semi-definite. | ... |
QuadraticMultivariateRealFunction | Represents a quadratic multivariate function in the form of f(x):= 1/2 x.P.x + q.x + r. | ... |
AbstractLPOptimizationRequestHandler | Abstract class for Linear Problem Optimization Request Handler. | ... |
BarrierMethod | Implements the Barrier Method. | ... |
BasicPhaseIBM | Implements the Basic Phase I Method as a Barried Method. | ... |
BasicPhaseILPPDM | Implements the Basic Phase I Method form LP problems as a Primal-Dual Method. | ... |
BasicPhaseIPDM | Implements the Basic Phase I Method as a Primal-Dual Method. | ... |
JOptimizer | Implements the convex optimizer. | ... |
LPPresolver | Presolver for a linear problem. | ... |
LPPrimalDualMethod | Implements the Primal-dual interior-point method for linear problems. | ... |
LPStandardConverter | Converts a general LP problem into a strictly standard or quasi standard form. | ... |
NewtonLEConstrainedFSP | Linear equality constrained newton optimizer, with feasible starting point. | ... |
NewtonLEConstrainedISP | Linear equality constrained newton optimizer, with infeasible starting point. | ... |
NewtonUnconstrained | Unconstrained newton optimizer. | ... |
OptimizationRequest | Implements an optimization problem. | ... |
OptimizationRequestHandler | Generic class for optimization process. | ... |
OptimizationResponse | Optimization process output: stores the solution as well as an exit code. | ... |
PrimalDualMethod | Implements a primal-dual interior-point method. | ... |
AbstractKKTSolver | Abstract class for solving KKT systems. | ... |
AugmentedKKTSolver | Extension of AbstractKKTSolver for singular matrix. | ... |
BasicKKTSolver | Extension of AbstractKKTSolver for the basic solver. | ... |
UpperDiagonalHKKTSolver | Extends the class AbstractKKTSolver for upper diagonal matrix. | ... |
ArrayUtils | Class offering operations on arrays, primitive arrays (like int[]) and primitive wrapper arrays (like Integer[]). | ... |
MutableInt | A mutable (int) wrapper. | ... |
Utils | Utility class. | ... |