Skip to content

Commit

Permalink
Feature strategies values (#33)
Browse files Browse the repository at this point in the history
* branching strategies take values not types
* v0.1.1
  • Loading branch information
Wikunia authored May 7, 2022
1 parent b7e34fc commit d226392
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 8 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changelog

## v0.1.1
- Branching and traversing strategies take values not types

## v0.1.0
- BFS traverse strategy
- First and MostInfeasible branching strategies
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Bonobo"
uuid = "f7b14807-3d4d-461a-888a-05dd4bca8bc3"
authors = ["Ole Kroeger <[email protected]> and contributors"]
version = "0.1.0"
version = "0.1.1"

[deps]
DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"
Expand Down
8 changes: 4 additions & 4 deletions src/Bonobo.jl
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@ Later it can be dispatched on `BnBTree{Node, Root, Solution}` for various method
Return a [`BnBTree`](@ref) object which is the input for [`optimize!`](@ref).
"""
function initialize(;
traverse_strategy = BFS,
branch_strategy = FIRST,
traverse_strategy = BFS(),
branch_strategy = FIRST(),
atol = 1e-6,
rtol = 1e-6,
Node = DefaultNode,
Expand All @@ -198,7 +198,7 @@ function initialize(;
get_branching_indices(root),
0,
sense,
Options(traverse_strategy(), branch_strategy(), atol, rtol)
Options(traverse_strategy, branch_strategy, atol, rtol)
)
end

Expand Down Expand Up @@ -398,6 +398,6 @@ end

export BnBTree, BnBNodeInfo, AbstractNode, AbstractSolution

export AbstractTraverseStrategy
export AbstractTraverseStrategy, AbstractBranchStrategy

end
4 changes: 2 additions & 2 deletions test/end2end/mip.jl
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ end
@objective(m, Max, x[1]+1.2x[2]+3.2x[3])

bnb_model = BB.initialize(;
traverse_strategy = BB.BFS,
traverse_strategy = BB.BFS(),
Node = MIPNode,
root = m,
sense = objective_sense(m) == MOI.MAX_SENSE ? :Max : :Min
Expand Down Expand Up @@ -125,7 +125,7 @@ end
@objective(m, Min, x[1]+1.2x[2]+3.2x[3])

bnb_model = BB.initialize(;
branch_strategy = BB.MOST_INFEASIBLE,
branch_strategy = BB.MOST_INFEASIBLE(),
Node = MIPNode,
root = m,
sense = objective_sense(m) == MOI.MAX_SENSE ? :Max : :Min
Expand Down
2 changes: 1 addition & 1 deletion test/unit/add_node.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ struct TestRoot end
end

bnb_model = BB.initialize(;
branch_strategy = BB.MOST_INFEASIBLE,
branch_strategy = BB.MOST_INFEASIBLE(),
root = TestRoot(),
sense = :Min
)
Expand Down

0 comments on commit d226392

Please sign in to comment.