Parameter estimation - estimate integers only
3 次查看(过去 30 天)
显示 更早的评论
Hello,
Is there any way I can use one of the optimisation solvers for parameter estimation to just estimate integers eg I am using parameter estimation to guess the gear number of a vehicle model, hence why it must be an integer.
Thank you.
回答(2 个)
Jeff Miller
2019-10-28
One way to do this is to write your objective function to return an error function that is linearly interpolated between two integers. Schematically it looks something like this;
function errCompromise = errorFn(x)
% This function receives real values of x suggested by fminsearch or some other optimization routine
xLower = floor(x);
xUpper = ceil(x);
errLower = realErrorFn(xLower);
errUpper = realErrorFn(xUpper);
errCompromise = errLower * (xUpper-x) + errUpper * (x - xLower);
function realErrorFn(x)
% Compute your error function here.
% This function will only get integer values of x
end
end
Note that x will always be driven toward xLower or xUpper, whichever gives the lower error score, and that x will cross over integer boundaries when that reduces error (because fminsearch, etc, know nothing about integer boundaries).
You can extend the same sort of idea if you have more than one integer parameter. Or try fminsearcharb , which uses this technique.
1 个评论
Matt J
2019-10-28
编辑:Matt J
2019-10-28
Note that this is only reliable, however, when used in conjunction with fminsearch and not when used with one of the Optimization Toolbox's higher-dimensional, derivative-based solvers. The scheme will violate differentiability assumptions of something like fmincon for example. Also, any additional constraints that are imposed could prevent x from being driven toward an integer-valued solution.
Matt J
2019-10-28
If your objective and constraints are linear, you can use intlinprog. Otherwise, if you have the Global Optimization Toolbox, and you have no equality constraints, you can use ga.
3 个评论
Matt J
2019-11-1
编辑:Matt J
2019-11-1
Yes, the syntax looks fine. Since you only have 2 unknown variables, can't you do a surface plot of estfcn and see approximately where the solution lies? Then you can set your bounds more tightly around that area.
If nothing else, a surface plot would be a good trouble shoooting method, letting you see if the solution that ga is finding is far from the global minimum or not. If it isn't, it would suggest a bug in your objective function, not a failure on the part of ga.
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!