1

如果我们在 Eclipse CLP 中有两个Cost1比 更重要的目标函数Cost2,以下是否正确?

minimize(minimize(labeling(Vars), Cost1), Costs2).
4

1 回答 1

1

是的,只要您告诉内部最小化来计算所有最优解,而不仅仅是第一个(使用bb_min/3的变体minimize),这可行:

:- lib(ic).
:- lib(branch_and_bound).

minmin(X, Y) :-
    [X,Y] #:: 1..4,
    Cost1 #= -2*X,
    Cost2 #= -Y,
    bb_min(
        bb_min(
            labeling([X,Y]),
            Cost1,
            bb_options{solutions:all}
        ),
        Cost2,
        bb_options{solutions:one}
    ).

操作行为是首先Cost1最小化(忽略Cost2),然后Cost2最小化(Cost1固定在其最小值):

?- minmin(X, Y).
Found a solution with cost -2
Found a solution with cost -4
Found a solution with cost -6
Found a solution with cost -8
Found a solution with cost -1
Found a solution with cost -2
Found a solution with cost -3
Found a solution with cost -4
X = 4
Y = 4
Yes (0.00s cpu)
于 2019-05-19T18:31:12.583 回答