NAG Library Routine Document
E05SBF
Note: this routine uses optional parameters to define choices in the problem specification and in the details of the algorithm. If you wish to use default
settings for all of the optional parameters, you need only read Sections 1 to 9 of this document. If, however, you wish to reset some or all of the settings please refer to Section 10 for a detailed description of the algorithm and to Section 11 for a detailed description of the specification of the optional parameters.
1 Purpose
E05SBF is designed to search for the global minimum or maximum of an arbitrary function, subject to general nonlinear constraints, using Particle Swarm Optimization (PSO). Derivatives are not required, although these may be used by an accompanying local minimization routine if desired. E05SBF is essentially identical to
E05SAF, with an expert interface and various additional parameters added; otherwise most parameters are identical. In particular,
E05SAF does not handle general constraints.
1.1 Information for users of the NAG Library for SMP & Multicore
E05SBF has been designed to be particularly effective on SMP systems, by allowing multiple threads to advance subiterations of the algorithm in a highly asynchronous manner. In doing this, the callback routines supplied to E05SBF are called simultaneously on multiple threads, and therefore must themselves be thread-safe. In particular, the arrays
IUSER and
RUSER provided are classified as OpenMP shared memory, and as such it is imperative that any operations performed on these arrays are done in an appropriate manner. Failure to ensure thread safety of the provided callback functions may result in unpredictable behaviour, including the callback functions returning completely wrong solutions to E05SBF – invalidating any solution returned.
When using an SMP parallel version of this routine, you must indicate that the callback routines are thread-safe by setting the optional argument
SMP Callback Thread Safe before calling E05SBF in a multi-threaded environment. See
Section 11.2 for more information on this and other SMP options.
Note: the stochastic method used in E05SBF will not produce repeatable answers when run on multiple threads.
2 Specification
SUBROUTINE E05SBF ( |
NDIM, NCON, NPAR, XB, FB, CB, BL, BU, XBEST, FBEST, CBEST, OBJFUN, CONFUN, MONMOD, IOPTS, OPTS, IUSER, RUSER, ITT, INFORM, IFAIL) |
INTEGER |
NDIM, NCON, NPAR, IOPTS(*), IUSER(*), ITT(7), INFORM, IFAIL |
REAL (KIND=nag_wp) |
XB(NDIM), FB, CB(NCON), BL(NDIM+NCON), BU(NDIM+NCON), XBEST(NDIM,NPAR), FBEST(NPAR), CBEST(NCON,NPAR), OPTS(*), RUSER(*) |
EXTERNAL |
OBJFUN, CONFUN, MONMOD |
|
Before calling E05SBF,
E05ZKF must be called with
OPTSTR set to ‘
Initialize = e05sbf’. Optional parameters may also be specified by calling
E05ZKF before the call to E05SBF.
3 Description
E05SBF uses a stochastic method based on Particle Swarm Optimization (PSO) to search for the global optimum of a nonlinear function
, subject to a set of bound constraints on the variables, and optionally a set of general nonlinear constraints. In the PSO algorithm (see
Section 10), a set of particles is generated in the search space, and advances each iteration to (hopefully) better positions using a heuristic velocity based upon
inertia,
cognitive memory and
global memory. The inertia is provided by a decreasingly weighted contribution from a particles current velocity, the cognitive memory refers to the best candidate found by an individual particle and the global memory refers to the best candidate found by all the particles. This allows for a global search of the domain in question.
Further, this may be coupled with a selection of local minimization routines, which may be called during the iterations of the heuristic algorithm, the interior phase, to hasten the discovery of locally optimal points, and after the heuristic phase has completed to attempt to refine the final solution, the exterior phase. Different options may be set for the local optimizer in each phase.
Without loss of generality, the problem is assumed to be stated in the following form:
where the objective
is a scalar function,
is a vector of scalar constraint functions,
is a vector in
and the vectors
are lower and upper bounds respectively for the
variables and
constraints. Both the objective function and the
constraints may be nonlinear. Continuity of
, and the functions
, is not essential. For functions which are smooth and primarily unimodal, faster solutions will almost certainly be achieved by using
Chapter E04 routines directly.
For functions which are smooth and multi-modal, gradient dependent local minimization routines may be coupled with E05SBF.
For multi-modal functions for which derivatives cannot be provided, particularly functions with a significant level of noise in their evaluation, E05SBF should be used either alone, or coupled with
E04CBF.
For heavily constrained problems, E05SBF should either be used alone, or coupled with
E04UCF/E04UCA provided the function and the constraints are sufficiently smooth.
The
lower and upper box bounds on the variable
are included to initialize the particle swarm into a finite hypervolume, although their subsequent influence on the algorithm is user determinable (see the option
Boundary in
Section 11). It is strongly recommended that sensible bounds are provided for all variables and constraints.
E05SBF may also be used to maximize the objective function, or to search for a feasible point satisfying the simple bounds and general constraints (see the option
Optimize).
Due to the nature of global optimization, unless a predefined target is provided, there is no definitive way of knowing when to end a computation. As such several stopping heuristics have been implemented into the algorithm. If any of these is achieved, E05SBF will exit with
, and the parameter
INFORM will indicate which criteria was reached. See
INFORM for more information.
In addition, you may provide your own stopping criteria through
MONMOD,
OBJFUN and
CONFUN.
E05SAF provides a simpler interface, without the inclusion of general nonlinear constraints.
4 References
Gill P E, Murray W and Wright M H (1981) Practical Optimization Academic Press
Kennedy J and Eberhart R C (1995) Particle Swarm Optimization Proceedings of the 1995 IEEE International Conference on Neural Networks 1942–1948
Koh B, George A D, Haftka R T and Fregly B J (2006) Parallel Asynchronous Particle Swarm Optimization International Journal for Numerical Methods in Engineering 67(4) 578–595
Vaz A I and Vicente L N (2007) A Particle Swarm Pattern Search Method for Bound Constrained Global Optimization Journal of Global Optimization 39(2) 197–219 Kluwer Academic Publishers
5 Parameters
Note: for descriptions of the symbolic variables, see
Section 10.
- 1: NDIM – INTEGERInput
On entry: , the number of dimensions.
Constraint:
.
- 2: NCON – INTEGERInput
On entry: , the number of constraints, not including box constraints.
Constraint:
.
- 3: NPAR – INTEGERInput
On entry:
, the number of particles to be used in the swarm. Assuming all particles remain within constraints, each complete iteration will perform at least
NPAR function evaluations. Otherwise, significantly fewer objective function evaluations may be performed.
Suggested value:
.
Constraint:
, where num_threads is the value returned by the OpenMP environment variable OMP_NUM_THREADS, or num_threads is for a serial version of this routine.
- 4: XB(NDIM) – REAL (KIND=nag_wp) arrayOutput
On exit: the location of the best solution found, , in .
- 5: FB – REAL (KIND=nag_wp)Output
On exit: the objective value of the best solution, .
- 6: CB(NCON) – REAL (KIND=nag_wp) arrayOutput
On exit: the constraint violations of the best solution found,
. These may have been deemed to be acceptable given the tolerance and scaling of the constraints. See
Sections 10 and
11.
- 7: BL() – REAL (KIND=nag_wp) arrayInput
- 8: BU() – REAL (KIND=nag_wp) arrayInput
On entry:
is
, the array of lower bounds,
BU is
, the array of upper bounds. The first
NDIM entries in
BL and
BU must contain the lower and upper simple (box) bounds of the variables respectively. These must be provided to initialize the sample population into a finite hypervolume, although their subsequent influence on the algorithm is user determinable (see the option
Boundary in
Section 11).
The next
NCON entries must contain the lower and upper bounds for any general constraints respectively.
If
for any
, variable
will remain locked to
regardless of the
Boundary option selected.
It is strongly advised that you place sensible lower and upper bounds on all variables and constraints, even if your model allows for unbounded variables or constraints.
Constraints:
- , for ;
- for at least one .
- 9: XBEST(NDIM,NPAR) – REAL (KIND=nag_wp) arrayInput/Output
Note: the th component of the best position of the th particle, , is stored in .
On entry: if using , the initial particle positions, .
On exit: the best positions found,
, by the
NPAR particles in the swarm.
- 10: FBEST(NPAR) – REAL (KIND=nag_wp) arrayInput/Output
On entry: if using
, objective function values,
, corresponding to the
NPAR particle locations stored in
XBEST.
On exit: objective function values,
, corresponding to the locations returned in
XBEST.
- 11: CBEST(NCON,NPAR) – REAL (KIND=nag_wp) arrayInput/Output
Note: the th constraint violation of the th particle is stored in .
On entry: if using
, the initial constraint violations,
, corresponding to the
NPAR particle locations.
On exit: the final constraint violations,
, corresponding to the locations returned in
XBEST.
- 12: OBJFUN – SUBROUTINE, supplied by the user.External Procedure
OBJFUN must, depending on the value of
MODE, calculate the objective function
and/or calculate the gradient of the objective function for a
-variable vector
. Gradients are only required if a local minimizer has been chosen which requires gradients. See the option
Local Minimizer for more information.
The specification of
OBJFUN is:
INTEGER |
MODE, NDIM, NSTATE, IUSER(*) |
REAL (KIND=nag_wp) |
X(NDIM), OBJF, VECOUT(NDIM), RUSER(*) |
|
- 1: MODE – INTEGERInput/Output
On entry: indicates which functionality is required.
- should be returned in OBJF. The value of OBJF on entry may be used as an upper bound for the calculation. Any expected value of that is greater than OBJF may be approximated by this upper bound; that is OBJF can remain unaltered.
- only
First derivatives can be evaluated and returned in VECOUT. Any unaltered elements of VECOUT will be approximated using finite differences.
- only
must be calculated and returned in OBJF, and available first derivatives can be evaluated and returned in VECOUT. Any unaltered elements of VECOUT will be approximated using finite differences.
- must be calculated and returned in OBJF. The value of OBJF on entry may not be used as an upper bound.
- or only
All first derivatives must be evaluated and returned in VECOUT.
- or only
must be calculated and returned in OBJF, and all first derivatives must be evaluated and returned in VECOUT.
On exit: if the value of
MODE is set to be negative, then E05SBF will exit as soon as possible with
and
.
- 2: NDIM – INTEGERInput
On entry: the number of dimensions.
- 3: X(NDIM) – REAL (KIND=nag_wp) arrayInput
On entry: , the point at which the objective function and/or its gradient are to be evaluated.
- 4: OBJF – REAL (KIND=nag_wp)Input/Output
On entry: the value of
OBJF passed to
OBJFUN varies with the parameter
MODE.
- OBJF is an upper bound for the value of , often equal to the best constraint penalised value of found so far by a given particle if the objective function is strictly positive (see Section 10). Only objective function values less than the value of OBJF on entry will be used further. As such this upper bound may be used to stop further evaluation when this will only increase the objective function value above the upper bound.
- , , , or
- OBJF is meaningless on entry.
On exit: the value of
OBJF returned varies with the parameter
MODE.
- OBJF must be the value of . Only values of strictly less than OBJF on entry need be accurate.
- or
- Need not be set.
- , or
- must be calculated and returned in OBJF. The entry value of OBJF may not be used as an upper bound.
- 5: VECOUT(NDIM) – REAL (KIND=nag_wp) arrayInput/Output
On entry: if
or
, the values of
VECOUT are used internally to indicate whether a finite difference approximation is required. See
E04UCF/E04UCA.
On exit: the required values of
VECOUT returned to the calling routine depend on the value of
MODE.
- or
- The value of VECOUT need not be set.
- or
- VECOUT can contain components of the gradient of the objective function for some , or acceptable approximations. Any unaltered elements of VECOUT will be approximated using finite differences.
- or
- VECOUT must contain the gradient of the objective function for all . Approximation of the gradient is strongly discouraged, and no finite difference approximations will be performed internally (see E04DGF/E04DGA and E04KZF).
- 6: NSTATE – INTEGERInput
On entry:
NSTATE indicates various stages of initialization throughout the routine. This allows for permanent global parameters to be initialized the least number of times. For example, you may initialize a random number generator seed.
- SMP users only. OBJFUN is called for the first time in a parallel region on a new thread other than the master thread. You may use this opportunity to set up any thread-dependent information in IUSER and RUSER.
- OBJFUN is called for the very first time. You may save computational time if certain data must be read or calculated only once.
- OBJFUN is called for the first time by a NAG local minimization routine. You may save computational time if certain data required for the local minimizer need only be calculated at the initial point of the local minimization.
- Used in all other cases.
- 7: IUSER() – INTEGER arrayUser Workspace
- 8: RUSER() – REAL (KIND=nag_wp) arrayUser Workspace
-
OBJFUN is called with the parameters
IUSER and
RUSER as supplied to E05SBF. You are free to use the arrays
IUSER and
RUSER to supply information to
OBJFUN as an alternative to using COMMON global variables.
OBJFUN must either be a module subprogram USEd by, or declared as EXTERNAL in, the (sub)program from which E05SBF is called. Parameters denoted as
Input must
not be changed by this procedure.
- 13: CONFUN – SUBROUTINE, supplied by the NAG Library or the user.External Procedure
CONFUN must calculate any constraints other than the box constraints. If no constraints are required,
CONFUN may be the dummy constraint routine E05SZM. (E05SZM is included in the NAG Library). For information on how a NAG local minimizer will use
CONFUN see the documentation for
E04UCA.
The specification of
CONFUN is:
SUBROUTINE CONFUN ( |
MODE, NCON, NDIM, LDCJ, NEEDC, X, C, CJAC, NSTATE, IUSER, RUSER) |
INTEGER |
MODE, NCON, NDIM, LDCJ, NEEDC(NCON), NSTATE, IUSER(*) |
REAL (KIND=nag_wp) |
X(NDIM), C(NCON), CJAC(LDCJ,NDIM), RUSER(*) |
|
- 1: MODE – INTEGERInput/Output
On entry: indicates which values must be assigned during each call of
CONFUN. Only the following values need be assigned, for each value of
such that
:
- the constraint values .
- rows of the constraint jacobian,
, for .
- the constraint values and the corresponding rows of the constraint jacobian,
, for .
On exit: may be set to a negative value if you wish to terminate the solution to the current problem. In this case E05SBF will terminate with and as soon as possible.
- 2: NCON – INTEGERInput
On entry: the number of constraints, not including box bounds.
- 3: NDIM – INTEGERInput
On entry: the number of variables.
- 4: LDCJ – INTEGERInput
On entry: the first dimension of the array
CJAC as declared in the (sub)program from which E05SBF is called.
- 5: NEEDC(NCON) – INTEGER arrayInput
On entry: the indices of the elements of
C and/or
CJAC that must be evaluated by
CONFUN. If
, the
th element of
C, corresponding to the values of the
th constraint, and/or the available elements of the
th row of
CJAC, corresponding to the derivatives of the
th constraint, must be evaluated at
(see parameter
MODE).
- 6: X(NDIM) – REAL (KIND=nag_wp) arrayInput
On entry: , the vector of variables at which the constraint functions and/or the available elements of the constraint Jacobian are to be evaluated.
- 7: C(NCON) – REAL (KIND=nag_wp) arrayOutput
On exit: if
and
or
,
must contain the value of
. The remaining elements of
C, corresponding to the non-positive elements of
NEEDC, need not be set.
- 8: CJAC(LDCJ,NDIM) – REAL (KIND=nag_wp) arrayInput/Output
Note: the derivative of the th constraint with respect to the th component, , is stored in .
On entry: the elements of
CJAC are set to special values which enable E05SBF to detect whether they are changed by
CONFUN.
On exit: if
and
or
, the elements of
CJAC corresponding to the
th row of the constraint jacobian should contain the available elements of the vector
given by
where
is the partial derivative of the
th constraint with respect to the
th variable, evaluated at the point
; elements of
CJAC that remain unaltered will be approximated internally using finite differences. The remaining rows of
CJAC, corresponding to non-positive elements of
NEEDC, need not be set.
It must be emphasized that unassigned elements of
CJAC are not treated as constant; they are estimated by finite differences, at nontrivial expense. An interval for each element of
is computed automatically at the start of the optimization. The automatic procedure can usually identify constant elements of
CJAC, which are then computed once only by finite differences.
- 9: NSTATE – INTEGERInput
On entry:
NSTATE indicates various stages of initialization throughout the routine. This allows for permanent global parameters to be initialized a minimum number of times. For example, you may initialize a random number generator seed. Note that unless the option
has been set,
OBJFUN will be called before
CONFUN.
- SMP users only. OBJFUN is called for the first time in a parallel region on a new thread other than the master thread. You may use this opportunity to set up any thread-dependent information in IUSER and RUSER.
- CONFUN is called for the very first time. This parameter setting allows you to save computational time if certain data must be read or calculated only once.
- CONFUN is called for the first time during a NAG local minimization routine. This parameter setting allows you to save computational time if certain data required for the local minimizer need only be calculated at the initial point of the local minimization.
- Used in all other cases.
- 10: IUSER() – INTEGER arrayUser Workspace
- 11: RUSER() – REAL (KIND=nag_wp) arrayUser Workspace
-
CONFUN is called with the parameters
IUSER and
RUSER as supplied to E05SBF. You are free to use the arrays
IUSER and
RUSER to supply information to
CONFUN as an alternative to using COMMON global variables.
CONFUN must either be a module subprogram USEd by, or declared as EXTERNAL in, the (sub)program from which E05SBF is called. Parameters denoted as
Input must
not be changed by this procedure.
CONFUN should be tested separately before being used in conjunction with E05SBF.
- 14: MONMOD – SUBROUTINE, supplied by the NAG Library or the user.External Procedure
A user-specified monitoring and modification function.
MONMOD is called once every complete iteration after a finalization check. It may be used to modify the particle locations that will be evaluated at the next iteration. This permits the incorporation of algorithmic modifications such as including additional advection heuristics and genetic mutations.
MONMOD is only called during the main loop of the algorithm, and as such will be unaware of any further improvement from the final local minimization. If no monitoring and/or modification is required,
MONMOD may be the dummy monitoring routine E05SYM. (E05SYM is included in the NAG Library) .
The specification of
MONMOD is:
SUBROUTINE MONMOD ( |
NDIM, NCON, NPAR, X, XB, FB, CB, XBEST, FBEST, CBEST, ITT, IUSER, RUSER, INFORM) |
INTEGER |
NDIM, NCON, NPAR, ITT(7), IUSER(*), INFORM |
REAL (KIND=nag_wp) |
X(NDIM,NPAR), XB(NDIM), FB, CB(NCON), XBEST(NDIM,NPAR), FBEST(NPAR), CBEST(NCON,NPAR), RUSER(*) |
|
- 1: NDIM – INTEGERInput
On entry: the number of dimensions.
- 2: NCON – INTEGERInput
On entry: the number of constraints.
- 3: NPAR – INTEGERInput
On entry: the number of particles.
- 4: X(NDIM,NPAR) – REAL (KIND=nag_wp) arrayInput/Output
Note: the th component of the th particle, , is stored in .
On entry: the
NPAR particle locations,
, which will currently be used during the next iteration unless altered in
MONMOD.
On exit: the particle locations to be used during the next iteration.
- 5: XB(NDIM) – REAL (KIND=nag_wp) arrayInput
On entry: the location, , of the best solution yet found.
- 6: FB – REAL (KIND=nag_wp)Input
On entry: the objective value, , of the best solution yet found.
- 7: CB(NCON) – REAL (KIND=nag_wp) arrayInput
On entry: the constraint violations, , of the best solution yet found.
- 8: XBEST(NDIM,NPAR) – REAL (KIND=nag_wp) arrayInput
Note: the th component of the position of the th particle's cognitive memory, , is stored in .
On entry: the locations currently in the cognitive memory,
, for
(see
Section 10).
- 9: FBEST(NPAR) – REAL (KIND=nag_wp) arrayInput
On entry: the objective values currently in the cognitive memory,
, for .
- 10: CBEST(NCON,NPAR) – REAL (KIND=nag_wp) arrayInput
Note: the th constraint violation of the th particle's cognitive memory is stored in .
On entry: the constraint violations currently in the cognitive memory,
, for , evaluated at .
- 11: ITT() – INTEGER arrayInput
On entry: iteration and function evaluation counters (see description of
ITT below).
- 12: IUSER() – INTEGER arrayUser Workspace
- 13: RUSER() – REAL (KIND=nag_wp) arrayUser Workspace
-
MONMOD is called with the parameters
IUSER and
RUSER as supplied to E05SBF. You are free to use the arrays
IUSER and
RUSER to supply information to
MONMOD as an alternative to using COMMON global variables.
- 14: INFORM – INTEGERInput/Output
On entry: , where thread_num is the value returned by a call of the OpenMP function OMP_GET_THREAD_NUM(). If running in serial this will always be zero.
On exit: setting
will cause near immediate exit from E05SBF. This value will be returned as
INFORM with
. You need not set
INFORM unless you wish to force an exit.
MONMOD must either be a module subprogram USEd by, or declared as EXTERNAL in, the (sub)program from which E05SBF is called. Parameters denoted as
Input must
not be changed by this procedure.
- 15: IOPTS() – INTEGER arrayCommunication Array
-
Note: the contents of
IOPTS must not have been altered between calls to
E05ZKF,
E05ZLF, E05SBF and the selected problem solving routine.
On entry: optional parameter array as generated and possibly modified by calls to
E05ZKF. The contents of
IOPTS must not be modified directly between calls to E05SBF,
E05ZKF or
E05ZLF.
- 16: OPTS() – REAL (KIND=nag_wp) arrayCommunication Array
-
Note: the contents of
OPTS must not have been altered between calls to
E05ZKF,
E05ZLF, E05SBF and the selected problem solving routine.
On entry: optional parameter array as generated and possibly modified by calls to
E05ZKF. The contents of
OPTS must not be modified directly between calls to E05SBF,
E05ZKF or
E05ZLF.
- 17: IUSER() – INTEGER arrayUser Workspace
-
IUSER is not used by E05SBF, but is passed directly to
OBJFUN,
CONFUN and
MONMOD and may be used to pass information to these routines as an alternative to using COMMON global variables.
With care, you may also write information back into
IUSER. This might be useful, for example, should there be a need to preserve the state of a random number generator.
With SMP-enabled versions of E05SBF the array
IUSER provided are classified as OpenMP shared memory. Use of
IUSER has to take account of this in order to preserve thread safety whenever information is written back to either of these arrays.
- 18: RUSER() – REAL (KIND=nag_wp) arrayUser Workspace
-
RUSER is not used by E05SBF, but is passed directly to
OBJFUN,
CONFUN and
MONMOD and may be used to pass information to these routines as an alternative to using COMMON global variables.
With care, you may also write information back into
RUSER. This might be useful, for example, should there be a need to preserve the state of a random number generator.
With SMP-enabled versions of E05SBF the array
RUSER provided are classified as OpenMP shared memory. Use of
RUSER has to take account of this in order to preserve thread safety whenever information is written back to either of these arrays.
- 19: ITT() – INTEGER arrayOutput
On exit: integer iteration counters for E05SBF.
- Number of complete iterations.
- Number of complete iterations without improvement to the current optimum.
- Number of particles converged to the current optimum.
- Number of improvements to the optimum.
- Number of function evaluations performed.
- Number of particles reset.
- Number of violated constraints at completion. Note this is always calculated using the norm and a nonzero result does not necessarily mean that the algorithm did not find a suitably constrained point with respect to the single norm used.
- 20: INFORM – INTEGEROutput
On exit: indicates which finalization criterion was reached. The possible values of
INFORM are:
INFORM | Meaning |
| Exit from a user-supplied subroutine. |
0 | E05SBF has detected an error and terminated. |
1 | The provided objective target has been achieved. (Target Objective Value). |
2 | The standard deviation of the location of all the particles is below the set threshold (Swarm Standard Deviation). If the solution returned is not satisfactory, you may try setting a smaller value of Swarm Standard Deviation, or try adjusting the options governing the repulsive phase (Repulsion Initialize, Repulsion Finalize). |
3 | The total number of particles converged (Maximum Particles Converged) to the current global optimum has reached the set limit. This is the number of particles which have moved to a distance less than Distance Tolerance from the optimum with regard to the norm. If the solution is not satisfactory, you may consider lowering the Distance Tolerance. However, this may hinder the global search capability of the algorithm. |
4 | The maximum number of iterations without improvement (Maximum Iterations Static) has been reached, and the required number of particles (Maximum Iterations Static Particles) have converged to the current optimum. Increasing either of these options will allow the algorithm to continue searching for longer. Alternatively if the solution is not satisfactory, re-starting the application several times with may lead to an improved solution. |
5 | The maximum number of iterations (Maximum Iterations Completed) has been reached. If the number of iterations since improvement is small, then a better solution may be found by increasing this limit, or by using the option Local Minimizer with corresponding exterior options. Otherwise if the solution is not satisfactory, you may try re-running the application several times with and a lower iteration limit, or adjusting the options governing the repulsive phase (Repulsion Initialize, Repulsion Finalize). |
6 | The maximum allowed number of function evaluations (Maximum Function Evaluations) has been reached. As with , increasing this limit if the number of iterations without improvement is small, or decreasing this limit and running the algorithm multiple times with , may provide a superior result. |
7 | A feasible point has been found. The objective has not been minimized, although it has been evaluated at the final solutions given in XB and XBEST (). |
If you wish to continue from the final position gained from a previous simulation with adjusted options, you may set the option
, and pass back in the returned arrays
XBEST,
FBEST, and
CBEST. You should either record the returned values of
XB,
FB and
CB for comparison, as these will not be re-used by the algorithm, or include them in
XBEST,
FBEST and
CBEST respectively by overwriting the entries corresponding to one particle with the relevant information.
- 21: IFAIL – INTEGERInput/Output
On entry:
IFAIL must be set to
,
. If you are unfamiliar with this parameter you should refer to
Section 3.3 in the Essential Introduction for details.
On exit: the most common exit will be
.
For this reason, the value
is recommended. If the output of error messages is undesirable, then the value
is recommended; otherwise, the recommended value is
.
When the value is used it is essential to test the value of IFAIL on exit.
E05SBF returns if and only if a finalization criterion has been reached which can guarantee success. This may only happen if:
(i) |
The option Target Objective Value has been set and has been reached at a sufficiently constrained point within the search domain. |
(ii) |
The option has been set, and a sufficiently constrained point has been found within the search domain. |
These finalization criteria are not active using default option settings, and must be explicitly set using
E05ZKF if required.
E05SBF will return if no error has been detected, and a finalization criterion has been achieved which cannot guarantee success. This does not indicate that the routine has failed, merely that the returned solution cannot be guaranteed to be the true global optimum.
The value of
INFORM should be examined to determine which finalization criterion was reached.
Other positive values of
IFAIL indicate that either an error or a warning has been triggered. See
Sections 6,
7 and
10 for more information.
6 Error Indicators and Warnings
If on entry
or
, explanatory error messages are output on the current error message unit (as defined by
X04AAF).
Note: E05SBF may return useful information for one or more of the following detected errors or warnings.
Errors or warnings detected by the routine:
The algorithm has reached a finalization criterion that does not guarantee success. You should investigate the returned value of
INFORM for more information on why this occurred.
If the option
Target Warning has been activated, this indicates that the
Target Objective Value has been achieved to specified tolerances at a sufficiently constrained point, either during the initialization phase, or during the first two iterations of the algorithm. While this is not necessarily an error, it may occur if:
(i) |
The target was achieved at the first point sampled by the routine. This will be the mean of the lower and upper bounds. |
(ii) |
The target may have been achieved at a randomly generated sample point. This will always be a possibility provided that the domain under investigation contains a point with a target objective value which is sufficiently constrained. |
(iii) |
If the Local Minimizer has been set, then a sample point may have been inside the basin of attraction of a satisfactory point. If this occurs repeatedly when the routine is called, it may imply that the objective is largely unimodal, and that it may be more efficient to use the routine selected as the Local Minimizer directly. |
(iv) |
If has been set, a particle supplied in XBEST with corresponding cognitive memory supplied in FBEST and CBEST satisfies the required target. If on entry, the array index corresponding to the first particle to satisfy the target will be returned in the error message. You should verify that the provided values are correct, and if required set a lower Target Objective Value, or lower Constraint Tolerance. |
Assuming that
OBJFUN and
CONFUN are correct, you may wish to set a better
Target Objective Value, a stricter
Constraint Tolerance, or a stricter
Target Objective Tolerance.
You requested an exit from either
OBJFUN,
CONFUN or
MONMOD. The exit flag you provided will be returned in
INFORM.
After the algorithm had completed, the best point found did not satisfy the general constraints to the requested scaled
Constraint Tolerance. This exit may be suppressed using the option
Constraint Warning.
On entry, | , where num_threads is the value returned by the OpenMP environment variable OMP_NUM_THREADS, or num_threads is for a serial version of this routine. |
On entry, at least one lower bound , for , or all of the bounds , for .
On entry,
and the subroutine E05SZM has been passed to E05SBF as
CONFUN.
On entry, and the option has been set.
On entry, either the option arrays
IOPTS and
OPTS have not been initialized, or they have been corrupted. Re-initialize the arrays using
E05ZKF.
Alternatively, both
Advance Cognitive and
Advance Global may have been set to
.
The gradient check has indicated an error may be present in the objective gradient, or the gradients of the constraints. These checks are not infallible. If you are sure your gradients are correct then the gradient checks may be disabled by setting .
(SMP parallel version only). Multiple threads have been detected, however you have not set the option
SMP Callback Thread Safe to declare that the provided callback routines are thread-safe, or that you want the algorithm to run in serial. See
Section 11.2 for more information.
7 Accuracy
If
(or
) or
on exit, a criterion will have been reached depending on user selected options. As with all global optimization software, the solution achieved may not be the true global optimum. Various options allow for either greater search diversity or faster convergence to a (local) optimum (See
Sections 10 and
11).
Provided the objective function and constraints are sufficiently well behaved, if a local minimizer is used in conjunction with E05SBF, then it is more likely that the final result will at least be in the near vicinity of a local optimum, and due to the global search characteristics of the particle swarm, this solution should be superior to many other local optima.
Caution should be used in accelerating the rate of convergence, as with faster convergence, less of the domain will remain searchable by the swarm, making it increasingly difficult for the algorithm to detect the basins of attraction of superior local optima. Using the options
Repulsion Initialize and
Repulsion Finalize described in
Section 11 will help to overcome this, by causing the swarm to diverge away from the current optimum once no more local improvement is likely.
On successful exit with guaranteed success,
(or
). This may happen if a
Target Objective Value is assigned and is reached by the algorithm at a satisfactorily constrained point. It will also occur if a constrained point is found when
is set.
On successful exit without guaranteed success, is returned. This will happen if another finalization criterion is achieved without the detection of an error.
In both cases, the value of
INFORM provides further information as to the cause of the exit.
The memory used by E05SBF is relatively static throughout. Indeed, most of the memory required is used to store the current particle locations, the cognitive particle memories, the particle velocities and the particle weights. As such, E05SBF may be used in problems with high dimension number () without the concern of computational resource exhaustion, although the probability of successfully locating the global optimum will decrease dramatically with the increase in dimensionality.
Due to the stochastic nature of the algorithm, the result will vary over multiple runs. This is particularly true if parameters and options are chosen to accelerate convergence at the expense of the global search. However, the option may be set to initialize the internal random number generator using a preset seed, which will result in identical solutions being obtained.
(For SMP users only) The option
will use preset seeds to initialize the random number generator on each thread, however due to the unpredictable nature of parallel communication, this cannot ensure repeatable results when running on multiple threads, even with
SMP Thread Overrun set to force synchronization every iteration.
9 Example
This example uses a particle swarm to find the global minimum of the
dimensional Schwefel function:
subject to the constraints:
The global optimum has an objective value of , located at . Only the third constraint is active at this point.
The example demonstrates how to initialize and set the options arrays using
E05ZKF, how to query options using
E05ZLF, and finally how to search for the global optimum using E05SBF. The problem is solved twice, first using E05SBF alone, and secondly by coupling E05SBF with
E04UCF/E04UCA as a dedicated local minimizer. In both cases the default option
is used to produce repeatable solutions.
Note: for users of the NAG Library for SMP & Multicore the following example program does not include the setting of the optional parameter
SMP Callback Thread Safe, and as such if run on multiple threads it will issue an error message.
9.1 Program Text
Program Text (e05sbfe.f90)
9.2 Program Data
None.
9.3 Program Results
Program Results (e05sbfe.r)
10 Algorithmic Details
The following pseudo-code describes the algorithm used with the repulsion mechanism.
The definition of terms used in the above pseudo-code are as follows.
|
the number of particles, NPAR |
|
array of NDIM lower box bounds |
|
array of NDIM upper box bounds |
|
position of particle |
|
best position found by particle |
|
best position found by any particle |
|
|
|
, best value found by particle |
|
, best value found by any particle |
|
th (scaled) constraint violation at , evaluated as ; this may be scaled by the maximum th constraint found thus far |
|
the array of NCON constraint violations, , for , at a point |
|
, the array of constraint violations evaluated at |
|
, the array of constraint violations evaluated at |
|
, the array of constraint violations evaluated at |
|
velocity of particle |
|
weight on for velocity update, decreasing according to Weight Decrease |
|
maximum absolute velocity, dependent upon Maximum Variable Velocity |
|
swarm iteration counter |
|
iterations since was updated |
|
objective function scaling defined by the options Constraint Scaling, Objective Scaling and Objective Scale. |
, |
diagonal matrices with random elements in range |
|
the cognitive advance coefficient which weights velocity towards , adjusted using Advance Cognitive |
|
the global advance coefficient which weights velocity towards , adjusted using Advance Global |
|
the Distance Tolerance for resetting a converged particle |
|
an array of random numbers whose -th element is drawn from a uniform distribution in the range , for |
|
local optimizer interior options |
|
local optimizer exterior options |
|
a function of designed to increasingly weight towards minimizing constraint violations as decreases |
|
apply local optimizer using the set of options using the solution as the starting point, if used (not default) |
MONMOD |
monitor progress and possibly modify |
BOUNDARY |
apply required behaviour for outside bounding box, (see Boundary) |
new () |
true if , , were updated at this iteration |
Additionally a repulsion phase can be introduced by changing from the default values of options
Repulsion Finalize (
),
Repulsion Initialize (
) and
Repulsion Particles (
). If the number of static particles is denoted
then the following can be inserted after the new(
) check in the pseudo-code above.
10.1 Details of SMP parallelization
The algorithm has been parallelized to allow for a high degree of asynchronicity between threads. Each thread is assigned a static number of the
NPAR particles requested, and performs a sub-iteration using these particles and a private copy of
. The thread only updates this private copy if a superior solution is found.
Once a thread has completed a sub-iteration, it enters a brief critical section where it compares this private to a globally accessible version. If either is superior, the inferior version is updated and the thread continues into a new sub-iteration.
Parallelizing the algorithm in this way allows for individual threads to continue searching even if other threads are completing sub-iterations in inferior times. The optional argument
SMP Thread Overrun allows you to force a synchronization across the team of threads once one thread completes sufficiently more sub-iterations than the slowest thread. In particular, this may be used to force synchronization after every sub-iteration if so desired.
11 Optional Parameters
This section can be skipped if you wish to use the default values for all optional parameters, otherwise, the following is a list of the optional parameters available and a full description of each optional parameter is provided in
Section 11.1.
11.1 Description of the Optional Parameters
For each option, we give a summary line, a description of the optional parameter and details of constraints.
The summary line contains:
- the keywords;
- a parameter value,
where the letters , denote options that take character, integer and real values respectively;
- the default value, where the symbol is a generic notation for machine precision (see X02AJF), and represents the largest representable integer value (see X02BBF).
All options accept the value ‘DEFAULT’ in order to return single options to their default states.
Keywords and character values are case insensitive, however they must be separated by at least one space.
For E05SBF the maximum length of the parameter
CVALUE used by
E05ZLF is
.
Advance Cognitive | | Default |
The cognitive advance coefficient, . When larger than the global advance coefficient, this will cause particles to be attracted toward their previous best positions. Setting will cause E05SBF to act predominantly as a local optimizer. Setting may cause the swarm to diverge, and is generally inadvisable. At least one of the global and cognitive coefficients must be nonzero.
Advance Global | | Default |
The global advance coefficient, . When larger than the cognitive coefficient this will encourage convergence toward the best solution yet found. Values will inhibit particles overshooting the optimum. Values cause particles to fly over the optimum some of the time. Larger values can prohibit convergence. Setting will remove any attraction to the current optimum, effectively generating a Monte–Carlo multi-start optimization algorithm. At least one of the global and cognitive coefficients must be nonzero.
Boundary | | Default |
Determines the behaviour if particles leave the domain described by the box bounds. This only affects the general PSO algorithm, and will not pass down to any NAG local minimizers chosen.
This option is only effective in those dimensions for which , .
- IGNORE
- The box bounds are ignored. The objective function is still evaluated at the new particle position.
- RESET
- The particle is re-initialized inside the domain. , and are not affected.
- FLOATING
- The particle position remains the same, however the objective function will not be evaluated at the next iteration. The particle will probably be advected back into the domain at the next advance due to attraction by the cognitive and global memory.
- HYPERSPHERICAL
- The box bounds are wrapped around an -dimensional hypersphere. As such a particle leaving through a lower bound will immediately re-enter through the corresponding upper bound and vice versa. The standard distance between particles is also modified accordingly.
- FIXED
- The particle rests on the boundary, with the corresponding dimensional velocity set to .
Constraint Norm | | Default |
Determines with respect to which norm the constraint residuals should be constructed. These are automatically scaled with respect to
NCON as stated. For the set of (scaled) violations
, these may be,
- L1
- The norm will be used,
- L2
- The norm will be used,
- L2SQ
- The square of the norm will be used,
- LMAX
- The norm will be used,
Constraint Scale Maximum | | Default |
Internally, each constraint violation is scaled with respect to the maximum violation yet achieved for that constraint. This option acts as a ceiling for this scale.
Constraint:
.
Constraint Scaling | | Default |
Determines whether to scale the constraints and objective function when constructing the penalty function.
- OFF
- Neither the constraint violations nor the objective will be scaled automatically. This should only be used if the constraints and objective are similarly scaled everywhere throughout the domain.
- INITIAL
- The maximum of the initial cognitive memories, and , will be used to scale the objective function and constraint violations respectively.
- ADAPTIVE
- Initially, the maximum of the initial cognitive memories, and , will be used to scale the objective function and constraint violations respectively. If a significant change is detected in the behaviour of the constraints or the objective, these will be rescaled with respect to the current state of the cognitive memory.
Constraint Superiority | | Default |
The minimum scaled improvement in the constraint violation for a location to be immediately superior to that in memory, regardless of the objective value.
Constraint:
.
Constraint Tolerance | | Default |
The maximum scaled violation of the constraints for which a sample particle is considered comparable to the current global optimum. Should this not be exceeded, then the current global optimum will be updated if the value of the objective function of the sample particle is superior.
Constraint Warning | | Default |
Activates or deactivates the error exit associated with the inability to completely satisfy all constraints, . It is advisable to deactivate this option if on entry and the satisfaction of all constraints is not program critical.
- OFF
- No error will be returned.
- ON
- An error will be returned if any constraints are sufficiently violated at the end of the simulation.
Distance Scaling | | Default |
Determines whether distances should be scaled by box widths.
- ON
- When a distance is calculated between and , a scaled norm is used.
- OFF
- Distances are calculated as the standard norm without any rescaling.
Distance Tolerance | | Default |
This is the distance, between particles and the global optimum which must be reached for the particle to be considered converged, i.e., that any subsequent movement of such a particle cannot significantly alter the global optimum. Once achieved the particle is reset into the box bounds to continue searching.
Constraint:
.
Function Precision | | Default |
The parameter defines , which is intended to be a measure of the accuracy with which the problem function can be computed. If or , the default value is used.
The value of
should reflect the relative precision of
; i.e.,
acts as a relative precision when
is large, and as an absolute precision when
is small. For example, if
is typically of order
and the first six significant digits are known to be correct, an appropriate value for
would be
. In contrast, if
is typically of order
and the first six significant digits are known to be correct, an appropriate value for
would be
. The choice of
can be quite complicated for badly scaled problems; see Chapter 8 of
Gill et al. (1981) for a discussion of scaling techniques. The default value is appropriate for most simple functions that are computed with full accuracy. However when the accuracy of the computed function values is known to be significantly worse than full precision, the value of
should be large enough so that no attempt will be made to distinguish between function values that differ by less than the error inherent in the calculation.
Local Boundary Restriction | | Default |
Contracts the box boundaries used by a box constrained local minimizer to,
, containing the start point
, where
Smaller values of
thereby restrict the size of the domain exposed to the local minimizer, possibly reducing the amount of work done by the local minimizer.
Constraint:
.
Local Interior Iterations | | |
Local Interior Major Iterations | | |
Local Exterior Iterations | | |
Local Exterior Major Iterations | | |
The maximum number of iterations or function evaluations the chosen local minimizer will perform inside (outside) the main loop if applicable. For the NAG minimizers these correspond to:
Unless set, these are functions of the parameters passed to E05SBF.
Setting will disable the local minimizer in the corresponding algorithmic region. For example, setting and will cause the algorithm to perform no local minimizations inside the main loop of the algorithm, and a local minimization with upto iterations after the main loop has been exited.
Note: currently
E04JYF or
E04KZF are restricted to using
and
as function evaluation limits respectively. This applies to both local minimizations inside and outside the main loop. They may still be deactivated in either phase by setting
, and may subsequently be reactivated in either phase by setting
.
Constraint:
, .
Local Interior Tolerance | | Default |
Local Exterior Tolerance | | Default |
This is the tolerance provided to a local minimizer in the interior (exterior) of the main loop of the algorithm.
Constraint:
, .
Local Interior Minor Iterations | | |
Local Exterior Minor Iterations | | |
Where applicable, the secondary number of iterations the chosen local minimizer will use inside (outside) the main loop. Currently the relevant default values are:
Constraint:
, .
Local Minimizer | | Default |
Allows for a choice of
Chapter E04 routines to be used as a coupled, dedicated local minimizer.
- OFF
- No local minimization will be performed in either the INTERIOR or EXTERIOR sections of the algorithm.
- E04CBF
- Use E04CBF as the local minimizer. This does not require the calculation of derivatives.
On a call to
OBJFUN during a local minimization,
.
- E04KZF
- Use E04KZF as the local minimizer. This requires the calculation of derivatives in OBJFUN, as indicated by MODE.
The box bounds forwarded to this routine from E05SBF will have been acted upon by
Local Boundary Restriction. As such, the domain exposed may be greatly smaller than that provided to E05SBF.
Accurate derivatives must be provided to this routine, and will not be approximated internally. Each iteration of this local minimizer also requires the calculation of both the objective function and its derivative. Hence on a call to
OBJFUN during a local minimization,
.
- E04JYF
- Use E04JYF as the local minimizer. This does not require the calculation of derivatives.
On a call to
OBJFUN during a local minimization,
.
The box bounds forwarded to this routine from E05SBF will have been acted upon by
Local Boundary Restriction. As such, the domain exposed may be greatly smaller than that provided to E05SBF.
- E04DGF
E04DGA
- Use E04DGA as the local minimizer.
Accurate derivatives must be provided, and will not be approximated internally. Additionally, each call to
OBJFUN during a local minimization will require either the objective to be evaluated alone, or both the objective and its gradient to be evaluated. Hence on a call to
OBJFUN,
or
.
- E04UCF
E04UCA
- Use E04UCA as the local minimizer.
This operates such that any derivatives of either the objective function or the constraint Jacobian, which you cannot supply, will be approximated internally using finite differences.
Either, the objective, objective gradient, or both may be requested during a local minimization, and as such on a call to
OBJFUN,
,
or
.
The box bounds forwarded to this routine from E05SBF will have been acted upon by
Local Boundary Restriction. As such, the domain exposed may be greatly smaller than that provided to E05SBF.
Maximum Function Evaluations | | Default |
The maximum number of evaluations of the objective function. When reached this will return and .
Constraint:
.
Maximum Iterations Completed | | Default |
The maximum number of complete iterations that may be performed. Once exceeded E05SBF will exit with and .
Unless set, this adapts to the parameters passed to E05SBF.
Constraint:
.
Maximum Iterations Static | | Default |
The maximum number of iterations without any improvement to the current global optimum. If exceeded E05SBF will exit with
and
. This exit will be hindered by setting
Maximum Iterations Static Particles to larger values.
Constraint:
.
Maximum Iterations Static Particles | | Default |
The minimum number of particles that must have converged to the current optimum before the routine may exit due to
Maximum Iterations Static with
and
.
Constraint:
.
Maximum Particles Converged | | Default |
The maximum number of particles that may converge to the current optimum. When achieved, E05SBF will exit with and . This exit will be hindered by setting ‘Repulsion’ options, as these cause the swarm to re-expand.
Constraint:
.
Maximum Particles Reset | | Default |
The maximum number of particles that may be reset after converging to the current optimum. Once achieved no further particles will be reset, and any particles within
Distance Tolerance of the global optimum will continue to evolve as normal.
Constraint:
.
Maximum Variable Velocity | | Default |
Along any dimension , the absolute velocity is bounded above by . Very low values will greatly increase convergence time. There is no upper limit, although larger values will allow more particles to be advected out of the box bounds, and values greater than may cause significant and potentially unrecoverable swarm divergence.
Constraint:
.
Objective Scale | | Default |
The initial scale for the objective function. This will remain fixed if is selected.
Objective Scaling | | Default |
The method of (re)scaling applied to the objective function when the routine detects a significant difference between the scale and the global and cognitive memory (
and
). This only has an effect when
and
Constraint Scaling is active.
- MAXIMUM
- The objective is rescaled with respect to the maximum absolute value of the objective in the cognitive and global memory.
- MEAN
- The objective is rescaled with respect to the mean absolute value of the objective in the cognitive and global memory.
- USER
- The scale remains fixed at the value set using Objective Scale.
Optimize | | Default |
Determines whether to maximize or minimize the objective function, or ignore the objective and search for a constrained point.
- MINIMIZE
- The objective function will be minimized.
- MAXIMIZE
- The objective function will be maximized. This is accomplished by minimizing the negative of the objective.
- CONSTRAINTS
- The objective function will be ignored, and the algorithm will attempt to find a feasible point given the provided constraints. The objective function will be evaluated at the best point found with regards to constraint violations, and the final positions returned in XBEST. The objective will be calculated at the best point found in terms of constraints only. Should a constrained point be found, E05SBF will exit with and .
Constraint:
if , is required.
Repeatability | | Default |
Allows for the same random number generator seed to be used for every call to E05SBF.
is recommended in general.
- OFF
- The internal generation of random numbers will be nonrepeatable.
- ON
- The same seed will be used.
Repulsion Finalize | | Default |
The number of iterations performed in a repulsive phase before re-contraction. This allows a re-diversified swarm to contract back toward the current optimum, allowing for a finer search of the near optimum space.
Constraint:
.
Repulsion Initialize | | Default |
The number of iterations without any improvement to the global optimum before the algorithm begins a repulsive phase. This phase allows the particle swarm to re-expand away from the current optimum, allowing more of the domain to be investigated. The repulsive phase is automatically ended if a superior optimum is found.
Constraint:
.
Repulsion Particles | | Default |
The number of particles required to have converged to the current optimum before any repulsive phase may be initialized. This will prevent repulsion before a satisfactory search of the near optimum area has been performed, which may happen for large dimensional problems.
Constraint:
.
Used to affect the initialization of the routine.
- COLD
- The random number generators and all initialization data will be generated internally. The variables XBEST, FBEST and CBEST need not be set.
- WARM
- You must supply the initial best location, function and constraint violation values XBEST, FBEST and CBEST. This option is recommended if you already have a data set you wish to improve upon.
Swarm Standard Deviation | | Default |
The target standard deviation of the particle distances from the current optimum. Once the standard deviation is below this level, E05SBF will exit with and . This criterion will be penalized by the use of ‘Repulsion’ options, as these cause the swarm to re-expand, increasing the standard deviation of the particle distances from the best point.
In SMP parallel implementations of E05SBF, the standard deviation will be calculated based only on the particles local to the particular thread that checks for finalization. Considerably fewer particles may be used in this calculation than when the algorithm is run in serial. It is therefore recommended that you provide a smaller value of
Swarm Standard Deviation when running in parallel than when running in serial.
Constraint:
.
Target Objective | | Default |
Target Objective Value | | Default |
Activate or deactivate the use of a target value as a finalization criterion. If active, then once the supplied target value for the objective function is found (beyond the first iteration if
Target Warning is active) E05SBF will exit with
and
. Other than checking for feasibility only (
), this is the only finalization criterion that guarantees that the algorithm has been successful. If the target value was achieved at the initialization phase or first iteration and
Target Warning is active, E05SBF will exit with
. This option may take any real value
, or the character ON/OFF as well as DEFAULT. If this option is queried using
E05ZLF, the current value of
will be returned in
RVALUE, and
CVALUE will indicate whether this option is ON or OFF. The behaviour of the option is as follows:
- Once a point is found with an objective value within the Target Objective Tolerance of , E05SBF will exit successfully with and .
- OFF
- The current value of will remain stored, however it will not be used as a finalization criterion.
- ON
- The current value of stored will be used as a finalization criterion.
- DEFAULT
- The stored value of will be reset to its default value (), and this finalization criterion will be deactivated.
Target Objective Safeguard | | Default |
If you have given a target objective value to reach in
(the value of the optional parameter
Target Objective Value),
sets your desired safeguarded termination tolerance, for when
is close to zero.
Constraint:
.
Target Objective Tolerance | | Default |
The optional tolerance to a user-specified target value.
Constraint:
.
Target Warning | | Default |
Activates or deactivates the error exit associated with the target value being achieved before entry into the main loop of the algorithm, .
- OFF
- No error will be returned, and the routine will exit normally.
- ON
- An error will be returned if the target objective is reached prematurely, and the routine will exit with .
Verify Gradients | | Default |
Adjusts the level of gradient checking performed when gradients are required. Gradient checks are only performed on the first call to the chosen local minimizer if it requires gradients. There is no guarantee that the gradient check will be correct, as the finite differences used in the gradient check are themselves subject to inaccuracies.
- OFF
- No gradient checking will be performed.
- ON
- A cheap gradient check will be performed on both the gradients corresponding to the objective through OBJFUN and those provided via the constraint Jacobian through CONFUN.
- OBJECTIVE
- A more expensive gradient check will be performed on the gradients corresponding to the objective OBJFUN. The gradients of the constraints will not be checked.
- CONSTRAINTS
- A more expensive check will be performed on the elements of CJAC provided via CONFUN. The objective gradient will not be checked.
- FULL
- A more expensive check will be performed on both the gradient of the objective and the constraint Jacobian.
Weight Decrease | | Default |
Determines how particle weights decrease.
- OFF
- Weights do not decrease.
- INTEREST
- Weights decrease through compound interest as , where is the Weight Value and is the current number of iterations.
- LINEAR
- Weights decrease linearly following , where is the iteration number and is the maximum number of iterations as set by Maximum Iterations Completed.
Weight Initial | | Default |
The initial value of any particle's inertial weight, , or the minimum possible initial value if initial weights are randomized. When set, this will override or , and as such these must be set afterwards if so desired.
Constraint:
.
Weight Initialize | | Default |
Determines how the initial weights are distributed.
- INITIAL
- All weights are initialized at the initial weight, , if set. If Weight Initial has not been set, this will be the maximum weight, .
- MAXIMUM
- All weights are initialized at the maximum weight, .
- RANDOMIZED
- Weights are uniformly distributed in or if Weight Initial has been set.
Weight Maximum | | Default |
The maximum particle weight, .
Constraint:
(If has been set then .)
Weight Minimum | | Default |
The minimum achievable weight of any particle, . Once achieved, no further weight reduction is possible.
Constraint:
(If has been set then .)
Weight Reset | | Default |
Determines how particle weights are re-initialized.
- INITIAL
- Weights are re-initialized at the initial weight if set. If Weight Initial has not been set, this will be the maximum weight.
- MAXIMUM
- Weights are re-initialized at the maximum weight.
- RANDOMIZED
- Weights are uniformly distributed in or if Weight Initial has been set.
Weight Value | | Default |
The constant used with .
Constraint:
.
11.2 Description of the SMP optional parameters
This section details additional options available to users of the NAG Library for SMP & Multicore. In particular it includes the option
SMP Callback Thread Safe, which must be set before calling E05SBF with multiple threads.
SMP Callback Thread Safe | | Default |
Declare that the callback routines you provide are or are not thread safe. In particular, this indicates that access to the shared memory arrays
IUSER and
RUSER from within your provided callbacks is done in a thread-safe manner. If these arrays are just used to pass constant data, then you may assume they are thread safe. If these are also used for workspace, or passing variable data such as random number generator seeds, then you must ensure these are accessed and updated safely. Whilst this can be done using OpenMP critical sections, we suggest their use is minimized to prevent unnecessary bottlenecks, and that instead individual threads have access to independent subsections of the provided arrays where possible.
- YES
- The callback routines have been programmed in a thread safe way. The algorithm will use OMP_NUM_THREADS threads.
- NO
- The callback routines are not thread safe. Setting this option will force the algorithm to run on a single thread only, and is advisable only for debugging purposes, or if you wish to parallelize your callback functions.
- WARNING
- This will cause an immediate exit from E05SBF with if multiple threads are detected. This is to inform you that you have not declared the callback functions either to be thread safe, or that they are thread unsafe and you wish the algorithm to run in serial.
SMP Local Minimizer External | | Default |
Determines how many threads will attempt to locally minimize the best found solution after the routine has exited the main loop.
- MASTER
- Only the master thread will attempt to find any improvement. The local minimization will be launched from the best known solution. All other threads will remain effectively idle.
- ALL
- The master thread will perform a local minimization from the best known solution, while all other threads will perform a local minimization from randomly generated perturbations of the best known solution, increasing the chance of an improvement. Assuming all local minimizations will take approximately the same amount of computation, this will be effectively free in terms of real time. It will however increase the number of function evaluations performed.
SMP Monitor | | Default |
Determines whether the user-supplied function
MONMOD is invoked once every sub-iteration each thread performs, or only once by a single thread after all threads have completed at least one sub-iteration.
- SINGLE
- Only one thread will invoke MONMOD, after all threads have performed at least one sub-iteration.
- ALL
- Each thread will invoke MONMOD each time it completes a sub-iteration. If you wish to alter X using MONMOD you should use this option, as MONMOD will only receive the arrays X, XBEST, FBEST and CBEST private to the calling thread.
Determines how many threads support a particle subswarm. This is an extra collection of particles constrained to search only within a hypercube of edge length of the best point known to an individual thread. This may improve the number of iterations required to find a provided target, particularly if no local minimizer is in use.
If , then this will be disabled on all the threads.
If , then all the threads will support a particle subswarm.
SMP Thread Overrun | | Default |
This option provides control over the level of asynchronicity present in a simulation. In particular, a barrier synchronization between all threads is performed if any thread completes sub-iterations more than the slowest thread, causing all threads to be exposed to the current best solution. Allowing asynchronous behaviour does however allow individual threads to focus on different global optimum candidates some of the time, which can inhibit convergence to unwanted sub-optima. It also allows for threads to continue searching when other threads are completing sub-iterations at a slower rate.
If , then the algorithm will force a synchronization between threads at the end of each iteration.