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!