From be046ff5ccc9f9765f405493b48f142f55762476 Mon Sep 17 00:00:00 2001 From: Alexey Stukalov Date: Wed, 17 Aug 2016 02:30:37 +0200 Subject: [PATCH] rename OptimalFitness to TargetFitness also some minor code cleanups --- README.md | 2 +- src/bboptimize.jl | 2 +- src/default_parameters.jl | 2 +- test/test_toplevel_bboptimize.jl | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 0b523da1..b86a5e4a 100644 --- a/README.md +++ b/README.md @@ -110,7 +110,7 @@ In addition to the `Method` parameter, there are many other parameters you can c * `MaxFuncEvals`: How many evaluations that are allowed of the function being optimized. * `TraceMode`: How optimization progress should be displayed (`:silent`, `:compact`, `:verbose`). Defaults to `:compact` that outputs current number of fitness evaluations and best value each `TraceInterval` seconds. * `PopulationSize`: How large is the initial population for population-based optimizers? Defaults to `50`. -* `OptimalFitness`. Allows to specify the value of the best fitness for a given problem. The algorithm stops as soon as the distance between the current `best_fitness()` and `OptimalFitness` is less than `FitnessTolerance`. +* `TargetFitness`. Allows to specify the value of the best fitness for a given problem. The algorithm stops as soon as the distance between the current `best_fitness()` and `TargetFitness` is less than `FitnessTolerance`. This list is not complete though, please refer to the `examples` and `tests` directories for additional examples. # State of the Library diff --git a/src/bboptimize.jl b/src/bboptimize.jl index f5692750..7e32fbfd 100644 --- a/src/bboptimize.jl +++ b/src/bboptimize.jl @@ -29,7 +29,7 @@ function setup_problem(func::Function, parameters::Parameters) # Now create an optimization problem with the given information. We currently reuse the type # from our pre-defined problems so some of the data for the constructor is dummy. problem = FunctionBasedProblem(func, "", parameters[:FitnessScheme], ss, - parameters[:OptimalFitness]) + parameters[:TargetFitness]) # validate fitness: create a random solution from the search space and ensure that fitness(problem) returns fitness_type(problem). ind = rand_individual(search_space(problem)) diff --git a/src/default_parameters.jl b/src/default_parameters.jl index 8333f550..d8eb16ea 100644 --- a/src/default_parameters.jl +++ b/src/default_parameters.jl @@ -8,7 +8,7 @@ const DefaultParameters = ParamsDict( :SearchRange => (-1.0, 1.0), # Default search range to use per dimension unless specified :SearchSpace => false, # Search space can be directly specified and will then take precedence over NumDimensions and SearchRange. :FitnessScheme => MinimizingFitnessScheme, # fitness scheme to be used - :OptimalFitness => nothing, # optimal (target) fitness, if known + :TargetFitness => nothing, # optimal (target) fitness, if known :Method => :adaptive_de_rand_1_bin_radiuslimited, diff --git a/test/test_toplevel_bboptimize.jl b/test/test_toplevel_bboptimize.jl index eef69ba9..0fc4994d 100644 --- a/test/test_toplevel_bboptimize.jl +++ b/test/test_toplevel_bboptimize.jl @@ -145,12 +145,12 @@ end end end - context("OptimalFitness option works") do + context("TargetFitness option works") do # FIXME use the same (fixed?) random seed to guarantee reproducibility result1 = bboptimize(rosenbrock, SearchRange = (-5.0, 5.0), NumDimensions = 5, Method = :de_rand_1_bin, FitnessTolerance = 1e-5, MaxSteps = 1000000, TraceMode = :silent, - OptimalFitness = 0.0) + TargetFitness = 0.0) result2 = bboptimize(rosenbrock, SearchRange = (-5.0, 5.0), NumDimensions = 5, Method = :de_rand_1_bin, FitnessTolerance = 1e-5, MaxSteps = 1000000, TraceMode = :silent)