[ library(branch_and_bound) | Reference Manual | Alphabetic Index ]
bb_probe(++From, ++To, +Goal, ?Template, ?Cost, ++Handle, ++Module)
Low-level primitive for building branch-and-bound-style search procedures
bb_probe tries to find a solution for Goal in the range From..To.
If there is a solution, its Template and Cost are stored in Handle,
the computation is undone, and bb_probe succeeds.
If there is no solution, Handle is not changed and bb_probe fails.
The primitive set_var_bounds/3 is used to impose cost bounds
during the search process in a generic way.
% a simple branch-and-bound procedure
my_minimize(Goal, Cost, Solution, OptCost, Module) :-
bb_delta(0, 1000000, Goal, Cost, Handle, Module)
bb_delta(From, To, Goal, Cost, Handle, Module) :-
bb_probe(From, To, Goal, Goal, Cost, Handle, Module),
NewTo is bb_cost(Handle) - 1,
bb_delta(From, NewTo, Goal, Cost, Handle, Module).
bb_init / 2, bb_cost / 2, bb_solution / 2, bb_finish / 1, bb_min / 3, bb_min / 6, set_var_bounds / 3