Core subroutines for the SLSQP optimization method. These are refactoried versions of the original routines.
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
real(kind=wp), | private, | parameter | :: | eps | = | epsilon(1.0_wp) |
machine precision |
data formerly saved in linmin routine.
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
real(kind=wp), | public | :: | a | = | zero | ||
real(kind=wp), | public | :: | b | = | zero | ||
real(kind=wp), | public | :: | d | = | zero | ||
real(kind=wp), | public | :: | e | = | zero | ||
real(kind=wp), | public | :: | p | = | zero | ||
real(kind=wp), | public | :: | q | = | zero | ||
real(kind=wp), | public | :: | r | = | zero | ||
real(kind=wp), | public | :: | u | = | zero | ||
real(kind=wp), | public | :: | v | = | zero | ||
real(kind=wp), | public | :: | w | = | zero | ||
real(kind=wp), | public | :: | x | = | zero | ||
real(kind=wp), | public | :: | m | = | zero | ||
real(kind=wp), | public | :: | fu | = | zero | ||
real(kind=wp), | public | :: | fv | = | zero | ||
real(kind=wp), | public | :: | fw | = | zero | ||
real(kind=wp), | public | :: | fx | = | zero | ||
real(kind=wp), | public | :: | tol1 | = | zero | ||
real(kind=wp), | public | :: | tol2 | = | zero |
procedure, public :: destroy => destroy_linmin_data |
data formerly saved in slsqpb.
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
real(kind=wp), | public | :: | t | = | zero | ||
real(kind=wp), | public | :: | f0 | = | zero | ||
real(kind=wp), | public | :: | h1 | = | zero | ||
real(kind=wp), | public | :: | h2 | = | zero | ||
real(kind=wp), | public | :: | h3 | = | zero | ||
real(kind=wp), | public | :: | h4 | = | zero | ||
real(kind=wp), | public | :: | t0 | = | zero | ||
real(kind=wp), | public | :: | gs | = | zero | ||
real(kind=wp), | public | :: | tol | = | zero | ||
real(kind=wp), | public | :: | alpha | = | zero | ||
integer, | public | :: | line | = | 0 | ||
integer, | public | :: | iexact | = | 0 | ||
integer, | public | :: | incons | = | 0 | ||
integer, | public | :: | ireset | = | 0 | ||
integer, | public | :: | itermx | = | 0 | ||
integer, | public | :: | n1 | = | 0 | ||
integer, | public | :: | n2 | = | 0 | ||
integer, | public | :: | n3 | = | 0 |
procedure, public :: destroy => destroy_slsqpb_data |
Check for convergence.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | n | |||
real(kind=wp), | intent(in) | :: | f | |||
real(kind=wp), | intent(in) | :: | f0 | |||
real(kind=wp), | intent(in), | dimension(:) | :: | x | ||
real(kind=wp), | intent(in), | dimension(:) | :: | x0 | ||
real(kind=wp), | intent(in), | dimension(:) | :: | s | ||
real(kind=wp), | intent(in) | :: | h3 | |||
real(kind=wp), | intent(in) | :: | acc | |||
real(kind=wp), | intent(in) | :: | tolf | |||
real(kind=wp), | intent(in) | :: | toldf | |||
real(kind=wp), | intent(in) | :: | toldx | |||
integer, | intent(in) | :: | converged |
mode value if converged |
||
integer, | intent(in) | :: | not_converged |
mode value if not converged |
||
logical, | intent(in) | :: | inconsistent_linearization |
if the SQP problem is inconsistent (will return |
Linesearch without derivatives (used by slsqp if linesearch_mode=2
).
Returns the abscissa approximating the point where f
attains a minimum.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(inout) | :: | mode |
controls reverse communication must be set to 0 initially, returns with intermediate values 1 and 2 which must not be changed by the user, ends with convergence with value 3. |
||
real(kind=wp), | intent(in) | :: | ax |
left endpoint of initial interval |
||
real(kind=wp), | intent(in) | :: | bx |
right endpoint of initial interval |
||
real(kind=wp) | :: | f |
function value at |
|||
real(kind=wp), | intent(in) | :: | tol |
desired length of interval of uncertainty of final result |
||
real(kind=wp), | intent(inout) | :: | a | |||
real(kind=wp), | intent(inout) | :: | b | |||
real(kind=wp), | intent(inout) | :: | d | |||
real(kind=wp), | intent(inout) | :: | e | |||
real(kind=wp), | intent(inout) | :: | p | |||
real(kind=wp), | intent(inout) | :: | q | |||
real(kind=wp), | intent(inout) | :: | r | |||
real(kind=wp), | intent(inout) | :: | u | |||
real(kind=wp), | intent(inout) | :: | v | |||
real(kind=wp), | intent(inout) | :: | w | |||
real(kind=wp), | intent(inout) | :: | x | |||
real(kind=wp), | intent(inout) | :: | m | |||
real(kind=wp), | intent(inout) | :: | fu | |||
real(kind=wp), | intent(inout) | :: | fv | |||
real(kind=wp), | intent(inout) | :: | fw | |||
real(kind=wp), | intent(inout) | :: | fx | |||
real(kind=wp), | intent(inout) | :: | tol1 | |||
real(kind=wp), | intent(inout) | :: | tol2 |
slsqp: sequential least squares programming to solve general nonlinear optimization problems
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | m |
is the total number of constraints, |
||
integer, | intent(in) | :: | meq |
is the number of equality constraints, |
||
integer, | intent(in) | :: | la |
see |
||
integer, | intent(in) | :: | n |
is the number of variables, |
||
real(kind=wp), | intent(inout), | dimension(n) | :: | x |
|
|
real(kind=wp), | intent(in), | dimension(n) | :: | xl |
|
|
real(kind=wp), | intent(in), | dimension(n) | :: | xu |
|
|
real(kind=wp), | intent(in) | :: | f |
is the value of the objective function. |
||
real(kind=wp), | intent(in), | dimension(la) | :: | c |
|
|
real(kind=wp), | intent(in), | dimension(n+1) | :: | g |
|
|
real(kind=wp), | intent(in), | dimension(la,n+1) | :: | a |
the |
|
real(kind=wp), | intent(inout) | :: | acc |
|
||
integer, | intent(inout) | :: | iter |
prescribes the maximum number of iterations.
on exit |
||
integer, | intent(inout) | :: | mode |
mode controls calculation: |
||
real(kind=wp), | intent(inout), | dimension(l_w) | :: | w |
|
|
integer, | intent(in) | :: | l_w |
the length of |
||
type(slsqpb_data), | intent(inout) | :: | sdat |
data for slsqpb. |
||
type(linmin_data), | intent(inout) | :: | ldat |
data for linmin. |
||
real(kind=wp), | intent(in) | :: | alphamin |
min for line search |
||
real(kind=wp), | intent(in) | :: | alphamax |
max for line search |
||
real(kind=wp), | intent(in) | :: | tolf |
stopping criterion if then stop. |
||
real(kind=wp), | intent(in) | :: | toldf |
stopping criterion if then stop. |
||
real(kind=wp), | intent(in) | :: | toldx |
stopping criterion if then stop. |
||
integer, | intent(in) | :: | max_iter_ls |
maximum number of iterations in the nnls problem |
||
integer, | intent(in) | :: | nnls_mode |
which NNLS method to use |
||
real(kind=wp), | intent(in) | :: | infinite_bound |
"infinity" for the upper and lower bounds.
if |
nonlinear programming by solving sequentially quadratic programs
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | m | |||
integer, | intent(in) | :: | meq | |||
integer, | intent(in) | :: | la | |||
integer, | intent(in) | :: | n | |||
real(kind=wp), | dimension(n) | :: | x | |||
real(kind=wp), | dimension(n) | :: | xl | |||
real(kind=wp), | dimension(n) | :: | xu | |||
real(kind=wp) | :: | f | ||||
real(kind=wp), | dimension(la) | :: | c | |||
real(kind=wp), | dimension(n+1) | :: | g | |||
real(kind=wp), | dimension(la,n+1) | :: | a | |||
real(kind=wp) | :: | acc | ||||
integer, | intent(inout) | :: | iter |
in: maximum number of iterations. out: actual number of iterations. |
||
integer, | intent(inout) | :: | mode | |||
real(kind=wp), | dimension(m+n+n+2) | :: | r | |||
real(kind=wp), | dimension((n+1)*(n+2)/2) | :: | l | |||
real(kind=wp), | dimension(n) | :: | x0 | |||
real(kind=wp), | dimension(la) | :: | mu | |||
real(kind=wp), | dimension(n+1) | :: | s | |||
real(kind=wp), | dimension(n+1) | :: | u | |||
real(kind=wp), | dimension(n+1) | :: | v | |||
real(kind=wp), | intent(inout), | dimension(*) | :: | w |
|
|
real(kind=wp), | intent(inout) | :: | t | |||
real(kind=wp), | intent(inout) | :: | f0 | |||
real(kind=wp), | intent(inout) | :: | h1 | |||
real(kind=wp), | intent(inout) | :: | h2 | |||
real(kind=wp), | intent(inout) | :: | h3 | |||
real(kind=wp), | intent(inout) | :: | h4 | |||
integer, | intent(inout) | :: | n1 | |||
integer, | intent(inout) | :: | n2 | |||
integer, | intent(inout) | :: | n3 | |||
real(kind=wp), | intent(inout) | :: | t0 | |||
real(kind=wp), | intent(inout) | :: | gs | |||
real(kind=wp), | intent(inout) | :: | tol | |||
integer, | intent(inout) | :: | line | |||
real(kind=wp), | intent(inout) | :: | alpha | |||
integer, | intent(inout) | :: | iexact | |||
integer, | intent(inout) | :: | incons | |||
integer, | intent(inout) | :: | ireset | |||
integer, | intent(inout) | :: | itermx | |||
type(linmin_data), | intent(inout) | :: | ldat |
data for linmin. |
||
real(kind=wp), | intent(in) | :: | alphamin |
min for line search |
||
real(kind=wp), | intent(in) | :: | alphamax |
max for line search |
||
real(kind=wp), | intent(in) | :: | tolf |
stopping criterion if then stop. |
||
real(kind=wp), | intent(in) | :: | toldf |
stopping criterion if then stop |
||
real(kind=wp), | intent(in) | :: | toldx |
stopping criterion if then stop |
||
integer, | intent(in) | :: | max_iter_ls |
maximum number of iterations in the nnls problem |
||
integer, | intent(in) | :: | nnls_mode |
which NNLS method to use |
||
real(kind=wp), | intent(in) | :: | infBnd |
"infinity" for the upper and lower bounds. |
Minimize with respect to , with upper triangular matrix , and vector , where the unit lower tridiangular matrix is stored columnwise dense in the array with vector stored in its 'diagonal' thus substituting the one-elements of
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | m | |||
integer, | intent(in) | :: | meq | |||
integer, | intent(in) | :: | n | |||
integer, | intent(in) | :: | nl | |||
integer, | intent(in) | :: | la | |||
real(kind=wp), | dimension(nl) | :: | l | |||
real(kind=wp), | dimension(n) | :: | g | |||
real(kind=wp), | dimension(la,n) | :: | a | |||
real(kind=wp), | dimension(la) | :: | b | |||
real(kind=wp), | dimension(n) | :: | xl | |||
real(kind=wp), | dimension(n) | :: | xu | |||
real(kind=wp), | dimension(n) | :: | x |
stores the n-dimensional solution vector |
||
real(kind=wp), | dimension(m+n+n) | :: | y |
stores the vector of lagrange multipliers of dimension m+n+n (constraints+lower+upper bounds) |
||
real(kind=wp), | dimension(*) | :: | w | |||
integer | :: | mode |
is a success-failure flag with the following meanings: |
|||
integer, | intent(in) | :: | max_iter_ls |
maximum number of iterations in the nnls problem |
||
integer, | intent(in) | :: | nnls_mode |
which NNLS method to use |
||
real(kind=wp), | intent(in) | :: | infbnd |
"infinity" for the upper and lower bounds. |
for mode=1
, the subroutine returns the solution x
of
equality & inequality constrained least squares problem lsei :
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=wp), | intent(inout), | dimension(lc,n) | :: | c | ||
real(kind=wp), | intent(inout), | dimension(lc) | :: | d | ||
real(kind=wp), | intent(inout), | dimension(le,n) | :: | e | ||
real(kind=wp), | intent(inout), | dimension(le) | :: | f | ||
real(kind=wp), | intent(inout), | dimension(lg,n) | :: | g | ||
real(kind=wp), | intent(inout), | dimension(lg) | :: | h | ||
integer, | intent(in) | :: | lc | |||
integer, | intent(in) | :: | mc | |||
integer, | intent(in) | :: | le | |||
integer, | intent(in) | :: | me | |||
integer, | intent(in) | :: | lg | |||
integer, | intent(in) | :: | mg | |||
integer, | intent(in) | :: | n | |||
real(kind=wp), | intent(out), | dimension(n) | :: | x |
stores the solution vector |
|
real(kind=wp), | intent(out) | :: | xnrm |
stores the residuum of the solution in euclidian norm |
||
real(kind=wp), | intent(inout), | dimension(*) | :: | w |
on return, stores the vector of lagrange multipliers
in its first |
|
integer, | intent(out) | :: | mode |
is a success-failure flag with the following meanings: |
||
integer, | intent(in) | :: | max_iter_ls |
maximum number of iterations in the nnls problem |
||
integer, | intent(in) | :: | nnls_mode |
which NNLS method to use |
for mode=1
, the subroutine returns the solution x
of
inequality constrained linear least squares problem:
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=wp), | intent(inout), | dimension(le,n) | :: | e | ||
real(kind=wp), | intent(inout), | dimension(le) | :: | f | ||
real(kind=wp), | intent(inout), | dimension(lg,n) | :: | g | ||
real(kind=wp), | intent(inout), | dimension(lg) | :: | h | ||
integer, | intent(in) | :: | le | |||
integer, | intent(in) | :: | me | |||
integer, | intent(in) | :: | lg | |||
integer, | intent(in) | :: | mg | |||
integer, | intent(in) | :: | n | |||
real(kind=wp), | intent(out), | dimension(n) | :: | x |
stores the solution vector |
|
real(kind=wp), | intent(out) | :: | xnorm |
stores the residuum of the solution in euclidian norm |
||
real(kind=wp), | intent(inout), | dimension(*) | :: | w |
stores the vector of lagrange multipliers in its first
|
|
integer, | intent(out) | :: | mode |
is a success-failure flag with the following meanings: |
||
integer, | intent(in) | :: | max_iter_ls |
maximum number of iterations in the nnls problem |
||
integer, | intent(in) | :: | nnls_mode |
which NNLS method to use |
Least distance programming routine. Minimize subject to .
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=wp), | intent(in), | dimension(mg,n) | :: | g |
on entry |
|
integer, | intent(in) | :: | mg | |||
integer, | intent(in) | :: | m | |||
integer, | intent(in) | :: | n | |||
real(kind=wp), | intent(in), | dimension(m) | :: | h |
the right side of the inequality system. |
|
real(kind=wp), | intent(out), | dimension(n) | :: | x |
solution vector |
|
real(kind=wp), | intent(out) | :: | xnorm |
euclidian norm of the solution vector if computation is successful |
||
real(kind=wp), | intent(inout), | dimension(*) | :: | w |
|
|
integer, | intent(out) | :: | mode |
success-failure flag with the following meanings: |
||
integer, | intent(in) | :: | max_iter_ls |
maximum number of iterations in the nnls problem |
||
integer, | intent(in) | :: | nnls_mode |
which NNLS method to use |
Nonnegative least squares algorithm.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=wp), | intent(inout), | dimension(mda,n) | :: | a |
on entry, contains the |
|
integer, | intent(in) | :: | mda |
first dimensioning parameter for the array |
||
integer, | intent(in) | :: | m | |||
integer, | intent(in) | :: | n | |||
real(kind=wp), | intent(inout), | dimension(m) | :: | b |
on entry, contains the m-vector |
|
real(kind=wp), | intent(out), | dimension(n) | :: | x |
the solution vector. |
|
real(kind=wp), | intent(out) | :: | rnorm |
euclidean norm of the residual vector. |
||
real(kind=wp), | intent(inout), | dimension(n) | :: | w |
array of working space. on exit |
|
real(kind=wp), | intent(inout), | dimension(m) | :: | zz |
an m-array of working space. |
|
integer, | intent(out) | :: | mode |
this is a success-failure flag with the following meanings: |
||
integer, | intent(in) | :: | max_iter |
maximum number of iterations (if <=0, then |
Rank-deficient least squares algorithm using householder forward triangulation with column interchanges.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=wp), | intent(inout), | dimension(mda,n) | :: | a |
the array |
|
integer, | intent(in) | :: | mda |
the first dimensioning parameter of matrix |
||
integer, | intent(in) | :: | m | |||
integer, | intent(in) | :: | n | |||
real(kind=wp), | intent(inout), | dimension(mdb,nb) | :: | b |
if |
|
integer, | intent(in) | :: | mdb |
first dimensioning parameter of matrix |
||
integer, | intent(in) | :: | nb | |||
real(kind=wp), | intent(in) | :: | tau |
absolute tolerance parameter for pseudorank determination, provided by the user. |
||
integer, | intent(out) | :: | krank |
pseudorank of |
||
real(kind=wp), | intent(out), | dimension(nb) | :: | rnorm |
on exit, |
|
real(kind=wp), | intent(inout), | dimension(n) | :: | h |
array of working space |
|
real(kind=wp), | intent(inout), | dimension(n) | :: | g |
array of working space |
Construction and/or application of a single householder transformation .
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | mode |
|
||
integer, | intent(in) | :: | lpivot |
the index of the pivot element |
||
integer, | intent(in) | :: | l1 |
if |
||
integer, | intent(in) | :: | m |
see |
||
real(kind=wp), | intent(inout), | dimension(iue,*) | :: | u |
on entry with |
|
integer, | intent(in) | :: | iue |
see |
||
real(kind=wp), | intent(inout) | :: | up |
see |
||
real(kind=wp), | intent(inout), | dimension(*) | :: | c |
on entry with |
|
integer, | intent(in) | :: | ice |
storage increment between elements of vectors in |
||
integer, | intent(in) | :: | icv |
storage increment between vectors in |
||
integer, | intent(in) | :: | ncv |
number of vectors in |
Compute orthogonal rotation matrix.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=wp) | :: | a | ||||
real(kind=wp) | :: | b | ||||
real(kind=wp), | intent(out) | :: | c | |||
real(kind=wp), | intent(out) | :: | s | |||
real(kind=wp) | :: | sig |
- rank-one - update
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | n |
order of the coefficient matrix |
||
real(kind=wp), | intent(inout), | dimension(*) | :: | a |
In: positive definite matrix of dimension |
|
real(kind=wp), | intent(inout), | dimension(*) | :: | z |
vector of dimension |
|
real(kind=wp), | intent(in) | :: | sigma |
scalar factor by which the modifying dyade is multiplied. |
||
real(kind=wp), | intent(inout), | dimension(*) | :: | w |
working array of dimension |
enforce the bound constraints on x
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=wp), | intent(inout), | dimension(:) | :: | x |
optimization variable vector |
|
real(kind=wp), | intent(in), | dimension(:) | :: | xl |
lower bounds (must be same dimension as |
|
real(kind=wp), | intent(in), | dimension(:) | :: | xu |
upper bounds (must be same dimension as |
|
real(kind=wp), | intent(in) | :: | infbnd |
"infinity" for the upper and lower bounds.
Note that |
Destructor for slsqpb_data type.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(slsqpb_data), | intent(out) | :: | me |
Destructor for linmin_data type.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(linmin_data), | intent(out) | :: | me |