Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Branching split up into several steps #3

Closed
Wikunia opened this issue Oct 28, 2021 · 5 comments
Closed

Branching split up into several steps #3

Wikunia opened this issue Oct 28, 2021 · 5 comments
Labels
enhancement New feature or request

Comments

@Wikunia
Copy link
Owner

Wikunia commented Oct 28, 2021

Currently branch! is a single function I think it makes sense to split it up into:

  • get_branching_variable
  • branch_on_variable

or even

  • get_branching_variable
  • get_left_node
  • get_right_node

maybe also a combination of the two is possible.
By calling the lower one as a default but allowing the way like this:

var = get_branching_variable(tree, node)
branch_on_variable(tree, node, var)

branch_on_variable(tree, node, var) = get_left_node(tree, node, var); get_right_node(tree, node, var)

this way there is a possibility to have more than two children easily.

@Wikunia Wikunia added the enhancement New feature or request label Oct 28, 2021
@Wikunia Wikunia mentioned this issue Oct 28, 2021
@Wikunia
Copy link
Owner Author

Wikunia commented Nov 1, 2021

The get_branching_variable shall also dispatch on the option branch_strategy see #4
Then for example the FIRST strategy should call:
get_relaxed_values to iterate over it and one needs to implement a is_fixed method which shall exist for float and check whether it is nearly discrete also based on some atol and rtol.

@matbesancon
Copy link
Contributor

Depending on the design planned, relying on two functions for left and right node prohibits from non-binary branching.
It also reduces the possibility for common computation. In our case, we do a single processing step that produces the left and right data structure

@Wikunia
Copy link
Owner Author

Wikunia commented Nov 2, 2021

Yeah the plan was to make that a default maybe but have the ability to do as many nodes as you wish.

@matbesancon
Copy link
Contributor

the argument against would be that the interface to implement becomes
implement( left & right ) || implement( branch_on_variable )
while you could just specify that branch_on_variable must be implemented and return a collection of nodes (either a vector, static vector or tuple or something else)

@Wikunia
Copy link
Owner Author

Wikunia commented Nov 2, 2021

Oh yeah I overlooked that that getting the branching variable could also be different.
I thought only about one variable but for exampling setting it to 1,2,3,4,5,6,7,8,9 like for a sudoku problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants