Hi, I have a small program like this (see below). I want to generate a permutation of all matches, and put a sequence constraints on the columns, but I am not able to transform the generated list into an array, and I get into infinite loops when I ask: listeDesMatches(Liste,7), X is Liste[2]. What should I do ? Annick Fron listeDesMatches(Liste,N):- (for(I,1,N) , fromto([],In,Out,Liste),param(N) do listeDesMatches(I,SousListe,N), append(SousListe,In,Out) ). listeDesMatches(N,[],N). listeDesMatches(I,Liste,N):- Iplus1 is I +1, listeDesMatches(I,Liste,N,Iplus1). listeDesMatches(I,[Match],N,N):- match(I,N,Match,N). listeDesMatches(I,[Match|Liste],N,Index):- match(I,Index,Match,N), Indexplus1 is Index +1, listeDesMatches(I,Liste,N,Indexplus1). match(I,J,Match,N):- dim(Match,[N]), Match :: 0..1, (for(K,1,N),param(Match,I,J) do X is Match[K] , X is (or((K#=I),(K#=J)))).Received on Wed Jun 22 2016 - 10:37:29 CEST
This archive was generated by hypermail 2.2.0 : Wed Jun 22 2016 - 15:13:13 CEST