fcn2optimexpr
Convert function to optimization expression
Syntax
Description
Examples
Input Arguments
Output Arguments
Limitations
Analysis
Can Ignore Noncomputational Functions
The
Analysis
algorithm might not include noncomputational functions. This aspect of the algorithm can result in the following:pause
statements are ignored.A global variable that does not affect the results can be ignored. For example, if you use a global variable, for example, to count how many times the function runs, then you might obtain a misleading count.
If the function contains a call to
rand
orrng
, the function might execute the first call only, and future calls do not set the random number stream.A
plot
call might not update a figure at all iterations.Saving data to a
mat
file or text file might not occur at every iteration.
To ensure that noncomputational functions operate as you expect, set the
Analysis
name-value argument to"off"
.
Algorithms
To find the output size of each returned expression when you do not specifyOutputSize
,fcn2optimexpr
evaluates the function at the following point for each element of the problem variables.
Variable Characteristics | Evaluation Point |
---|---|
Finite upper boundub and finite lower boundlb |
(lb + ub)/2 + ((ub - lb)/2)*eps |
Finite lower bound and no upper bound | lb + max(1,abs(lb))*eps |
Finite upper bound and no lower bound | ub - max(1,abs(ub))*eps |
是没有界限的 | 1 + eps |
Variable is specified as an integer | floor of the point given previously |
An evaluation point might lead to an error in function evaluation. To avoid this error, specify 'OutputSize
'.