Filter löschen
Filter löschen

Hybrid Scheme in the Genetic Algorithm.

1 Ansicht (letzte 30 Tage)
Ba Ba Black Sheep!
Ba Ba Black Sheep! am 5 Jan. 2017
Beantwortet: Walter Roberson am 5 Jan. 2017
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?

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 5 Jan. 2017
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});

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by