[ library(branch_and_bound) | The ECLiPSe Libraries | Reference Manual | Alphabetic Index ]

bb_min(+Goal, ?Cost, ?Options)

Find a minimal solution using the branch-and-bound method
Goal
The (nondeterministic) search goal
Cost
A (usually numeric domain) variable representing the cost
Options
A bb_options structure or variable

Description

A solution of the goal Goal is found that minimizes the value of Cost. Cost should be a variable that is affected, and eventually instantiated, by Goal. Usually, Goal is the search procedure of a constraint problem and Cost is the variable representing the cost. The solution is found using the branch and bound method: as soon as a solution is found, it gets remembered and the search is continued or restarted with an additional constraint on the Cost variable which requires the next solution to be better than the previous one. Iterating this process yields an optimal solution in the end.

The possible options are

strategy:
continue (default)
after finding a solution, continue search with the newly found bound imposed on Cost
step
after finding a solution, restart the whole search with the newly found bound imposed on Cost
dichotomic
after finding a solution, split the remaning cost range and restart search to find a solution in the lower sub-range. If that fails, assume the upper sub-range as the remaning cost range and split again.
The new bound or the split point, respectively, are computed from the current best solution, while taking into account the parameters delta and factor.
from:
number - an initial lower bound for the cost (default -1.0Inf)
to:
number - an initial upper bound for the cost (default +1.0Inf)
delta:
number - minimal absolute improvement required for each step (default 1.0), applies to all strategies
factor:
number - minimal improvement ratio for strategies 'continue' and 'step' (default 1.0), or split factor for strategy 'dichotomic' (default 0.5)
timeout:
number - maximum seconds of cpu time to spend (default: no limit)
report_success:
name/arity - a handler of maximum arity 3 to be called whenever a better solution is found. The handler arguments are: Cost, Handle, Module. The default handler prints a message.
report_failure:
name/arity - a handler of maximum arity 3 to be called whenever the absence of a solution in a cost range has been proven. The handler arguments are: Range, Handle, Module. The default handler prints a message.
The default options can be selected by passing a free variable as the Options-argument. To specify other options, pass a bb_options- structure in with-syntax, e.g.
	bb_options with [strategy:dichotomic, timeout:60]
	
In order to maximize instead of minimizing, introduce a negated cost variable in your model and minimize that instead.

Examples

?- bb_min(member(X,[9,6,8,4,7,2,4,7]), X, O).
Found a solution with cost 9
Found a solution with cost 6
Found a solution with cost 4
Found a solution with cost 2
Found no solution with cost -1.0Inf .. 1
X = 2
O = bb_options(step, -1.0Inf, 1.0Inf, 1, 1, 0, 0)
yes.

[eclipse 6]: bb_min(member(X,[9,6,8,4,7,2,4,7]), X, bb_options with [delta:4]).
Found a solution with cost 9
Found a solution with cost 4
Found no solution with cost -1.0Inf .. 0
X = 4
yes.

[eclipse 10]: bb_min(member(X,[99,60,80,40,70,30,70]), X,
	bb_options with [strategy:dichotomic, from:0]).
Found a solution with cost 99
Found a solution with cost 40
Found no solution with cost 0.0 .. 20.0
Found a solution with cost 30
Found no solution with cost 20.0 .. 25.0
Found no solution with cost 25.0 .. 27.5
Found no solution with cost 27.5 .. 28.75
Found no solution with cost 28.75 .. 29.0

X = 30
yes.

See Also

bb_min / 6