GA Solver en Matlab - PowerPoint PPT Presentation

About This Presentation
Title:

GA Solver en Matlab

Description:

GA Solver en Matlab GA Solver X = GA(FITNESSFCN,NVARS) finds the minimum of FITNESSFCN using GA. NVARS is the dimension (number of design variables) of the ... – PowerPoint PPT presentation

Number of Views:17
Avg rating:3.0/5.0
Slides: 10
Provided by: MiguelAng49
Category:
Tags: angel | matlab | solver

less

Transcript and Presenter's Notes

Title: GA Solver en Matlab


1
GA Solver en Matlab
2
GA Solver
  • X GA(FITNESSFCN,NVARS) finds the minimum of
    FITNESSFCN using
  • GA. NVARS is the dimension (number of design
    variables) of the
  • FITNESSFCN. FITNESSFCN accepts a vector X of
    size 1-by-NAVRS,
  • and returns a scalar evaluated at X.
  • X GA(FITNESSFCN,NAVRS,OPTIONS) finds the
    minimum for
  • FITNESSFCN with the default optimization
    parameters replaced by values
  • in the structure OPTIONS. OPTIONS can be
    created with the GAOPTIMSET
  • function.
  • X GA(PROBLEM) finds the minimum for
    PROBLEM. PROBLEM is a structure
  • that has the following fields
  • fitnessfcn ltFitness Functiongt
  • nvars ltNumber of design variablesgt
  • options ltOptions structure created
    with GAOPTIMSETgt
  • randstate ltOptional field to reset rand
    stategt
  • randnstate ltOptional field to reset
    randn stategt

3
GA Solver
  • X, FVAL GA(FITNESSFCN, ...) returns FVAL,
    the value of the fitness
  • function FITNESSFCN at the solution X.
  • X,FVAL,REASON GA(FITNESSFCN, ...) returns
    the REASON for stopping.
  • X,FVAL,REASON,OUTPUT GA(FITNESSFCN, ...)
    returns a
  • structure OUTPUT with the following
    information
  • randstate ltState of the function
    RAND used before GA startedgt
  • randnstate ltState of the function
    RANDN used before GA startedgt
  • generations ltTotal generations,
    excluding HybridFcn iterationsgt
  • funccount ltTotal function
    evaluationsgt
  • message ltGA termination messagegt
  • X,FVAL,REASON,OUTPUT,POPULATION
    GA(FITNESSFCN, ...) returns the final
  • POPULATION at termination.
  • X,FVAL,REASON,OUTPUT,POPULATION,SCORES
    GA(FITNESSFCN, ...) returns the
  • SCORES of the final POPULATION.

4
GA Solver
  • There are several steps to the GA
  • population generation
  • scoring
  • loop
  • fitness
  • scaling
  • selection
  • crossover
  • mutation
  • scoring
  • migration
  • output
  • termination testing
  • end loop
  • Each of these steps can be controlled by the
    options structure created
  • by GAOPTIMSET.

5
GA Solver
  • Example
  • Minimize 'rastriginsfcn' fitness function
    of numberOfVariables 2
  • x ga(_at_rastriginsfcn,2)
  • Display plotting functions while GA
    minimizes
  • options gaoptimset('PlotFcns',...
  • _at_gaplotbestf,_at_gaplotbestindiv,_at_gaplotexp
    ectation,_at_gaplotstopping)
  • x,fval,reason,output
    ga(_at_rastriginsfcn,2,options)

6
Opciones del algoritmo I
  • GAOPTIMSET Create a genetic algorithm options
    structure.
  • GAOPTIMSET returns a listing of the fields in
    the options structure as
  • well as valid parameters and the default
    parameter.
  • OPTIONS GAOPTIMSET('PARAM',VALUE) creates a
    structure with the
  • default parameters used for all PARAM not
    specified, and will use the
  • passed argument VALUE for the specified
    PARAM.
  • OPTIONS GAOPTIMSET('PARAM1',VALUE1,'PARAM2',
    VALUE2,....) will create a
  • structure with the default parameters used
    for all fields not specified.
  • Those FIELDS specified will be assigned the
    corresponding VALUE passed,
  • PARAM and VALUE should be passed as pairs.
  • OPTIONS GAOPTIMSET(OLDOPTS,'PARAM',VALUE)
    will create a structure named
  • OPTIONS. OPTIONS is created by altering the
    PARAM specified of OLDOPTS to
  • become the VALUE passed.
  • OPTIONS GAOPTIMSET(OLDOPTS,'PARAM1',VALUE1,'
    PARAM2',VALUE2,...) will

7
Opciones del algoritmo I
  • PopulationType - The type of Population
    being entered
  • 'bitstring' 'custom'
    'doubleVector'
  • PopInitRange - Initial range of values
    a population may have
  • Matrix 01
  • PopulationSize - Positive scalar
    indicating the number of individuals
  • positive scalar 20
  • EliteCount - Number of best
    individuals that survive to next
  • generation without any
    change
  • positive scalar 2
  • CrossoverFraction - The fraction of genes
    swapped between individuals
  • positive scalar 0.8
  • MigrationDirection - Direction that fittest
    individuals from the various
  • sub-populations may
    migrate to other sub-populations
  • 'both' 'forward'
  • MigrationInterval - The number of
    generations between the migration of
  • the fittest individuals
    to other sub-populations
  • positive scalar 20
  • MigrationFraction - Fraction of those
    individuals scoring the best

8
Opciones del algoritmo I
  • TimeLimit - The total time (in seconds)
    allowed for simulation
  • positive scalar INF
  • FitnessLimit - The lowest allowed
    score
  • scalar -Inf
  • StallGenLimit - If after this number of
    generations there is
  • no improvement, the
    simulation will end
  • positive scalar 50
  • StallTimeLimit - If after this many
    seconds there is no improvement,
  • the simulation will end
  • positive scalar 20
  • InitialPopulation - The initial population
    used in seeding the GA
  • algorithm
  • Matrix
  • InitialScores - The initial scores used
    to determine fitness used
  • in seeding the GA
    algorithm
  • column vector
  • positive scalar 1
  • CreationFcn - Function used to
    generate initial population
  • _at_gacreationuniform

9
Opciones del algoritmo I
  • SelectionFcn - Function used in selecting
    parents for next generation
  • _at_selectionremainder
    _at_selectionrandom
  • _at_selectionroulette
    _at_selectiontournament
  • _at_selectionstochunif
  • CrossoverFcn - Function used to do
    crossover
  • _at_crossoverheuristic
    _at_crossoverintermediate
  • _at_crossoversinglepoint
    _at_crossovertwopoint
  • _at_crossoverscattered
  • MutationFcn - Function used in
    mutating genes
  • _at_mutationuniform
    _at_mutationgaussian
  • HybridFcn - Another optimization
    function to be used once GA
  • has normally terminated
    (for whatever reason)
  • _at_fminsearch
    _at_patternsearch _at_fminunc
  • Display - Level of display
  • 'off' 'iter'
    'diagnose' 'final'
  • OutputFcns - Function(s) called in
    every generation. This is more
  • general than PlotFcns.
  • _at_gaoutputgen
  • PlotFcns - Function(s) used in
    plotting various quantities
Write a Comment
User Comments (0)
About PowerShow.com