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) Best best  
    (package private) int chromes  
    (package private) double crossprob  
    (package private) java.lang.String del  
    (package private) double dif  
    (package private) double divider  
    (package private) int edges  
    (package private) java.lang.String filename  
    (package private) boolean first  
    (package private) int generations  
    (package private) java.lang.Double[] input  
    (package private) int k  
    (package private) Best lastbest  
    (package private) double max  
    (package private) double min  
    (package private) double mutprob  
    (package private) NNetwork nnet  
    (package private) java.lang.String objective  
    (package private) int outputs  
    (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.String storedmodel  
    (package private) int supergen  
    (package private) int vnfsize  
  • 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 void crossover()
    Crossover
    void genchromefit​(Chromosome h)
    Computes and store fitness of a single chromosome.
    void genfit()
    Computes and stores the fitness of each chromosome.
    void genfit1()
    Computes fitness for pop.
    void genfit2()
    Compute fitness for pop2.
    void genpop()
    Generates population randomly.
    void genpop_heur()
    Generates population heuristically.
    void init()
    Initialize Genetic Algorithm.
    void init2()
    Initialize genetic procedures.
    void initializebest()
    Initialize the object that stores the best solution in each team and group.
    void initializelastbest()
    Initialize the object that stores the best overall solution.
    private void mutation()
    Mutation
    void printbest()
    Print current generation best solution.
    void printlastbest()
    Print current overall best solution.
    void printpop()
    Prints population of the current generation.
    private void range()
    Computes the range in the fitness of the population.
    java.util.ArrayList<java.lang.Double[]> readmodel​(int vnfsize)
    Read models from database file.
    private void selection()
    Selection
    void storemodel​(java.lang.String b)
    Store model.
    void superbest​(int in)
    Stores the best solution of the current generation for the next stage of the algorithm.
    void superbest2​(int in)
    Stores the best solution of the current generation for the next stage of the algorithm.
    void updatebest()
    Update best solution.
    void updatebestmax()
    Update best solution when the objective is the maximization of fitness function.
    void updatebestmin()
    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

      public void genchromefit​(Chromosome h)
      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.