clingo

Clingo Printing Duplicated Answers?


I'm having trouble interpreting the clingo v 5.2.2 output below:

enter image description here

Why did clingo print answer1 twice? I've checked that the two answer1s are exactly the same.

I'm using optimization in my code. Could that be the problem?

I've set up a test repo. The above output can be generated by running the following line in the test repo.

clingo --opt-mode=OptN examples/swap-shift.lp

Solution

  • Here's what I understand now: with the --opt-mode=OptN option, clingo will try multiple models until it finds all the optimal models, and it will print all the models it has witnessed followed by the optimal models. I think that could explain why answer1 was printed twice in my original question.

    In the output, I think Models is the number of total witnesses (including the first optimal model that got printed twice). Optimal is the number of optimal models found.

    I made my observation by observing the output of this example

    clingo --opt-mode=OptN asp/_all.lp asp/examples/scatter.lp
    

    See how Optimization decreases and the two optimum models are printed in the end.

    enter image description here