No 'FunctionTolerance' or 'TolFun' in gaoptimset

5 次查看(过去 30 天)
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?

采纳的回答

Walter Roberson
Walter Roberson 2021-12-5
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 个评论
K G
K G 2021-12-5
Thank you for your reply.
It's definitely version 2014b
>> ver
----------------------------------------------------------------------------------------------------
MATLAB Version: 8.4.0.150421 (R2014b)
Operating System: Microsoft Windows 10 Pro Version 10.0 (Build 19044)
Java Version: Java 1.7.0_11-b21 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
----------------------------------------------------------------------------------------------------
MATLAB Version 8.4 (R2014b)
Global Optimization Toolbox Version 3.3 (R2014b)
If I run the toolbox
>> optimtool ga
then set the problem and the options and press Start, I get the error:
Optimization running.
Error running optimization.
Invalid value for OPTIONS parameter Generations: must be a real positive number (not a string).
So maybe there is something wrong with the installation of the toolbox?
("Generations" value was to 600 and then to default and the error was the same. Even when leaving all the options with the default values, the error was still there.)
K G
K G 2021-12-5
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.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Solver Outputs and Iterative Display 的更多信息

产品


版本

R2014b

Community Treasure Hunt

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

Start Hunting!

Translated by