In simulannealbnd solver can we use integer data type?

I want to use integer data type in simulannealbnd solver. Is there any way out to do the same?

답변 (2개)

Walter Roberson
Walter Roberson 2022년 7월 19일

1 개 추천

No, that optimizer has no way of handling discrete inputs.
If you want to experiment you could try the following strategy (that will probably not work at all well):
  • do not use a direct input variable. Instead, use an input variable with lower bound 1.0 and an upper bound 1+delta where delta = (largest desired integer minus lowest desired integer) divided by 2^53
  • set the options so that the minimum step size is eps(1)
  • inside the function take the input, subtract 1.0, multiply by 2^53 and add the minimum desired integer. The result should in theory be an integer
  • you might need to set options about function tolerance
I think this will likely not work well... but it is crazy enough that it just might work.

댓글 수: 2

Thank you for your advice.
Since integers and double are both in the input variable of my objective function, it seems difficult to set the step size respectively.
So, I first, use GA to optimize whole variables, fix integer variables by setting LB, UB, and using simulannealbnd to optimize double type variables.
But it tooks a lot of time at simulannealbnd. If I set step size at simulannealbnd, I can shorten the optimization time but I can't find how to set step size. If you know, please help.
https://www.mathworks.com/help/optim/ug/optim.problemdef.optimizationproblem.optimoptions.html
set the StepTolerance option which defaults to 1e-10
If you are using my outline of how to transform continuous into integer, then you would need about 1e-16 which would potentially take much much longer than what you have now.
Simulated annealing is slow. It does not use any gradient information to make predictions about what to try next, and does not assume continuity.

댓글을 달려면 로그인하십시오.

sejung kim
sejung kim 2022년 7월 19일

0 개 추천

I have the same question.
Have you solved it now?

카테고리

도움말 센터File Exchange에서 Simulated Annealing에 대해 자세히 알아보기

질문:

2018년 1월 17일

댓글:

2022년 7월 19일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by