Prolog manual or custom labeling

后端 未结 5 524
孤独总比滥情好
孤独总比滥情好 2020-12-19 18:14

I am currently writing a solver for a floor planning problem in Prolog and have some issues with the labeling part.

The current problem is my constraints are posted

5条回答
  •  抹茶落季
    2020-12-19 18:36

    Make sure to distinguish labeling strategies from additional propagation. These two aspects are currently a bit mixed in your question.

    In SWI-Prolog, there is a predicate called clpfd:contracting/1. It does what you describe: It tries values from the domain boundaries, and removes values that can be seen as inconsistent, i.e., for which it is known that no solution exists.

    Therefore, if you have a list of variables Vs, you can try: clpfd:contracting(Vs), and see if this helps.

    Note that this can also significantly slow down the search, though on the other hand, also help significantly to reduce the search space before even trying any labeling!

提交回复
热议问题