Find new orbits
To find new orbits, first initialize a problem using the initialize
function (see Problem definition). Then, use the find_orbits
function to find new orbits.
The find_orbits
function receives the following arguments:
P
: AProblem
object.method
: An optimization method. It must be a subtype ofAbstractMethod
. See below for more information.number_of_orbits
: The number of orbits to be found. Default is1
. Ifnumber_of_orbits = Inf
, the function will continue to search for orbits until it is stopped by the user.starting_path_type
: aSymbol
that indicates the type of the starting path. Default is:random
. See below for more information.starting_path
: aPath
object that indicates the starting path. Default isnothing
. Ifstarting_path
is provided,starting_path_type
is ignored.print_path
: aBool
that indicates if the path should be printed. Default istrue
. The filename is the value of the action.print_path_folder
: aString
that indicates the folder where the path should be printed. Default is"./"
(the current folder).
Any additional keyword arguments are passed to the optimization method. For example, when using a CompoundMethod
, you can pass the keyword max_iterations
in order to specify the maximum number of times the first and second methods are executed.
Methods
To specify an optimization method, you can combine multiple AtomicMethod
s. The available atomic methods are:
- First Order Methods:
BFGS()
: BFGS method.ConjugateGradient()
: Conjugate gradient method.GradientDescent()
: Gradient descent method.
- Second Order Methods:
Newton()
: Newton method.
Every atomic method accepts the following options:
max_iter
: Maximum number of iterations. Default is200
.tolerance
: Tolerance on the gradient norm for the stopping criterion. Default is1e-8
.
You can combine them using the following constructors:
OneMethod(method)
: Use a single method.InitMinimizeMethod(init, method)
: Use an initialization method and then a minimization method.CompoundMethod(init, first, second)
: Use a compound method. Theinit
method is executed first. Then thefirst
andsecond
methods are executed repetedly until the stopping criterion is met.
The following are valid examples of method combinations:
OneMethod(BFGS())
: Use the BFGS method with 200 iterations and a tolerance of1e-8
(default options)OneMethod(Newton(400))
: Use the Newton method with 400 iterations (custom) and a tolerance of1e-8
(default)InitMinimizeMethod(ConjugateGradient(10), BFGS())
: Use the Conjugate Gradient method with 10 iterations (custom) and then the BFGS method with 200 iterations and a tolerance of1e-8
(default)CompoundMethod(BFGS(5), Newton(300), BFGS(10))
: Use the BFGS method with 5 iterations (custom) to initialize, then the Newton method with 300 iterations (custom) and finally the BFGS method with 10 iterations and a tolerance of1e-8
(default). The last two methods are executed repeatedly until the stopping criterion is met.
Starting Path Type
The starting_path_type
argument can be one of the following:
:random
: A random path.:circular
: A circular path.:perturbed_circular
: A circular path with a small perturbation.
Example
julia> result = find_orbits(P, OneMethod(BFGS()), number_of_orbits=1)
number_of_orbits = 1 #0: Searching new orbit... #1 First method: BFGS(max_iter=200, tolerance=1.0e-8) Action = 7.480447856567118 ∇action = 2.280734604662109e-9 Minimization result: Method: CompoundMethod{Nothing, BFGS, Nothing} Converged: true Gradient norm: 2.2807346066240926e-9 Action value: 7.480447856567119 ==> Optimization converged 1-element Vector{Any}: Minimization result: Method: CompoundMethod{Nothing, BFGS, Nothing} Converged: true Gradient norm: 2.2807346066240926e-9 Action value: 7.480447856567119