On 30/04/11 19:18, Nada Ossama wrote: > I was using this TSP(travelling salesman Problem) code in my project > and it was working perfectly on these set of data > % Data > > c(0,1,30). > c(0,2,60). > c(0,3,41). > c(0,4,17). > c(0,5,70). > c(1,2,58). > c(1,3,46). > c(1,4,46). > c(1,5,48). > c(2,3,21). > c(2,4,59). > c(2,5,40). > c(3,4,38). > c(3,5,50). > c(4,5,78). > > However these were not the real data i will make my application work upon > there are: > % Data > > c(1,0,0.00136225). > c(2,0,0.0022772499999999998). > c(2,1,9.15E-4). > c(3,0,0.0036787499999999997). > c(3,1,0.0023165). > c(3,2,0.0014015). > > So to accommodate the code to my data > I edited in this procedure by changing the domain > > %Initialize a list and make sure that all its contents are different > init_cities(N,List) :- > length(List,N), > List::0..1, > ic:alldifferent(List). Why did you change the domain to 0..1? As far as I understand, List is the list of cities you are going to visit; do you want to visit only two cities, namely city 0 and city 1? > but its not working and I don't know why The problem seems to be the fact that the objective function you use is real (floating point), while you use (in various points) code that was meant to work with the integers. So, you can either change the code to work with the reals (or breals), or change the input data, for example by multiplying the distances by some big number (e.g., 1e7?). Cheers, Marco -- Marco Gavanelli, Ph.D. in Computer Science Dept of Engineering University of Ferrara Tel/Fax +39-0532-97-4833 http://www.ing.unife.it/docenti/MarcoGavanelli/Received on Mon May 02 2011 - 12:41:15 CEST
This archive was generated by hypermail 2.3.0 : Wed Sep 25 2024 - 15:13:20 CEST