フィルターのクリア

Why doesn't particleswarm accept integer types for the nvars argument?

3 ビュー (過去 30 日間)
Matt Latourette
Matt Latourette 2022 年 10 月 27 日
コメント済み: Rajeev 2022 年 11 月 2 日
This is less of a true "question" and more of a product improvement suggestion for MATLAB. The particleswarm function is just one example of this phenomenon. There are other examples of this kind of behavior in MATLAB toolbox functions.
The nvars argument for the particleswarm function is described in the documentation as, "Number of variables, specified as a positive integer." It's intrinsically an integer value. It's not possible to have a non-integer number of variables for the function to be optimized by particleswarm. Why, then, does the particleswarm function only accept this input as a double type? I have the number of parameters stored as a uint8 in the class that represents my model, as that was a sensible representation for it. Sure, I can just typecast to double whenever I call the optimizer, but it violates the Principle of Least Astonishment to have a function that takes an argument that is intrinsically an integer but then only accept that argument in floating point format.
  1 件のコメント
Rajeev
Rajeev 2022 年 11 月 2 日
Hi Matt,
Thank you for the suggestion. I have notified my colleagues about this suggestion and they will look into it. I will inform you about it as soon as I get an update.
Thanks,
Rajeev
Associate in Engineering Development Group

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeGenetic Algorithm についてさらに検索

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by