gaに関して発生したerrorについて
    5 vues (au cours des 30 derniers jours)
  
       Afficher commentaires plus anciens
    
    yokoyama
 le 5 Déc 2019
  
    
    
    
    
    Réponse apportée : Etsuo Maeda
    
 le 12 Déc 2019
            simulinkで構築したモデルの姿勢の最適化をするためにgaを使おうとしたら,以下のようなエラーが発生しました.
    エラー: ga (line 393)
    関数への入力引数にコロン演算子が含まれています。コロン演算子を入力するには、代わりに ':' を使用してください。
    エラー: Gatry2 (line 16)
    [X,Y]=ga(ObjectiveFunction,16,A,b,Aeq,beq,lb,ub,nonliner,ConstraintFunction,options);
このエラーの原因がどの部分で,どう書くのが正しいのか知りたいです.
以下が私の書いたgaのプログラムです.
sim('seniorCar1205ga');
ObjectiveFunction = @gatry;    %gatry:gaで最小を求めたい関数プログラム
nvars = 16;    % Number of variables
ConstraintFunction = @gatry;
lb=[0.1358 0.0997 -0.7927 -0.3667 -0.4854 -0.2115 -0.2137 -0.2013 -0.2418 -0.2096 -0.2701 -0.2798 -0.2188 -0.2144 -0.2045 -0.200005];
ub=[0.5358 0.4997 -0.3927 0.1667 -0.2854 0.2115 0.2137 0.2013 0.2418 0.2096 0.2701 0.2798 0.2188 0.2144 0.2045 0.200005];
A=[];
b=[];
Aeq=[];
beq=[];
nonliner=[];
options=optimoptions('ga','PopulationSize',24,'generations',40,'Display','iter','EliteCount',1,'PlotFcns',{@gaplotbestf},'UseParallel',true);
[X,Y]=ga(ObjectiveFunction,16,A,b,Aeq,beq,lb,ub,nonliner,ConstraintFunction,options);
0 commentaires
Réponse acceptée
  Etsuo Maeda
    
 le 12 Déc 2019
        回答がついていないようなので・・・
x = ga(fun,nvars,A,b,Aeq,beq,lb,ub,nonlcon,IntCon,options)
の構文で、IntConに関数を与えていることが原因です。
制約をかけるならnonlconに関数を与えてください。
HTH
0 commentaires
Plus de réponses (0)
Voir également
Catégories
				En savoir plus sur パフォーマンスの手動最適化 dans Help Center et File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!