I am trying to run this Clingo code with multiple different samples but when the size of the sample gets slightly bigger the program takes forever to optimise.
%Define car predicate
car(C) :- cars(X), C = 1..X.
%Define predicate number of assigned cars
used_cars(N) :- N = #count {Y: assign(_,Y)}.
%Define assign predicate
1{assign(P,C) : car(C)}1 :- parcel(P,_,_,_).
%Constraint car only assigned to parcels that have regions that border each other
:- assign(P1,C), assign(P2,C), parcel(P1,R1,_,_), parcel(P2,R2,_,_), not border(R1,R2), not border(R2,R1), R1 != R2.
%Define assigned volume predicate
assigned_volume(Y, TotalVolume) :- car(Y), TotalVolume =
#sum {V, X, Y, T: assign(X, Y), parcel(X,_,T,_), parcelType(T,V)}.
%Constraint volume
:- assigned_volume(Y, TotalVolume), volumeLimit(VL), TotalVolume > VL.
%Define assigned weight predicate
assigned_weight(Y, TotalWeight) :- car(Y), TotalWeight =
#sum {W, X, Y: assign(X, Y), parcel(X,_,_,W)}.
%Constraint weight
:- assigned_weight(Y, TotalWeight), weightLimit(WL), TotalWeight > WL.
%Minimize number of cars asigned
#minimize { N: used_cars(N)}.
Are there any performance optimisations I could implement to make the program optimise in a reasonable time?