optimizationlogic-programminganswer-set-programming

Negative optimization result in Answer Set Programming


I have written an ASP program with an optimization condition in the end. When I compile it, even though I get the correct result, in the summary I get a negative value for the optimization (i.e. -3).

enter image description here

Do you know why this happens?

The optimization code part looks like this:

number_of_leaves(N) :- #count{X : leaf(X)} = N.
#maximize {N : number_of_leaves(N)}.

Solution

  • In clingo only #minimize is actually implemented. #maximize is realized by using #minimize - just with negated values. Therefore the "maximum" is negated as well - it shows -3 when the value should be 3.