Skip to content

Commit

Permalink
rename OptimalFitness to TargetFitness
Browse files Browse the repository at this point in the history
also some minor code cleanups
  • Loading branch information
alyst committed Aug 18, 2016
1 parent c399d40 commit be046ff
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/bboptimize.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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, "<unknown>", 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))
Expand Down
2 changes: 1 addition & 1 deletion src/default_parameters.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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,

Expand Down
4 changes: 2 additions & 2 deletions test/test_toplevel_bboptimize.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit be046ff

Please sign in to comment.