"Blocked Thread" when running a constraint program using FD
Yonet Eracar
eracar at comcast.net
Fri Mar 19 06:34:11 CET 2004
Hi,
I have a small constraint satisfaction problem in hand.
Constraints (using the data in the program):
1) There are pins and channels that we want to match.
2) pinRequirements holds the requirements for each pin.
3) capabilities holds the capabilities for each channel
4) I like to find a mapping (denoted as PC in the program) between pins and
channels such that:
4a) The requirements for each pin will be a subset of the capabilities of
the matched channel.
4b) Each pin will be matched to a different channel
When I run the program below, the Explorer comes up. But, only one green
node
indicating a "Blocked Thread" shows up. No other errors.
What am I doing wrong?
I included the code below.
Thanks,
Yonet
================================================
local
Data
fun {Subset S1 S2}
SizeS1 = {List.length S1}
SizeS2 = {List.length S2}
IsSubset = {NewCell nil}
in
{Assign IsSubset true}
if SizeS1 > SizeS2 then
{Assign IsSubset false}
else
{List.forAll S1
proc {$ E1}
if {List.member E1 S2} then
skip
else
{Assign IsSubset false}
end
end}
end
{Access IsSubset}
end
fun {FxtGen Data}
Requirements = Data.pinRequirements
%NbPins = {List.length Requirements}
Capabilities = Data.capabilities
NbChannels = {List.length Capabilities}
in
proc {$ PC}
%Channels = {FS.value.make 1#NbChannels}
PC1 PC2 PC3 PC4 PC5 PC6 PC7 PC8
PC9 PC10 PC11 PC12 PC13 PC14
PC15 PC16 PC17 PC18
in
PC = sol(1:PC1 2:PC2 3:PC3 4:PC4 5:PC5 6:PC6 7:PC7 8:PC8
9:PC9 10:PC10 11:PC11 12:PC12 13:PC13 14:PC14
15:PC15 16:PC16 17:PC17 18:PC18)
% PC1 = {FD.int 1#NbChannels}
{FD.dom 1#NbChannels PC}
{FD.distinct PC}
{List.forAllInd Requirements
proc {$ I R}
% {Subset R {List.nth Capabilities PC.I}} =: true
{List.sub R {List.nth Capabilities PC.I}} =: true
end}
%PC10 \=: 1
%PC11 \=: 5
%PC15 + PC16 =: PC17
{FD.distribute split PC}
end
end
in
Data = data(
pinRequirements:[ [1 2] [1] [1] [1 2 3]
[1] [1 3] [1 2] [1][3]
[1] [2 3] [3][1 2][1][3][1]
[1 3][1 2]]
capabilities: [[1] [1] [1] [1] [1]
[1] [1] [1] [2 3] [2 3]
[2 3] [1 2 3] [1 2 3] [1 2 3] [1 2]
[1 2] [3] [3] [3] [1 3]
[1 3] [1 3] [1 2] [1 2]]
)
{ExploreAll {FxtGen Data}}
end
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.gforge.info.ucl.ac.be/pipermail/mozart-users/attachments/20040319/dfe7f09d/attachment.html
More information about the mozart-users
mailing list