フィルターのクリア

Hybrid Scheme in the Genetic Algorithm.

1 回表示 (過去 30 日間)
Ba Ba Black Sheep!
Ba Ba Black Sheep! 2017 年 1 月 5 日
回答済み: Walter Roberson 2017 年 1 月 5 日
Why doesn't neither of the following codes compile?
function genetic()
FitnessFcn = @dejong2fcn;
numberOfVariables = 2;
options = optimoptions(@ga,'PlotFcns',{@gaplotbestf,@gaplotstopping});
rng('default');
ga(FitnessFcn,numberOfVariables,[],[],[],[],[],[],[],options);
end
.
function hybrid()
fminuncOptions = optimoptions('Display','iter','Algorithm','quasi-newton');
options = optimoptions('HybridFcn',{@fminunc, fminuncOptions});
options = optimoptions(options,@ga,'PlotFcns',{@gaplotbestf,@gaplotstopping});
ga(@dejong2fcn,numberOfVariables,[],[],[],[],[],[],[],options);
end
I have written that code just like the following documentation.
Then, what is the issue?

採用された回答

Walter Roberson
Walter Roberson 2017 年 1 月 5 日
First one:
Undefined function or variable 'dejong2fcn'.
Second one: you have not properly passed the solver names in.
fminuncOptions = optimoptions(@fminunc,'Display','iter','Algorithm','quasi-newton');
options = optimoptions(@ga,'HybridFcn',{@fminunc, fminuncOptions});
options = optimoptions(options,'PlotFcns',{@gaplotbestf,@gaplotstopping});

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by