-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
137 additions
and
109 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Algorithm API | ||
|
||
An algorithm is a procedure that given a model and and input performs some operations and | ||
returns an output. | ||
|
||
```@docs | ||
run! | ||
``` | ||
|
||
Parameters of an algorithm may contain its child algorithms which used by it. Therefore, | ||
the algoirthm tree is formed, in which the root is the algorithm called to solver the model | ||
(root algorithm should be an optimization algorithm, see below). | ||
|
||
Algorithms are divided into two types : "manager algorithms" and "worker algorithms". | ||
Worker algorithms just continue the calculation. They do not store and restore units | ||
as they suppose it is done by their master algorithms. Manager algorithms may divide | ||
the calculation flow into parts. Therefore, they store and restore units to make sure | ||
that their child worker algorithms have units prepared. | ||
A worker algorithm cannot have child manager algorithms. | ||
|
||
Examples of manager algorithms : TreeSearchAlgorithm (which covers both BCP algorithm and | ||
diving algorithm), conquer algorithms, strong branching, branching rule algorithms | ||
(which create child nodes). Examples of worker algorithms : column generation, SolveIpForm, | ||
SolveLpForm, cut separation, pricing algorithms, etc. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +0,0 @@ | ||
""" | ||
Input of a divide algorithm used by the tree search algorithm. | ||
Contains the parent node in the search tree for which children should be generated. | ||
""" | ||
abstract type AbstractDivideInput end | ||
|
||
function get_parent(i::AbstractDivideInput) | ||
@warn "get_parent(::$(typeof(i))) not implemented." | ||
return nothing | ||
end | ||
|
||
function get_opt_state(i::AbstractDivideInput) | ||
@warn "get_opt_state(::$(typeof(i))) not implemented." | ||
return nothing | ||
end | ||
|
||
""" | ||
Output of a divide algorithm used by the tree search algorithm. | ||
Should contain the vector of generated nodes. | ||
""" | ||
struct DivideOutput{N<:AbstractNode} | ||
children::Vector{N} | ||
optstate::OptimizationState | ||
end | ||
|
||
get_children(output::DivideOutput) = output.children | ||
get_opt_state(output::DivideOutput) = output.optstate | ||
|
||
""" | ||
This algorithm type is used by the tree search algorithm to generate nodes. | ||
""" | ||
abstract type AbstractDivideAlgorithm <: AbstractAlgorithm end | ||
|
||
# divide algorithms are always manager algorithms (they manage storing and restoring units) | ||
ismanager(algo::AbstractDivideAlgorithm) = true | ||
|
||
run!(algo::AbstractDivideAlgorithm, ::Env, model::AbstractModel, input::AbstractDivideInput) = | ||
error("Method run! in not defined for divide algorithm $(typeof(algo)), model $(typeof(model)), and input $(typeof(input)).") | ||
|
||
# this function is needed to check whether the best primal solution should be copied to the node optimization state | ||
exploits_primal_solutions(algo::AbstractDivideAlgorithm) = false | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters