1

I have an optimization statement in a logic program, for clingo3:

#minimize [ batteryFlat(mycar)=1, batteryFlat(yourcar)=1, hasNoFuel(mycar)=1, 
    hasNoFuel(yourcar)=1, brokenIndicator(mycar)=1, brokenIndicator(yourcar)=1].

(Basically, I want the solution to contain as few of the above as possible - they are all of equal weight).

This syntax works for clingo3, but not clingo4. How should it be re-written for clingo4?

hassapikos
  • 59
  • 1
  • 2
  • 10

1 Answers1

0

How about this:

#minimize {batteryFlat(mycar); batteryFlat(yourcar); hasNoFuel(mycar); 
hasNoFuel(yourcar); brokenIndicator(mycar); brokenIndicator(yourcar)}.

The set is now separated with ; and you can then use , to conjoin conditions. Each element has the same priority, but if you want different priorities you can do something like:

#minimize {1@1: batteryFlat(mycar); 1@2: batteryFlat(yourcar); hasNoFuel(mycar); 
hasNoFuel(yourcar); brokenIndicator(mycar); brokenIndicator(yourcar)}.

Now the first atom has priority one (for at least one occurrence, I think) and the second atom a higher priority.

Or, if you have variables give priority to the number of different groundings like so:

#minimize {X@1: batteryFlat(X); 1@2: batteryFlat(yourcar); hasNoFuel(mycar); 
hasNoFuel(yourcar); brokenIndicator(mycar); brokenIndicator(yourcar)}.

Comparisons are shown here: http://sourceforge.net/projects/potassco/files/clingo/4.2.0/

Dr. Thomas C. King
  • 993
  • 2
  • 15
  • 28