Package ga
Class GA
java.lang.Object
ga.GA
public class GA
extends java.lang.Object
Genetic Algorithm.
-
Field Summary
Fields Modifier and Type Field Description (package private) Bestbest(package private) intchromes(package private) doublecrossprob(package private) java.lang.Stringdel(package private) doubledif(package private) doubledivider(package private) intedges(package private) java.lang.Stringfilename(package private) booleanfirst(package private) intgenerations(package private) java.lang.Double[]input(package private) intk(package private) Bestlastbest(package private) doublemax(package private) doublemin(package private) doublemutprob(package private) NNetworknnet(package private) java.lang.Stringobjective(package private) intoutputs(package private) int[][]parameter_dom(package private) java.lang.String[]params(package private) Chromosome[]pop(package private) Chromosome[]pop2(package private) Chromosome[]pops(package private) Chromosome[]pops2(package private) java.lang.Stringstoredmodel(package private) intsupergen(package private) intvnfsize -
Constructor Summary
Constructors Constructor Description GA()GA(int chroms, int gnrs, int sgnrs, java.lang.String[] params, java.lang.String[] command, double crossprop, double mutprop, int[][] parameter_dom, java.lang.String objective, NNetwork nnet, java.lang.Double[] input, int edges, int outputs, int vnfsize)GA(int chroms, int gnrs, int sgnrs, java.lang.String[] params, java.lang.String[] command, double crossprop, double mutprop, int[][] parameter_dom, java.lang.String objective, NNetwork nnet, java.lang.String filename, java.lang.String del, int edges, int outputs) -
Method Summary
Modifier and Type Method Description private voidcrossover()Crossovervoidgenchromefit(Chromosome h)Computes and store fitness of a single chromosome.voidgenfit()Computes and stores the fitness of each chromosome.voidgenfit1()Computes fitness for pop.voidgenfit2()Compute fitness for pop2.voidgenpop()Generates population randomly.voidgenpop_heur()Generates population heuristically.voidinit()Initialize Genetic Algorithm.voidinit2()Initialize genetic procedures.voidinitializebest()Initialize the object that stores the best solution in each team and group.voidinitializelastbest()Initialize the object that stores the best overall solution.private voidmutation()Mutationvoidprintbest()Print current generation best solution.voidprintlastbest()Print current overall best solution.voidprintpop()Prints population of the current generation.private voidrange()Computes the range in the fitness of the population.java.util.ArrayList<java.lang.Double[]>readmodel(int vnfsize)Read models from database file.private voidselection()Selectionvoidstoremodel(java.lang.String b)Store model.voidsuperbest(int in)Stores the best solution of the current generation for the next stage of the algorithm.voidsuperbest2(int in)Stores the best solution of the current generation for the next stage of the algorithm.voidupdatebest()Update best solution.voidupdatebestmax()Update best solution when the objective is the maximization of fitness function.voidupdatebestmin()Update best solution when the objective is the minimization of fitness function.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
chromes
int chromes -
generations
int generations -
supergen
int supergen -
nnet
NNetwork nnet -
pop
Chromosome[] pop -
pop2
Chromosome[] pop2 -
pops
Chromosome[] pops -
pops2
Chromosome[] pops2 -
k
int k -
params
java.lang.String[] params -
parameter_dom
int[][] parameter_dom -
objective
java.lang.String objective -
best
Best best -
lastbest
Best lastbest -
min
double min -
max
double max -
dif
double dif -
crossprob
double crossprob -
mutprob
double mutprob -
first
boolean first -
divider
double divider -
edges
int edges -
outputs
int outputs -
input
java.lang.Double[] input -
storedmodel
java.lang.String storedmodel -
vnfsize
int vnfsize -
filename
java.lang.String filename -
del
java.lang.String del
-
-
Constructor Details
-
GA
public GA(int chroms, int gnrs, int sgnrs, java.lang.String[] params, java.lang.String[] command, double crossprop, double mutprop, int[][] parameter_dom, java.lang.String objective, NNetwork nnet, java.lang.String filename, java.lang.String del, int edges, int outputs) -
GA
public GA(int chroms, int gnrs, int sgnrs, java.lang.String[] params, java.lang.String[] command, double crossprop, double mutprop, int[][] parameter_dom, java.lang.String objective, NNetwork nnet, java.lang.Double[] input, int edges, int outputs, int vnfsize) -
GA
public GA()
-
-
Method Details
-
init
public void init()Initialize Genetic Algorithm. -
init2
public void init2()Initialize genetic procedures. -
selection
private void selection()Selection -
crossover
private void crossover()Crossover -
mutation
private void mutation()Mutation -
genpop
public void genpop()Generates population randomly. -
genpop_heur
public void genpop_heur()Generates population heuristically. -
readmodel
public java.util.ArrayList<java.lang.Double[]> readmodel(int vnfsize)Read models from database file. -
initializebest
public void initializebest()Initialize the object that stores the best solution in each team and group. -
initializelastbest
public void initializelastbest()Initialize the object that stores the best overall solution. -
printpop
public void printpop()Prints population of the current generation. -
superbest
public void superbest(int in)Stores the best solution of the current generation for the next stage of the algorithm. -
superbest2
public void superbest2(int in)Stores the best solution of the current generation for the next stage of the algorithm. -
genfit
public void genfit()Computes and stores the fitness of each chromosome. -
genfit1
public void genfit1()Computes fitness for pop. -
genfit2
public void genfit2()Compute fitness for pop2. -
genchromefit
Computes and store fitness of a single chromosome. -
range
private void range()Computes the range in the fitness of the population. -
updatebest
public void updatebest()Update best solution. -
updatebestmin
public void updatebestmin()Update best solution when the objective is the minimization of fitness function. -
updatebestmax
public void updatebestmax()Update best solution when the objective is the maximization of fitness function. -
printlastbest
public void printlastbest()Print current overall best solution. -
printbest
public void printbest()Print current generation best solution. -
storemodel
public void storemodel(java.lang.String b)Store model.
-