Tree search API
Update needed.
Now, we define the two concepts we'll use in the tree search algorithms: the node and the search space. The third concept is the explore strategy and implemented in Coluna.
Every tree search algorithm must be associated to a search space.
Implementing tree search interface
First, we indicate the type of search space used by our algorithms. Note that the type of the search space can depends on the configuration of the algorithm. So there is a 1-to-n relation between tree search algorithm configurations and search space. because one search space can be used by several tree search algorithms configuration.
Now, we implement the method that calls the constructor of a search space. The type of the search space is known from above method. A search space may receive information from the tree-search algorithm. The model
, and input
arguments are the same than those received by the tree search algorithm.
We implement the method that returns the root node. The definition of the root node depends on the search space.
Then, we implement the method that converts the branching rules into nodes for the tree search algorithm.
We implement the node_change
method to update the search space called by the tree search algorithm just after it finishes to evaluate a node and chooses the next one. Be careful, this method is not called after the evaluation of a node when there is no more unevaluated nodes (i.e. tree exploration is finished).
There are two ways to store the state of a formulation at a given node. We can distribute information across the nodes or store the whole state at each node. We follow the second way (so we don't need previous
).
Method after_conquer
is a callback to do some operations after the conquer of a node and before the divide. Here, we update the best solution found after the conquer algorithm. We implement one method for each search space.
We implement getters to retrieve the input from the search space and the node. The input is passed to the conquer and the divide algorithms.
At last, we implement methods that will return the output of the tree search algorithms. We return the cost of the best solution found. We write one method for each search space.
API
Search space
Coluna.TreeSearch.AbstractSearchSpace
— TypeContains the definition of the problem tackled by the tree search algorithm and how the nodes and transitions of the tree search space will be explored.
Coluna.TreeSearch.search_space_type
— FunctionReturns the type of search space depending on the tree-search algorithm and its parameters.
Coluna.TreeSearch.new_space
— FunctionCreates and returns the search space of a tree search algorithm, its model, and its input.
Node
Coluna.TreeSearch.AbstractNode
— TypeA subspace obtained by successive divisions of the search space.
Coluna.TreeSearch.new_root
— FunctionCreates and returns the root node of a search space.
Coluna.TreeSearch.get_parent
— FunctionReturns the parent of a node; nothing
if the node is the root.
Coluna.TreeSearch.get_priority
— FunctionReturns the priority of the node depending on the explore strategy.
Additional methods needed for Coluna's algorithms:
Missing docstring for Coluna.TreeSearch.get_opt_state
. Check Documenter's build log for details.
Missing docstring for Coluna.TreeSearch.get_records
. Check Documenter's build log for details.
Coluna.TreeSearch.get_branch_description
— FunctionReturns a String
to display the branching constraint.
Coluna.TreeSearch.isroot
— FunctionReturns true
is the node is root; false
otherwise.
Tree search algorithm
Coluna.TreeSearch.AbstractExploreStrategy
— TypeAlgorithm that chooses next node to evaluated in the tree search algorithm.
Coluna.TreeSearch.tree_search
— FunctionGeneric implementation of the tree search algorithm for a given explore strategy.
Coluna.TreeSearch.children
— FunctionEvaluate and generate children. This method has a specific implementation for Coluna.
Coluna.TreeSearch.stop
— FunctionReturns true if stopping criteria are met; false otherwise.
Coluna.TreeSearch.tree_search_output
— FunctionReturns the output of the tree search algorithm.
Tree search algorithm for Coluna
Coluna.Algorithm.AbstractColunaSearchSpace
— TypeSearch space for tree search algorithms in Coluna.
The children
method has a specific implementation for AbstractColunaSearchSpace
` that involves following methods:
Coluna.Algorithm.get_previous
— FunctionReturns the previous node explored by the tree search algorithm.
Coluna.Algorithm.set_previous!
— FunctionSets the previous node explored by the tree search algorithm.
Coluna.Algorithm.node_change!
— FunctionMethods to perform operations before the tree search algorithm evaluates a node (current
). This is useful to restore the state of the formulation for instance.
Coluna.Algorithm.get_divide
— FunctionReturns the divide algorithm.
Coluna.Algorithm.get_reformulation
— FunctionReturns the reformulation that will be passed to an algorithm.
Coluna.Algorithm.get_input
— FunctionReturns the input that will be passed to an algorithm. The input can be built from information contained in a search space and a node.
Coluna.Algorithm.after_conquer!
— FunctionMethods to perform operations after the conquer algorithms. It receives the output of the conquer algorithm.
Coluna.Algorithm.new_children
— FunctionCreates and returns the children of a node associated to a search space.
This page was generated using Literate.jl.