# Encoding fastfood_decision.gringo

Name fastfood_decision.gringo [Root]    Unclassified (114)    Fastfood (5) Martin Gebser Martin Gebser and Roland Kaminski A Gringo encoding of the Fastfood problem. 2009-03-12 22:49 2009-05-29 16:04 Decision Version of Fastfood depot/2restaurant/2 altdepot/2 No ASP Contest 09 (Martin Gebser) #hide. #show altdepot/2. % calculate the number of depots depots(X) :- X = { depot(DN,DK) : depot(DN,DK) }. % get the closest depot for a restaurant serves(RN,Dist) :- restaurant(RN,RK), Dist = min [ depot(DN,DK) : depot(DN,DK) = abs(DK-RK) ]. % get possible distances dist(abs(RK1-RK2)) :- restaurant(RN1,RK1), restaurant(RN2,RK2). % each restaurant may be an alternative depot X { altdepot(RN,RK) : restaurant(RN,RK) } X :- depots(X). % get the closest alternative depot for a restaurant altserves(RN,Dist) :- restaurant(RN,RK), Dist = min [ altdepot(DN,DK) : restaurant(DN,DK) = abs(DK-RK) ]. % calculate the costs for the initial depots costs(C) :- C = [ serves(RN,Dist) : serves(RN,Dist) = Dist ]. % fail if we have not found a better solution :- costs(C), C [ altserves(RN,Dist) : restaurant(RN,RK) : dist(Dist) = Dist ].