Which solver can be used for a non linear curve fitting with some variables being constrained to integers?
2 次查看(过去 30 天)
显示 更早的评论
I have a non linear curve fitting problem, say e^(x1+x2)-y=0, where x1,x2 are variables and y is the data against which fitting is done. Here x1 should be an integer and x2 can be a non integer. Which solver can handle such problems?
0 个评论
采纳的回答
Alan Weiss
2016-8-23
If you really have the equation you gave as an example, then I would use
x = x1 + x2
meaning just fit a continuous x variable, and afterwards take
x1 = floor(x);
x2 = x - x1;
If, however, you have a general nonlinear fit with a variable constrained to be integer-valued, then the first thing that I would try is to fit it using any method you like, such as lsqcurvefit, but with no integer constraint. Then I would solve a set of problems with the integer variable set to various values close to the continuous solution.
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation
7 个评论
Walter Roberson
2016-8-27
Why is x(2)=3 a better solution than x(2)=1 or x(2)=2 ? All three of those lead to the same basic x(1) = 2 * log(5) - x(2) which meets the constraint on x(1) provided x(2) is no more than 3. There is no way for ga to tell the solutions apart.
If you are wanting to minimize x(1) such that exp(x(1)+ z(x(2)))-25=0 then you should be using gamultiobj and using x(1) as one of the objectives and (exp(x(1)+ z(x(2)))-25).^2 as your other objective.
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!