Multiple objective function and constraint evaluation for OptionsMatlab
Optjob.m provides an example implementation of a broker for multiple objective function and constraint evaluations for OptionsMatlab. These evaluations are done in serial, other implementations of optjob support concurrent evaluations.
The optjob function to be used by OptionsMatlab must be set in the OPTJOB field of the structure passed to OptionsMatlab. The function name of user-defined objective function and constraint functions should be set in the OPTFUN and OPTCON fields for the structure passed to OptionsMatlab. If the OPTFUN and OPTCON fields are equal it is assumed that the objective function routine will return constraint values as the fifth output argument (see below).
The user-defined objective function called by optjob should conform to the following function prototype:
[eval,gd,H,PARAMS,CONS,U_CONS,L_CONS]=opfun(VARS,PARAMS, U_CONS,L_CONS,DATA)
The user-defined constraint function called by optjob should conform to the following function prototype:
[CONS,ceq,GC,Gceq,PARAMS,U_CONS,L_CONS]=objcon(VARS, PARAMS,U_CONS,L_CONS,DATA)
OPTJOB takes a matrix of size NJOBS by NVARS and returns a vector of function evaluations of length NJOBS. Other arguments include the names of the user-defined OPTFUN and OPTCON functions, as well as user defined parameters, constraints and upper and lower constraint limits.
The minimum required function prototype of the optjob function is:
[evals,cons] = optjob(optfunname,optconname,vars)
where the input arguments are:
optfunname: the name of the user defined objective function
optconname: the name of the user defined constraint functions
vars: the matrix of design variables size NJOBS by NVARS (where NJOBS is the number of design points to be evaluated and NVARS the number of design variables)
where the output arguments are:
evals: a vector of NJOBS function evaluations
cons: a matrix of NJOBS by NCONS constraints
The complete function prototype of the optjob function is:
[evals,cons,params,u_cons,l_cons]=optjob(optfunnam, optconnam,vars,params,cons,u_cons,l_cons,data)
as above where additional input arguments are
params: a vector of size NPARAMS of user-defined parameters
cons: a vector of NCONS constraints at the design variables to be evaluated (applies only to a single function evaluation for OPTFUN only otherwise empty)
u_cons: a vector of size NCONS of the upper limits for the user defined constraints (where there is no limit set to inf)
l_cons: a vector of size NCONS of the lower limits for the user defined constraints (where there is no limit set to -inf)
data: the user-supplied data passed unaltered from the field USERDATA of the input structure
and as above where additional output arguments are:
params: a revised vector of size NPARAMS of user defined parameters
u_cons: a revised vector of size NCONS of the upper limits for the user defined constraints
l_cons: a revised vector of size NCONS of the lower limits for the user defined constraints
The optjob Matlab function is invoked from three places with OptionsMatlab, OPTJOB, OPTFUN and OPTCON, each of these FORTRAN subroutines will use the optjob function in a different fashion.
OPTJOB: Calls the optjob Matlab function for NJOBS function (and constraint) evaluations. Passes all of the available input parameters, apart from the vector cons for which is substituted an empty array. The user-defined routine optfun must be called for each of the NJOBS designs supplied. If the problem is constrained the constraints will be can be evaluated by a combined objective/constraint function (where optfunname == optconname), or by a separate constraint function (defined by optconname). For unconstrained optimisations the argument optconname will be empty. OPTJOB requires the output arguments evals and cons to be returned, all other output arguments will be ignored.
OPTFUN: Calls the optjob Matlab function for a single function evaluation. Passes all of the available input parameters, apart from the string optconnam for which is substituted an empty string. The user-defined routine optfunname is called once. Requires the output argument evals to be returned, the cons output argument will be ignored, and the params, u_cons and l_cons output arguments will be used to update the corresponding values in the internal GENDAT database if returned.
OPTCON: Calls the optjob Matlab function for a single constraint evaluation. Passes all of the available input parameters, apart from the string optfunnam for which is substituted an empty string and the vector cons for which is substituted an empty array. The user-defined routine optconname is called once. Requires the output argument cons to be returned, the evals output argument will be ignored, and the params, u_cons and l_cons output arguments will be used to update the corresponding values in the internal GENDAT database if returned.
OptionsMatlab, createBeamStruct
Copyright © 2007, The Geodise Project, University of Southampton