trying to use a neural network in a genetic optimiser
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
hi, i have created a neural net using 6 inputs and one output, its for a project to optermize intake length and valve timings for an engine
i am happy that the network is working as i intended but i dont know how to generate a function from the network and then use this funtion in the genetic algorithm optimizer, any help would be appieciated
here is my code for the network
filename3 = 'data for network.xlsx';
%x1 = rpm
x1 = xlsread(filename3,'C4:AGW4');
%x2 = length
x2 = xlsread(filename3,'C5:AGW5');
%x3 = IVO timing
x3 = xlsread(filename3,'C6:AGW6');
%x4 = IVC timing
x4 = xlsread(filename3,'C7:AGW7');
%x5 = EVO timing
x5 = xlsread(filename3,'C8:AGW8');
%x6 = EVC timing
x6 = xlsread(filename3,'C9:AGW9');
%x = {x1;x2;x3;x4;x5;x6};
x25 = [x1;x2;x3;x4;x5;x6];
%y1 = hp
y1 = xlsread(filename3,'C10:AGW10');
net_hp = feedforwardnet(10);
net_hp = configure(net_hp,x25,y1);
net_hp = init(net_hp);
[net_hp,tr] = train(net_hp,x25,y1);
0 commentaires
Réponses (1)
Abdolkarim Mohammadi
le 28 Mar 2021
If I have understood you well, you want ga() to train your feedforward ANN. If so, you can read about it here:
3 commentaires
Abdolkarim Mohammadi
le 28 Mar 2021
Modifié(e) : Abdolkarim Mohammadi
le 28 Mar 2021
I think you have a surrogate model, that is, you have trained a network that gets inputs and returns the horsepower. If so, your job is very easy. Just put the network inside a function
function ObjectiveFunctionValue = ObjectiveFunction (x, net)
ObjectiveFunctionValue = net (x);
end
and pass it as the objective function to ga() or anything else. For example:
fun = @ (x) ObjectiveFunction (x, net);
nvars = % number of decision variables (inputs of the network)
[x, fval] = ga (fun, nvars);
Voir également
Catégories
En savoir plus sur Solver Outputs and Iterative Display 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!