% Mapping file for running the examples with ECLiPSe and its lib(fd) solver. % Compile this first, then the example. :- lib(fd). :- lib(fd_search). :- lib(branch_and_bound). :- op(700, xfx, in). :- inline((in)/2, map_to_ic/2). :- inline(scalar_product/4, map_to_ic/2). map_to_ic(Xs in D, Xs :: D). map_to_ic(scalar_product(Weights,Vars,Op,Max), Constraint) :- Constraint =.. [Op, Weights*Vars, Max]. labeling([ff], Xs) :- search(Xs, 0, first_fail, indomain, complete, []). labeling([ffc], Xs) :- search(Xs, 0, most_constrained, indomain, complete, []). fd_maximize(Goal,Profit) :- Cost #= -Profit, bb_min(Goal, Cost, _). format(String) :- printf(String, []). format(String, List) :- split_string(String, "~", "", Parts), join_string(Parts, "%", String1), printf(String1, List).