Clingo constraint not working properly and being ignored

85 views Asked by At

I have a Clingo program optimising parcel delivery, and there are 2 constraints to limit the weight and the volume a car can deliver respectively, however these constraints are not working.

weightLimit(500).
volumeLimit(1000).

cars(2).

parcel(1,a,1,400).
parcel(2,b,1,400).
parcel(3,c,1,400).

%Constraint volume
:- #sum {V, X, Y, T: assign(X, Y), parcel(X,_,T,_), parcelType(T,V)} > volumeLimit.

%Constraint weight limit
:- #sum {W, X, Y:  assign(X, Y), parcel(X,_,_,W)} > weightLimit.

This should be unsatisfiable because it is impossible to deliver all those parcels with only 2 cars since the weight limit is only 500, but when I run it, it just assigns parcels over the weight limit.

0

There are 0 answers