john_ny
john_ny

Reputation: 173

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)}.

Upvotes: 1

Views: 435

Answers (1)

Duda
Duda

Reputation: 3736

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.

Upvotes: 2

Related Questions