Excuse me, but I believe that I could solve to the problem exposed in the previous message, nevertheless something happens that it does not
respect the order associated to the weights.
respect the order associated to the weights.
The script final is the following one:
declare
fun {Order X1#W1 X2#W2}
W1>W2 orelse (W1==W2 andthen {FD.reflect.size X1}<{FD.reflect.size X2})
end
fun {Order X1#W1 X2#W2}
W1>W2 orelse (W1==W2 andthen {FD.reflect.size X1}<{FD.reflect.size X2})
end
Strategy = generic(order: Order
filter: fun {$ X#_} {Not {IsDet X}} end
select: fun {$ X#_} X end
value: min)
filter: fun {$ X#_} {Not {IsDet X}} end
select: fun {$ X#_} X end
value: min)
fun {Queens N}
Lista = [8 2 4 3 1 6 7 5 9 10]
in
proc {$ Row}
L1N ={MakeTuple c N}
in
Row = {FD.tuple queens N 1#N}
{FD.distinct Row}
{For 1 N-1 1
proc {$ I}
{For I+1 N 1
proc{$ J}
Row.I - Row.J \=: I - J
Row.I - Row.J \=: J - I
end
}
end
}
{FD.distribute Strategy {Map Lista fun{$ K} (Row.K)#K end}}
end
end
{ExploreOne {Queens 10}}
Lista = [8 2 4 3 1 6 7 5 9 10]
in
proc {$ Row}
L1N ={MakeTuple c N}
in
Row = {FD.tuple queens N 1#N}
{FD.distinct Row}
{For 1 N-1 1
proc {$ I}
{For I+1 N 1
proc{$ J}
Row.I - Row.J \=: I - J
Row.I - Row.J \=: J - I
end
}
end
}
{FD.distribute Strategy {Map Lista fun{$ K} (Row.K)#K end}}
end
end
{ExploreOne {Queens 10}}
LLama Gratis a cualquier PC del Mundo.
Llamadas a fijos y móviles desde 1 céntimo por minuto.
http://es.voice.yahoo.com
_________________________________________________________________________________ mozart-users mailing list [email protected] http://www.mozart-oz.org/mailman/listinfo/mozart-users
