# Encoding checkdepots.lparse

Name checkdepots.lparse [Root]    Unclassified (114)    Fastfood (5) Martin Gebser Wolfgang Faber This program checks whether a depot allocation has minimal supply costs among all depot allocations of the same cardinality. Input predicates: restaurant(Name,Km), depot(Name,Km) Output predicates: altdepot(Name,Km) Author: Wolfgang Faber <> License: GNU Public License, http://www.gnu.org/licenses/gpl.html 2009-03-30 13:03 2009-03-12 22:45 Decision Version of Fastfood depot/2restaurant/2 altdepot/2 No % This program checks whether a depot allocation has minimal supply % costs among all depot allocations of the same cardinality. % % Input predicates: % restaurant(Name,Km), depot(Name,Km) % Output predicates: % altdepot(Name,Km) % % Author: Wolfgang Faber % License: GNU Public License, http://www.gnu.org/licenses/gpl.html % All possible kilometers. kilometer(0..910). % Auxiliary predicate: All distances between restaurant locations. distance(X,Y,X-Y):- restaurant(R1,X), restaurant(R2,Y), X>Y. distance(X,Y,Y-X):- restaurant(R1,X), restaurant(R2,Y), X<=Y. % The supply distance for each restaurant for the candidate solution % in the input. % PROBLEM: Not having "min", I first define in what distances are non serving % depots. doesntserve(Rname,D1) :- restaurant(Rname,RK), depot(Dname1,DK1), distance(RK,DK1,D1), depot(Dname2,DK2), distance(RK,DK2,D2), D2= C1, costdomain(C), costdomain(C1). %:- C [altserves(R1,Dist1) : restaurant(R1,K1): kilometer(Dist1) = Dist1] C, % C1 [serves(R2,Dist2) : restaurant(R2,K2): kilometer(Dist2) = Dist2] C1, % C >= C1, kilometer(C), kilometer(C1).