GAの引数NVARS​を整数値で、重複なく​入力する方法

조회 수: 8 (최근 30일)
Kazushi
Kazushi 2019년 10월 23일
답변: michio 2019년 10월 24일
MATLABのgaに関して2点質問があります。
1点目:
gaの引数をNVARS=4、INTCON=1~45(整数値)としたところ、
Each member of INTCON must not exceed the number of variables
とのエラーが出てしまいました。
この方法以外に、NVARSを1~45の整数値で入力する方法があれば教えていただきたいです。
2点目:
NVARSの各要素が重複しないようにする方法があれば教えていただきたいです。
以上、よろしくお願いします。

채택된 답변

michio
michio 2019년 10월 24일
IntCon はどの各変数に整数制約を付けるかを決める入力なので、4つの変数すべてが整数なら
IntCon = [1,2,3,4]
とすべきです。整数の範囲制約には ub, lb を使ってください。
IntCon is a vector of positive integers that contains the x components that are integer-valued. For example, if you want to restrict x(2) and x(10) to be integers, set IntCon to [2,10].

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!