No 'FunctionTolerance' or 'TolFun' in gaoptimset

4 views (last 30 days)
K G
K G on 5 Dec 2021
Commented: K G on 5 Dec 2021
Hi!
I use Matlab 2014b with Global Optimization Toolbox installed and Windows 10.
After running the following in command window:
options = gaoptimset
I get this list of options
options =
PopulationType: 'doubleVector'
PopInitRange: [2x1 double]
PopulationSize: 20
EliteCount: 2
CrossoverFraction: 0.8000
MigrationDirection: 'forward'
MigrationInterval: 20
MigrationFraction: 0.2000
Generations: 100
TimeLimit: Inf
FitnessLimit: -Inf
StallGenLimit: 50
StallTimeLimit: 20
InitialPopulation: []
InitialScores: []
PlotInterval: 1
CreationFcn: @gacreationuniform
FitnessScalingFcn: @fitscalingrank
SelectionFcn: @selectionstochunif
CrossoverFcn: @crossoverscattered
MutationFcn: @mutationgaussian
HybridFcn: []
Display: 'final'
PlotFcns: []
OutputFcns: []
Vectorized: 'off'
with no option for function tolerance ('FunctionTolerance' or 'TolFun').
How can I run ga solver with specific value for function tolerance? How can I set its value in options struct when there is no field for this?

Accepted Answer

Walter Roberson
Walter Roberson on 5 Dec 2021
I just ran that code in the version you indicate, R2014b. I get a different result than you do:
options = gaoptimset
options =
PopulationType: []
PopInitRange: []
PopulationSize: []
EliteCount: []
CrossoverFraction: []
ParetoFraction: []
MigrationDirection: []
MigrationInterval: []
MigrationFraction: []
Generations: []
TimeLimit: []
FitnessLimit: []
StallGenLimit: []
StallTest: []
StallTimeLimit: []
TolFun: []
TolCon: []
InitialPopulation: []
InitialScores: []
NonlinConAlgorithm: []
InitialPenalty: []
PenaltyFactor: []
PlotInterval: []
CreationFcn: []
FitnessScalingFcn: []
SelectionFcn: []
CrossoverFcn: []
MutationFcn: []
DistanceMeasureFcn: []
HybridFcn: []
Display: []
PlotFcns: []
OutputFcns: []
Vectorized: []
UseParallel: []
The results you show are more what you get when you use
options = gaoptimset(@ga)
options =
PopulationType: 'doubleVector'
PopInitRange: []
PopulationSize: '50 when numberOfVariables <= 5, else 200'
EliteCount: '0.05*PopulationSize'
CrossoverFraction: 0.8000
ParetoFraction: []
MigrationDirection: 'forward'
MigrationInterval: 20
MigrationFraction: 0.2000
Generations: '100*numberOfVariables'
TimeLimit: Inf
FitnessLimit: -Inf
StallGenLimit: 50
StallTest: 'averageChange'
StallTimeLimit: Inf
TolFun: 1.0000e-06
TolCon: 1.0000e-03
InitialPopulation: []
InitialScores: []
NonlinConAlgorithm: 'auglag'
InitialPenalty: 10
PenaltyFactor: 100
PlotInterval: 1
CreationFcn: @gacreationuniform
FitnessScalingFcn: @fitscalingrank
SelectionFcn: @selectionstochunif
CrossoverFcn: @crossoverscattered
MutationFcn: {[@mutationgaussian] [1] [1]}
DistanceMeasureFcn: []
HybridFcn: []
Display: 'final'
PlotFcns: []
OutputFcns: []
Vectorized: 'off'
UseParallel: 0
but different -- for example PopulationSize is not a specific numeric value like you show.
Actual R2014b has TolFun which is the field you are looking for.
Is it possible you ran in R2014a instead of R2014b ?
  2 Comments
K G
K G on 5 Dec 2021
Well, there was a conflict with a function named 'gaoptimset' belonging to another toolbox added in paths. When I removed that path, everything was normal.
Really sorry for spending your time, and thank you for your help.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!