Specify Objective Function Value as Tolerance
2 次查看(过去 30 天)
显示 更早的评论
E.g. I would like to specify that the optimization routine return a solution only if the objective function there is < 1e-12. Is there a way to include this tolerance in the problem setup? Using R2013b with global optimization toolbox.
2 个评论
回答(1 个)
Walter Roberson
2015-7-24
In particular TolFun is possibly what you are looking for.
However, before placing restrictions on the function value, keep in mind that there might not be anywhere within the defined range where the function returns a value that low, especially within the maximum number of iterations you have allowed. Trying to solve for @(x) x.^2+1 <= 1E-12 is going to take forever if you want it to keep going until it finds a solution that satisfies the constraint.
Even within a global optimizer that offers multiple starts, you can construct functions that have arbitrarily narrow "pits" where the function value is less than 1E-12. For example,
@(x) ~(x(:,1) == 0.90579193707561922455084868488484062254428863525390625 & x(:,2) == 0.12698681629350605515327288230764679610729217529296875)
will return 0 at exactly one floating point pair, and will be 1 everywhere else. You would not be able to find the right pair without enumerating every possible floating point value, which is roughly 2^64 * 2047/2048 possibilities per member . Before telling a minimizer to keep going until it meets a condition, you need to consider how hard it is going to be for that condition to be met, as you probably don't want your program running for a few decades trying to find a difficult case.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Get Started with Optimization Toolbox 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!