ConstraintSolver 0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/bin/ConstraintSolver +24 -0
- data/doc/classes/Array.html +209 -0
- data/doc/classes/ConstraintSolver.html +242 -0
- data/doc/classes/ConstraintSolver/AbstractConstraint.html +317 -0
- data/doc/classes/ConstraintSolver/AllDifferentConstraint.html +451 -0
- data/doc/classes/ConstraintSolver/AllDifferentConstraintTest.html +397 -0
- data/doc/classes/ConstraintSolver/BinaryConstraint.html +483 -0
- data/doc/classes/ConstraintSolver/BinaryConstraintTest.html +367 -0
- data/doc/classes/ConstraintSolver/BinaryRelation.html +276 -0
- data/doc/classes/ConstraintSolver/BinaryRelationTest.html +194 -0
- data/doc/classes/ConstraintSolver/ConstraintList.html +208 -0
- data/doc/classes/ConstraintSolver/ConstraintListTest.html +252 -0
- data/doc/classes/ConstraintSolver/ConstraintSolver.html +353 -0
- data/doc/classes/ConstraintSolver/ConstraintSolverTest.html +403 -0
- data/doc/classes/ConstraintSolver/Domain.html +522 -0
- data/doc/classes/ConstraintSolver/DomainTest.html +356 -0
- data/doc/classes/ConstraintSolver/DomainWipeoutException.html +158 -0
- data/doc/classes/ConstraintSolver/Problem.html +239 -0
- data/doc/classes/ConstraintSolver/ProblemTest.html +227 -0
- data/doc/classes/ConstraintSolver/Solution.html +342 -0
- data/doc/classes/ConstraintSolver/SolutionTest.html +250 -0
- data/doc/classes/ConstraintSolver/UndoStackEmptyException.html +158 -0
- data/doc/classes/ConstraintSolver/Variable.html +418 -0
- data/doc/classes/ConstraintSolver/VariableTest.html +284 -0
- data/doc/classes/ExtensionsTest.html +233 -0
- data/doc/classes/Fixnum.html +153 -0
- data/doc/created.rid +1 -0
- data/doc/dot/f_0.dot +38 -0
- data/doc/dot/f_0.png +0 -0
- data/doc/dot/f_1.dot +392 -0
- data/doc/dot/f_1.png +0 -0
- data/doc/dot/f_10.dot +392 -0
- data/doc/dot/f_10.png +0 -0
- data/doc/dot/f_11.dot +38 -0
- data/doc/dot/f_11.png +0 -0
- data/doc/dot/f_12.dot +392 -0
- data/doc/dot/f_12.png +0 -0
- data/doc/dot/f_13.dot +392 -0
- data/doc/dot/f_13.png +0 -0
- data/doc/dot/f_14.dot +392 -0
- data/doc/dot/f_14.png +0 -0
- data/doc/dot/f_15.dot +392 -0
- data/doc/dot/f_15.png +0 -0
- data/doc/dot/f_16.dot +392 -0
- data/doc/dot/f_16.png +0 -0
- data/doc/dot/f_17.dot +392 -0
- data/doc/dot/f_17.png +0 -0
- data/doc/dot/f_18.dot +392 -0
- data/doc/dot/f_18.png +0 -0
- data/doc/dot/f_19.dot +392 -0
- data/doc/dot/f_19.png +0 -0
- data/doc/dot/f_2.dot +392 -0
- data/doc/dot/f_2.png +0 -0
- data/doc/dot/f_3.dot +392 -0
- data/doc/dot/f_3.png +0 -0
- data/doc/dot/f_4.dot +392 -0
- data/doc/dot/f_4.png +0 -0
- data/doc/dot/f_5.dot +392 -0
- data/doc/dot/f_5.png +0 -0
- data/doc/dot/f_6.dot +14 -0
- data/doc/dot/f_6.png +0 -0
- data/doc/dot/f_7.dot +392 -0
- data/doc/dot/f_7.png +0 -0
- data/doc/dot/f_8.dot +392 -0
- data/doc/dot/f_8.png +0 -0
- data/doc/dot/f_9.dot +392 -0
- data/doc/dot/f_9.png +0 -0
- data/doc/dot/m_10_0.dot +392 -0
- data/doc/dot/m_10_0.png +0 -0
- data/doc/dot/m_12_0.dot +392 -0
- data/doc/dot/m_12_0.png +0 -0
- data/doc/dot/m_13_0.dot +392 -0
- data/doc/dot/m_13_0.png +0 -0
- data/doc/dot/m_14_0.dot +392 -0
- data/doc/dot/m_14_0.png +0 -0
- data/doc/dot/m_15_0.dot +392 -0
- data/doc/dot/m_15_0.png +0 -0
- data/doc/dot/m_16_0.dot +392 -0
- data/doc/dot/m_16_0.png +0 -0
- data/doc/dot/m_17_0.dot +392 -0
- data/doc/dot/m_17_0.png +0 -0
- data/doc/dot/m_18_0.dot +392 -0
- data/doc/dot/m_18_0.png +0 -0
- data/doc/dot/m_19_0.dot +392 -0
- data/doc/dot/m_19_0.png +0 -0
- data/doc/dot/m_1_0.dot +392 -0
- data/doc/dot/m_1_0.png +0 -0
- data/doc/dot/m_2_0.dot +392 -0
- data/doc/dot/m_2_0.png +0 -0
- data/doc/dot/m_3_0.dot +392 -0
- data/doc/dot/m_3_0.png +0 -0
- data/doc/dot/m_4_0.dot +392 -0
- data/doc/dot/m_4_0.png +0 -0
- data/doc/dot/m_5_0.dot +392 -0
- data/doc/dot/m_5_0.png +0 -0
- data/doc/dot/m_7_0.dot +392 -0
- data/doc/dot/m_7_0.png +0 -0
- data/doc/dot/m_8_0.dot +392 -0
- data/doc/dot/m_8_0.png +0 -0
- data/doc/dot/m_9_0.dot +392 -0
- data/doc/dot/m_9_0.png +0 -0
- data/doc/files/lib/AbstractConstraint_rb.html +148 -0
- data/doc/files/lib/AllDifferentConstraint_rb.html +156 -0
- data/doc/files/lib/BinaryConstraint_rb.html +155 -0
- data/doc/files/lib/ConstraintList_rb.html +148 -0
- data/doc/files/lib/ConstraintSolver_rb.html +162 -0
- data/doc/files/lib/Domain_rb.html +155 -0
- data/doc/files/lib/Problem_rb.html +148 -0
- data/doc/files/lib/Solution_rb.html +148 -0
- data/doc/files/lib/Variable_rb.html +148 -0
- data/doc/files/lib/extensions_rb.html +108 -0
- data/doc/files/test/AllDifferentConstraintTest_rb.html +158 -0
- data/doc/files/test/BinaryConstraintTest_rb.html +158 -0
- data/doc/files/test/ConstraintListTest_rb.html +160 -0
- data/doc/files/test/ConstraintSolverTest_rb.html +164 -0
- data/doc/files/test/DomainTest_rb.html +156 -0
- data/doc/files/test/ProblemTest_rb.html +160 -0
- data/doc/files/test/SolutionTest_rb.html +159 -0
- data/doc/files/test/TestSuite_rb.html +113 -0
- data/doc/files/test/VariableTest_rb.html +157 -0
- data/doc/files/test/extensionsTest_rb.html +118 -0
- data/doc/fr_class_index.html +51 -0
- data/doc/fr_file_index.html +46 -0
- data/doc/fr_method_index.html +133 -0
- data/doc/index.html +24 -0
- data/examples/example.rb +7 -0
- data/examples/queens.rb +13 -0
- data/examples/soft.rb +14 -0
- data/lib/AbstractConstraint.rb +45 -0
- data/lib/AllDifferentConstraint.rb +160 -0
- data/lib/BinaryConstraint.rb +187 -0
- data/lib/ConstraintList.rb +31 -0
- data/lib/ConstraintSolver.rb +213 -0
- data/lib/Domain.rb +100 -0
- data/lib/GraphUtils.rb +293 -0
- data/lib/OneOfEqualsConstraint.rb +81 -0
- data/lib/Problem.rb +30 -0
- data/lib/Solution.rb +56 -0
- data/lib/TupleConstraint.rb +111 -0
- data/lib/Variable.rb +74 -0
- data/lib/extensions.rb +55 -0
- data/test/AllDifferentConstraintTest.rb +140 -0
- data/test/BinaryConstraintTest.rb +108 -0
- data/test/ConstraintListTest.rb +41 -0
- data/test/ConstraintSolverTest.rb +274 -0
- data/test/DomainTest.rb +83 -0
- data/test/GraphUtilsTest.rb +83 -0
- data/test/OneOfEqualsConstraintTest.rb +82 -0
- data/test/ProblemTest.rb +35 -0
- data/test/SolutionTest.rb +35 -0
- data/test/TestSuite.rb +10 -0
- data/test/TupleConstraintTest.rb +151 -0
- data/test/VariableTest.rb +47 -0
- data/test/extensionsTest.rb +57 -0
- metadata +212 -0
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
|
|
2
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
3
|
+
<!DOCTYPE html
|
|
4
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
5
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
6
|
+
|
|
7
|
+
<!--
|
|
8
|
+
|
|
9
|
+
Methods
|
|
10
|
+
|
|
11
|
+
-->
|
|
12
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
13
|
+
<head>
|
|
14
|
+
<title>Methods</title>
|
|
15
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
|
16
|
+
<link rel="stylesheet" href="rdoc-style.css" type="text/css" />
|
|
17
|
+
<base target="docwin" />
|
|
18
|
+
</head>
|
|
19
|
+
<body>
|
|
20
|
+
<div id="index">
|
|
21
|
+
<h1 class="section-bar">Methods</h1>
|
|
22
|
+
<div id="index-entries">
|
|
23
|
+
<a href="classes/ConstraintSolver/Domain.html#M000049"><< (ConstraintSolver::Domain)</a><br />
|
|
24
|
+
<a href="classes/ConstraintSolver/Solution.html#M000041"><=> (ConstraintSolver::Solution)</a><br />
|
|
25
|
+
<a href="classes/ConstraintSolver/AllDifferentConstraint.html#M000105">== (ConstraintSolver::AllDifferentConstraint)</a><br />
|
|
26
|
+
<a href="classes/ConstraintSolver/BinaryConstraint.html#M000093">== (ConstraintSolver::BinaryConstraint)</a><br />
|
|
27
|
+
<a href="classes/ConstraintSolver/Variable.html#M000082">== (ConstraintSolver::Variable)</a><br />
|
|
28
|
+
<a href="classes/ConstraintSolver/Solution.html#M000042">== (ConstraintSolver::Solution)</a><br />
|
|
29
|
+
<a href="classes/ConstraintSolver/Domain.html#M000059">== (ConstraintSolver::Domain)</a><br />
|
|
30
|
+
<a href="classes/ConstraintSolver/BinaryConstraint.html#M000089">allAssigned? (ConstraintSolver::BinaryConstraint)</a><br />
|
|
31
|
+
<a href="classes/ConstraintSolver/AllDifferentConstraint.html#M000101">allAssigned? (ConstraintSolver::AllDifferentConstraint)</a><br />
|
|
32
|
+
<a href="classes/ConstraintSolver/AbstractConstraint.html#M000025">allAssigned? (ConstraintSolver::AbstractConstraint)</a><br />
|
|
33
|
+
<a href="classes/ConstraintSolver/BinaryRelation.html#M000011">arity (ConstraintSolver::BinaryRelation)</a><br />
|
|
34
|
+
<a href="classes/ConstraintSolver/ConstraintSolver.html#M000069">assignNextVariable (ConstraintSolver::ConstraintSolver)</a><br />
|
|
35
|
+
<a href="classes/ConstraintSolver/Variable.html#M000083">assigned? (ConstraintSolver::Variable)</a><br />
|
|
36
|
+
<a href="classes/ConstraintSolver/BinaryRelation.html#M000010">call (ConstraintSolver::BinaryRelation)</a><br />
|
|
37
|
+
<a href="classes/ConstraintSolver/Domain.html#M000053">collect (ConstraintSolver::Domain)</a><br />
|
|
38
|
+
<a href="classes/ConstraintSolver/Domain.html#M000050">delete (ConstraintSolver::Domain)</a><br />
|
|
39
|
+
<a href="classes/ConstraintSolver/AllDifferentConstraint.html#M000106">each (ConstraintSolver::AllDifferentConstraint)</a><br />
|
|
40
|
+
<a href="classes/ConstraintSolver/Solution.html#M000040">each (ConstraintSolver::Solution)</a><br />
|
|
41
|
+
<a href="classes/ConstraintSolver/BinaryConstraint.html#M000094">each (ConstraintSolver::BinaryConstraint)</a><br />
|
|
42
|
+
<a href="classes/ConstraintSolver/AbstractConstraint.html#M000027">each (ConstraintSolver::AbstractConstraint)</a><br />
|
|
43
|
+
<a href="classes/ConstraintSolver/Domain.html#M000051">each (ConstraintSolver::Domain)</a><br />
|
|
44
|
+
<a href="classes/Array.html#M000003">eachAfter (Array)</a><br />
|
|
45
|
+
<a href="classes/ConstraintSolver/Domain.html#M000054">empty? (ConstraintSolver::Domain)</a><br />
|
|
46
|
+
<a href="classes/Array.html#M000002">foldLeft (Array)</a><br />
|
|
47
|
+
<a href="classes/ConstraintSolver/AbstractConstraint.html#M000024">holds? (ConstraintSolver::AbstractConstraint)</a><br />
|
|
48
|
+
<a href="classes/ConstraintSolver/AllDifferentConstraint.html#M000100">holds? (ConstraintSolver::AllDifferentConstraint)</a><br />
|
|
49
|
+
<a href="classes/ConstraintSolver/BinaryConstraint.html#M000088">holds? (ConstraintSolver::BinaryConstraint)</a><br />
|
|
50
|
+
<a href="classes/ConstraintSolver/BinaryConstraint.html#M000090">include? (ConstraintSolver::BinaryConstraint)</a><br />
|
|
51
|
+
<a href="classes/ConstraintSolver/AllDifferentConstraint.html#M000102">include? (ConstraintSolver::AllDifferentConstraint)</a><br />
|
|
52
|
+
<a href="classes/ConstraintSolver/AbstractConstraint.html#M000026">include? (ConstraintSolver::AbstractConstraint)</a><br />
|
|
53
|
+
<a href="classes/ConstraintSolver/Domain.html#M000057">include? (ConstraintSolver::Domain)</a><br />
|
|
54
|
+
<a href="classes/ConstraintSolver/AllDifferentConstraint.html#M000099">new (ConstraintSolver::AllDifferentConstraint)</a><br />
|
|
55
|
+
<a href="classes/ConstraintSolver/BinaryConstraint.html#M000087">new (ConstraintSolver::BinaryConstraint)</a><br />
|
|
56
|
+
<a href="classes/ConstraintSolver/Problem.html#M000098">new (ConstraintSolver::Problem)</a><br />
|
|
57
|
+
<a href="classes/ConstraintSolver/BinaryRelation.html#M000009">new (ConstraintSolver::BinaryRelation)</a><br />
|
|
58
|
+
<a href="classes/ConstraintSolver/Variable.html#M000078">new (ConstraintSolver::Variable)</a><br />
|
|
59
|
+
<a href="classes/ConstraintSolver/Solution.html#M000039">new (ConstraintSolver::Solution)</a><br />
|
|
60
|
+
<a href="classes/ConstraintSolver/ConstraintSolver.html#M000067">new (ConstraintSolver::ConstraintSolver)</a><br />
|
|
61
|
+
<a href="classes/ConstraintSolver/Domain.html#M000048">new (ConstraintSolver::Domain)</a><br />
|
|
62
|
+
<a href="classes/ConstraintSolver/ConstraintList.html#M000097">notAllAssignedWithVariable (ConstraintSolver::ConstraintList)</a><br />
|
|
63
|
+
<a href="classes/Fixnum.html#M000008">not_equal? (Fixnum)</a><br />
|
|
64
|
+
<a href="classes/ConstraintSolver/Domain.html#M000055">prune (ConstraintSolver::Domain)</a><br />
|
|
65
|
+
<a href="classes/ConstraintSolver/Variable.html#M000084">reset (ConstraintSolver::Variable)</a><br />
|
|
66
|
+
<a href="classes/Array.html#M000001">rest (Array)</a><br />
|
|
67
|
+
<a href="classes/ConstraintSolver/AllDifferentConstraint.html#M000107">revise (ConstraintSolver::AllDifferentConstraint)</a><br />
|
|
68
|
+
<a href="classes/ConstraintSolver/AbstractConstraint.html#M000028">revise (ConstraintSolver::AbstractConstraint)</a><br />
|
|
69
|
+
<a href="classes/ConstraintSolver/BinaryConstraint.html#M000095">revise (ConstraintSolver::BinaryConstraint)</a><br />
|
|
70
|
+
<a href="classes/ConstraintSolver/ConstraintSolver.html#M000070">reviseConstraints (ConstraintSolver::ConstraintSolver)</a><br />
|
|
71
|
+
<a href="classes/ConstraintSolver/BinaryConstraintTest.html#M000071">setup (ConstraintSolver::BinaryConstraintTest)</a><br />
|
|
72
|
+
<a href="classes/ConstraintSolver/ConstraintSolverTest.html#M000029">setup (ConstraintSolver::ConstraintSolverTest)</a><br />
|
|
73
|
+
<a href="classes/ExtensionsTest.html#M000004">setup (ExtensionsTest)</a><br />
|
|
74
|
+
<a href="classes/ConstraintSolver/AllDifferentConstraintTest.html#M000013">setup (ConstraintSolver::AllDifferentConstraintTest)</a><br />
|
|
75
|
+
<a href="classes/ConstraintSolver/ProblemTest.html#M000085">setup (ConstraintSolver::ProblemTest)</a><br />
|
|
76
|
+
<a href="classes/ConstraintSolver/VariableTest.html#M000044">setup (ConstraintSolver::VariableTest)</a><br />
|
|
77
|
+
<a href="classes/ConstraintSolver/DomainTest.html#M000060">setup (ConstraintSolver::DomainTest)</a><br />
|
|
78
|
+
<a href="classes/ConstraintSolver/ConstraintListTest.html#M000036">setup (ConstraintSolver::ConstraintListTest)</a><br />
|
|
79
|
+
<a href="classes/ConstraintSolver/SolutionTest.html#M000021">setup (ConstraintSolver::SolutionTest)</a><br />
|
|
80
|
+
<a href="classes/ConstraintSolver/ConstraintSolver.html#M000068">solve (ConstraintSolver::ConstraintSolver)</a><br />
|
|
81
|
+
<a href="classes/ConstraintSolver/Domain.html#M000052">sort (ConstraintSolver::Domain)</a><br />
|
|
82
|
+
<a href="classes/ConstraintSolver/ConstraintListTest.html#M000038">testAllDifferentConstraintList (ConstraintSolver::ConstraintListTest)</a><br />
|
|
83
|
+
<a href="classes/ConstraintSolver/ConstraintSolverTest.html#M000033">testAllDifferentProblem (ConstraintSolver::ConstraintSolverTest)</a><br />
|
|
84
|
+
<a href="classes/ConstraintSolver/ConstraintSolverTest.html#M000034">testAllDifferentWithoutAllDifferent (ConstraintSolver::ConstraintSolverTest)</a><br />
|
|
85
|
+
<a href="classes/ConstraintSolver/AllDifferentConstraintTest.html#M000015">testAssigned (ConstraintSolver::AllDifferentConstraintTest)</a><br />
|
|
86
|
+
<a href="classes/ConstraintSolver/BinaryConstraintTest.html#M000073">testAssigned (ConstraintSolver::BinaryConstraintTest)</a><br />
|
|
87
|
+
<a href="classes/ConstraintSolver/VariableTest.html#M000046">testAssignment (ConstraintSolver::VariableTest)</a><br />
|
|
88
|
+
<a href="classes/ConstraintSolver/ProblemTest.html#M000086">testConstructor (ConstraintSolver::ProblemTest)</a><br />
|
|
89
|
+
<a href="classes/ConstraintSolver/AllDifferentConstraintTest.html#M000014">testConstructor (ConstraintSolver::AllDifferentConstraintTest)</a><br />
|
|
90
|
+
<a href="classes/ConstraintSolver/DomainTest.html#M000061">testConstructor (ConstraintSolver::DomainTest)</a><br />
|
|
91
|
+
<a href="classes/ConstraintSolver/ConstraintSolverTest.html#M000030">testConstructor (ConstraintSolver::ConstraintSolverTest)</a><br />
|
|
92
|
+
<a href="classes/ConstraintSolver/BinaryRelationTest.html#M000096">testConstructor (ConstraintSolver::BinaryRelationTest)</a><br />
|
|
93
|
+
<a href="classes/ConstraintSolver/SolutionTest.html#M000022">testConstructor (ConstraintSolver::SolutionTest)</a><br />
|
|
94
|
+
<a href="classes/ConstraintSolver/BinaryConstraintTest.html#M000072">testConstructor (ConstraintSolver::BinaryConstraintTest)</a><br />
|
|
95
|
+
<a href="classes/ConstraintSolver/VariableTest.html#M000045">testConstructor (ConstraintSolver::VariableTest)</a><br />
|
|
96
|
+
<a href="classes/ConstraintSolver/DomainTest.html#M000062">testDomainAddDelete (ConstraintSolver::DomainTest)</a><br />
|
|
97
|
+
<a href="classes/ConstraintSolver/AllDifferentConstraintTest.html#M000020">testDomainWipeout (ConstraintSolver::AllDifferentConstraintTest)</a><br />
|
|
98
|
+
<a href="classes/ExtensionsTest.html#M000007">testEachAfter (ExtensionsTest)</a><br />
|
|
99
|
+
<a href="classes/ConstraintSolver/BinaryConstraintTest.html#M000076">testEquals (ConstraintSolver::BinaryConstraintTest)</a><br />
|
|
100
|
+
<a href="classes/ConstraintSolver/DomainTest.html#M000066">testEquals (ConstraintSolver::DomainTest)</a><br />
|
|
101
|
+
<a href="classes/ConstraintSolver/VariableTest.html#M000047">testEquals (ConstraintSolver::VariableTest)</a><br />
|
|
102
|
+
<a href="classes/ConstraintSolver/AllDifferentConstraintTest.html#M000017">testEquals (ConstraintSolver::AllDifferentConstraintTest)</a><br />
|
|
103
|
+
<a href="classes/ExtensionsTest.html#M000006">testFoldLeft (ExtensionsTest)</a><br />
|
|
104
|
+
<a href="classes/ConstraintSolver/BinaryConstraintTest.html#M000075">testHolds (ConstraintSolver::BinaryConstraintTest)</a><br />
|
|
105
|
+
<a href="classes/ConstraintSolver/AllDifferentConstraintTest.html#M000018">testHolds (ConstraintSolver::AllDifferentConstraintTest)</a><br />
|
|
106
|
+
<a href="classes/ConstraintSolver/AllDifferentConstraintTest.html#M000016">testInclude (ConstraintSolver::AllDifferentConstraintTest)</a><br />
|
|
107
|
+
<a href="classes/ConstraintSolver/BinaryConstraintTest.html#M000074">testInclude (ConstraintSolver::BinaryConstraintTest)</a><br />
|
|
108
|
+
<a href="classes/ConstraintSolver/ConstraintListTest.html#M000037">testNotAllAssignedWithVariable (ConstraintSolver::ConstraintListTest)</a><br />
|
|
109
|
+
<a href="classes/ConstraintSolver/DomainTest.html#M000064">testPruneScalar (ConstraintSolver::DomainTest)</a><br />
|
|
110
|
+
<a href="classes/ConstraintSolver/DomainTest.html#M000063">testPruneSet (ConstraintSolver::DomainTest)</a><br />
|
|
111
|
+
<a href="classes/ConstraintSolver/DomainTest.html#M000065">testPruneWithErrors (ConstraintSolver::DomainTest)</a><br />
|
|
112
|
+
<a href="classes/ExtensionsTest.html#M000005">testRest (ExtensionsTest)</a><br />
|
|
113
|
+
<a href="classes/ConstraintSolver/BinaryConstraintTest.html#M000077">testRevise (ConstraintSolver::BinaryConstraintTest)</a><br />
|
|
114
|
+
<a href="classes/ConstraintSolver/AllDifferentConstraintTest.html#M000019">testRevise (ConstraintSolver::AllDifferentConstraintTest)</a><br />
|
|
115
|
+
<a href="classes/ConstraintSolver/ConstraintSolverTest.html#M000031">testSolvableProblem (ConstraintSolver::ConstraintSolverTest)</a><br />
|
|
116
|
+
<a href="classes/ConstraintSolver/ConstraintSolverTest.html#M000032">testUnsolvableProblem (ConstraintSolver::ConstraintSolverTest)</a><br />
|
|
117
|
+
<a href="classes/ConstraintSolver/SolutionTest.html#M000023">testValues (ConstraintSolver::SolutionTest)</a><br />
|
|
118
|
+
<a href="classes/ConstraintSolver/ConstraintSolverTest.html#M000035">testVariableAndValueOrdering (ConstraintSolver::ConstraintSolverTest)</a><br />
|
|
119
|
+
<a href="classes/ConstraintSolver/BinaryConstraint.html#M000091">to_s (ConstraintSolver::BinaryConstraint)</a><br />
|
|
120
|
+
<a href="classes/ConstraintSolver/Domain.html#M000058">to_s (ConstraintSolver::Domain)</a><br />
|
|
121
|
+
<a href="classes/ConstraintSolver/Solution.html#M000043">to_s (ConstraintSolver::Solution)</a><br />
|
|
122
|
+
<a href="classes/ConstraintSolver/BinaryRelation.html#M000012">to_s (ConstraintSolver::BinaryRelation)</a><br />
|
|
123
|
+
<a href="classes/ConstraintSolver/AllDifferentConstraint.html#M000103">to_s (ConstraintSolver::AllDifferentConstraint)</a><br />
|
|
124
|
+
<a href="classes/ConstraintSolver/Variable.html#M000081">to_s (ConstraintSolver::Variable)</a><br />
|
|
125
|
+
<a href="classes/ConstraintSolver/BinaryConstraint.html#M000092">to_s_full (ConstraintSolver::BinaryConstraint)</a><br />
|
|
126
|
+
<a href="classes/ConstraintSolver/AllDifferentConstraint.html#M000104">to_s_full (ConstraintSolver::AllDifferentConstraint)</a><br />
|
|
127
|
+
<a href="classes/ConstraintSolver/Domain.html#M000056">undoPruning (ConstraintSolver::Domain)</a><br />
|
|
128
|
+
<a href="classes/ConstraintSolver/Variable.html#M000079">value= (ConstraintSolver::Variable)</a><br />
|
|
129
|
+
<a href="classes/ConstraintSolver/Variable.html#M000080">values (ConstraintSolver::Variable)</a><br />
|
|
130
|
+
</div>
|
|
131
|
+
</div>
|
|
132
|
+
</body>
|
|
133
|
+
</html>
|
data/doc/index.html
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
2
|
+
<!DOCTYPE html
|
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
|
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
|
|
5
|
+
|
|
6
|
+
<!--
|
|
7
|
+
|
|
8
|
+
RDoc Documentation
|
|
9
|
+
|
|
10
|
+
-->
|
|
11
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
12
|
+
<head>
|
|
13
|
+
<title>RDoc Documentation</title>
|
|
14
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
|
15
|
+
</head>
|
|
16
|
+
<frameset rows="20%, 80%">
|
|
17
|
+
<frameset cols="25%,35%,45%">
|
|
18
|
+
<frame src="fr_file_index.html" title="Files" name="Files" />
|
|
19
|
+
<frame src="fr_class_index.html" name="Classes" />
|
|
20
|
+
<frame src="fr_method_index.html" name="Methods" />
|
|
21
|
+
</frameset>
|
|
22
|
+
<frame src="files/test/extensionsTest_rb.html" name="docwin" />
|
|
23
|
+
</frameset>
|
|
24
|
+
</html>
|
data/examples/example.rb
ADDED
data/examples/queens.rb
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
q1 = Variable.new("q1", Domain.new((1..4).to_set))
|
|
2
|
+
q2 = Variable.new("q2", Domain.new((1..4).to_set))
|
|
3
|
+
q3 = Variable.new("q3", Domain.new((1..4).to_set))
|
|
4
|
+
q4 = Variable.new("q4", Domain.new((1..4).to_set))
|
|
5
|
+
|
|
6
|
+
alldiff = AllDifferentConstraint.new([q1, q2, q3, q4])
|
|
7
|
+
tup1 = TupleConstraint.new([q1, q2], [[1, 2], [2, 1], [2, 3], [3, 2], [3, 4], [4, 3]], false)
|
|
8
|
+
tup2 = TupleConstraint.new([q2, q3], [[1, 2], [2, 1], [2, 3], [3, 2], [3, 4], [4, 3]], false)
|
|
9
|
+
tup3 = TupleConstraint.new([q3, q4], [[1, 2], [2, 1], [2, 3], [3, 2], [3, 4], [4, 3]], false)
|
|
10
|
+
|
|
11
|
+
queens = Problem.new([q1, q2, q3, q4], ConstraintList.new([alldiff, tup1, tup2, tup3]))
|
|
12
|
+
|
|
13
|
+
puts solve(queens)
|
data/examples/soft.rb
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
a = Variable.new("a", Domain.new([1, 2, 3].to_set))
|
|
2
|
+
b = Variable.new("b", Domain.new([1, 2, 3].to_set))
|
|
3
|
+
c = Variable.new("c", Domain.new([1, 2, 3].to_set))
|
|
4
|
+
d = Variable.new("d", Domain.new([1, 2, 3].to_set))
|
|
5
|
+
|
|
6
|
+
alldiff = AllDifferentConstraint.new([a, b, c, d], 0.1)
|
|
7
|
+
rel = BinaryRelation.new("<")
|
|
8
|
+
b1 = BinaryConstraint.new(a, b, rel, 0.5)
|
|
9
|
+
b2 = BinaryConstraint.new(b, c, rel, 0.5)
|
|
10
|
+
b3 = BinaryConstraint.new(c, d, rel, 0.5)
|
|
11
|
+
|
|
12
|
+
problem = Problem.new([a, b, c, d], ConstraintList.new([alldiff, b1, b2, b3]), {}, false, 1)
|
|
13
|
+
|
|
14
|
+
puts solve(problem)
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
#!/usr/bin/ruby
|
|
2
|
+
|
|
3
|
+
module ConstraintSolver
|
|
4
|
+
# Represents a constraint. To be used as a guidance to see which methods
|
|
5
|
+
# constraints need to implement.
|
|
6
|
+
class AbstractConstraint
|
|
7
|
+
# Checks whether the constraint holds for the current assignments of the
|
|
8
|
+
# involved variables.
|
|
9
|
+
def holds?
|
|
10
|
+
raise RuntimeError, "must implement holds?"
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
# Checks whether all variables involved in the constraint have values
|
|
14
|
+
# assigned to them.
|
|
15
|
+
def allAssigned?
|
|
16
|
+
raise RuntimeError, "must implement allAssigned?"
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
# Checks whether the constraint includes variable.
|
|
20
|
+
def include?(variable)
|
|
21
|
+
raise RuntimeError, "must implement include?(variable)"
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# Iterates over all the variables involved in the constraint.
|
|
25
|
+
def each
|
|
26
|
+
raise RuntimeError, "must implement each"
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# Prunes the values from the domains of the involved variables that
|
|
30
|
+
# cannot be assigned to the respective variables because the constraint
|
|
31
|
+
# would be violated. Returns a list of the variables whose domains were
|
|
32
|
+
# pruned, the number of times the constraint was checked, and whether a
|
|
33
|
+
# domain wipeout occured.
|
|
34
|
+
def revise
|
|
35
|
+
raise RuntimeError, "must implement revise"
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
# Returns the cost of violating the constraint. This should be infinity
|
|
39
|
+
# (or reasonably close to it) for hard constraints and a positive number
|
|
40
|
+
# for soft constraints.
|
|
41
|
+
def violationCost
|
|
42
|
+
raise RuntimeError, "must implement violationCost"
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
#!/usr/bin/ruby
|
|
2
|
+
|
|
3
|
+
require 'extensions'
|
|
4
|
+
require 'AbstractConstraint'
|
|
5
|
+
require 'GraphUtils'
|
|
6
|
+
require 'set'
|
|
7
|
+
|
|
8
|
+
module ConstraintSolver
|
|
9
|
+
# Represents the all different constraint.
|
|
10
|
+
class AllDifferentConstraint < AbstractConstraint
|
|
11
|
+
attr_reader :variables, :violationCost
|
|
12
|
+
# Initialises a new all different constraint.
|
|
13
|
+
# The constructor takes the list of variables that must be different as
|
|
14
|
+
# an argument. Optionally, a cost for violating the constraint can be
|
|
15
|
+
# specified.
|
|
16
|
+
def initialize(variables, violationCost=1)
|
|
17
|
+
if variables.empty? or variables.size == 1
|
|
18
|
+
raise ArgumentError, "List of variables must contain at least two elements!"
|
|
19
|
+
end
|
|
20
|
+
@variables = variables
|
|
21
|
+
@violationCost = violationCost
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# Checks whether all the variables have different values assigned to
|
|
25
|
+
# them.
|
|
26
|
+
def holds?
|
|
27
|
+
assigned = @variables.select { |var| var.assigned? }
|
|
28
|
+
assigned.each { |variable|
|
|
29
|
+
assigned.eachAfter(variable) { |otherVariable|
|
|
30
|
+
if variable.value == otherVariable.value
|
|
31
|
+
return false
|
|
32
|
+
end
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return true
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def allAssigned?
|
|
39
|
+
@variables.each { |var|
|
|
40
|
+
return false if not var.assigned?
|
|
41
|
+
}
|
|
42
|
+
return true
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def include?(variable)
|
|
46
|
+
@variables.include?(variable)
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def to_s
|
|
50
|
+
@variables.collect { |var| var.name }.join(" != ")
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def to_s_full
|
|
54
|
+
@variables.collect { |var| var.to_s }.join(" != ")
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def ==(constraint)
|
|
58
|
+
return false unless constraint.kind_of?(AllDifferentConstraint)
|
|
59
|
+
(@variables == constraint.variables) and (@violationCost == constraint.violationCost)
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def each
|
|
63
|
+
@variables.each { |var|
|
|
64
|
+
yield var
|
|
65
|
+
}
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
def revise_decomposed_local
|
|
69
|
+
revisedVariables = []
|
|
70
|
+
wipeout = false
|
|
71
|
+
pruneList = Set.new
|
|
72
|
+
assignedVariables, unassignedVariables = @variables.partition { |var| var.assigned? }
|
|
73
|
+
pruneList.merge(assignedVariables.collect { |var| var.value })
|
|
74
|
+
unassignedVariables.find_all { |var| var.domain.include_any?(pruneList) }.each { |var|
|
|
75
|
+
begin
|
|
76
|
+
var.domain.prune(pruneList)
|
|
77
|
+
rescue DomainWipeoutException
|
|
78
|
+
wipeout = true
|
|
79
|
+
end
|
|
80
|
+
revisedVariables << var
|
|
81
|
+
break if wipeout
|
|
82
|
+
}
|
|
83
|
+
unless wipeout
|
|
84
|
+
workQueue = unassignedVariables.find_all { |var| var.domain.size == 1 }
|
|
85
|
+
while not workQueue.empty?
|
|
86
|
+
currentVariable = workQueue.shift
|
|
87
|
+
currentValue = currentVariable.domain.first
|
|
88
|
+
((unassignedVariables - [ currentVariable ]).find_all { |var|
|
|
89
|
+
var.domain.include?(currentValue)
|
|
90
|
+
}).each { |var|
|
|
91
|
+
begin
|
|
92
|
+
var.domain.prune(currentValue)
|
|
93
|
+
rescue DomainWipeoutException
|
|
94
|
+
wipeout = true
|
|
95
|
+
end
|
|
96
|
+
revisedVariables << var
|
|
97
|
+
break if wipeout
|
|
98
|
+
workQueue << var if var.domain.size == 1
|
|
99
|
+
}
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
unless wipeout
|
|
103
|
+
# check satisfiability
|
|
104
|
+
valueList = Set.new
|
|
105
|
+
unassignedVariables.each { |var|
|
|
106
|
+
valueList.merge(var.values)
|
|
107
|
+
}
|
|
108
|
+
if unassignedVariables.size > valueList.size
|
|
109
|
+
wipeout = true
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
end
|
|
113
|
+
return revisedVariables, 0, wipeout
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
# hyperarc consistency algorithm due Regin (1994)
|
|
117
|
+
def revise_hyperarc
|
|
118
|
+
wipeout = false
|
|
119
|
+
unless @value_graph
|
|
120
|
+
e = Hash.new
|
|
121
|
+
@variables.each { |var|
|
|
122
|
+
e[var.name] = var.domain.values.dup
|
|
123
|
+
}
|
|
124
|
+
@value_graph = GraphUtils::BipartiteGraph.new(e.keys.to_set, e.values.to_set.flatten, e)
|
|
125
|
+
else
|
|
126
|
+
# update graph
|
|
127
|
+
@value_graph.e.clear
|
|
128
|
+
@variables.each { |var|
|
|
129
|
+
@value_graph.e[var.name] = var.domain.values.dup
|
|
130
|
+
}
|
|
131
|
+
# The set of values is not updated because spurious values with
|
|
132
|
+
# no edges attached to them add only minimal overhead
|
|
133
|
+
#@value_graph.y = @value_graph.e.values.to_set.flatten
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
matching = @value_graph.maximum_matching
|
|
137
|
+
if matching.size < @variables.size
|
|
138
|
+
return [], 0, true
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
pruneMap = @value_graph.removable_values(matching)
|
|
142
|
+
|
|
143
|
+
revisedVariables = Array.new
|
|
144
|
+
pruneMap.each { |name,pruneList|
|
|
145
|
+
var = @variables.find { |var| var.name == name }
|
|
146
|
+
begin
|
|
147
|
+
var.domain.prune(pruneList)
|
|
148
|
+
rescue DomainWipeoutException
|
|
149
|
+
wipeout = true
|
|
150
|
+
end
|
|
151
|
+
revisedVariables << var
|
|
152
|
+
break if wipeout
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
return revisedVariables, 0, wipeout
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
alias_method :revise, :revise_decomposed_local
|
|
159
|
+
end
|
|
160
|
+
end
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
#!/usr/bin/ruby
|
|
2
|
+
|
|
3
|
+
require 'AbstractConstraint'
|
|
4
|
+
require 'extensions'
|
|
5
|
+
|
|
6
|
+
module ConstraintSolver
|
|
7
|
+
# Represents a binary constraint.
|
|
8
|
+
class BinaryConstraint < AbstractConstraint
|
|
9
|
+
attr_reader :lhs, :rhs, :relation, :violationCost
|
|
10
|
+
# Initialises a new binary constraint.
|
|
11
|
+
# The arguments are the variable at the left hand side of the relation,
|
|
12
|
+
# the variable at the right hand side of the relation and the relation
|
|
13
|
+
# itself. Optionally, a cost for violating the constraint can be
|
|
14
|
+
# specified.
|
|
15
|
+
def initialize(lhs, rhs, relation, violationCost=1)
|
|
16
|
+
if relation.arity != 2
|
|
17
|
+
raise ArgumentError, "The relation given must take two arguments!"
|
|
18
|
+
end
|
|
19
|
+
@lhs = lhs
|
|
20
|
+
@rhs = rhs
|
|
21
|
+
@relation = relation
|
|
22
|
+
@supported = { @lhs.name => {}, @rhs.name => {} }
|
|
23
|
+
[ @lhs, @rhs ].each { |var|
|
|
24
|
+
var.domain.each { |v| @supported[var.name][v] = Set.new }
|
|
25
|
+
}
|
|
26
|
+
@unsupported = { @lhs.name => {}, @rhs.name => {} }
|
|
27
|
+
[ @lhs, @rhs ].each { |var|
|
|
28
|
+
var.domain.each { |v| @unsupported[var.name][v] = Set.new }
|
|
29
|
+
}
|
|
30
|
+
@violationCost = violationCost
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# Checks whether the relation returns true when called with the values
|
|
34
|
+
# assigned to left hand side and right hand side.
|
|
35
|
+
def holds?
|
|
36
|
+
if allAssigned?
|
|
37
|
+
@relation.call(@lhs.value, @rhs.value)
|
|
38
|
+
else
|
|
39
|
+
return true
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def allAssigned?
|
|
44
|
+
@lhs.assigned? and @rhs.assigned?
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def include?(variable)
|
|
48
|
+
(@lhs == variable) or (@rhs == variable)
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def to_s
|
|
52
|
+
@lhs.name + " " + @relation.to_s + " " + @rhs.name
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def to_s_full
|
|
56
|
+
@lhs.to_s + " " + @relation.to_s + " " + @rhs.to_s
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def ==(constraint)
|
|
60
|
+
return false unless constraint.kind_of?(BinaryConstraint)
|
|
61
|
+
(@lhs == constraint.lhs) and (@rhs == constraint.rhs) and
|
|
62
|
+
(@relation == constraint.relation) and (@violationCost == constraint.violationCost)
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def each
|
|
66
|
+
[ @lhs, @rhs ].each { |variable|
|
|
67
|
+
yield variable
|
|
68
|
+
}
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def revise
|
|
72
|
+
checks = 0
|
|
73
|
+
revisedVariables = Array.new
|
|
74
|
+
wipeout = false
|
|
75
|
+
return revisedVariables, checks, wipeout if allAssigned?
|
|
76
|
+
assigned = [ @lhs, @rhs ].find { |var| var.assigned? }
|
|
77
|
+
if assigned.nil?
|
|
78
|
+
pruneListLeft = Set.new
|
|
79
|
+
pruneListRight = Set.new(@rhs.values)
|
|
80
|
+
@lhs.domain.each { |lvalue|
|
|
81
|
+
@lhs.value = lvalue
|
|
82
|
+
pruneList, thisChecks = findSupport(@lhs, @rhs)
|
|
83
|
+
checks += thisChecks
|
|
84
|
+
if pruneList.size == @rhs.values.size
|
|
85
|
+
pruneListLeft << lvalue
|
|
86
|
+
else
|
|
87
|
+
pruneListRight &= pruneList
|
|
88
|
+
end
|
|
89
|
+
}
|
|
90
|
+
@lhs.reset
|
|
91
|
+
unless pruneListLeft.empty?
|
|
92
|
+
begin
|
|
93
|
+
@lhs.domain.prune(pruneListLeft)
|
|
94
|
+
rescue DomainWipeoutException
|
|
95
|
+
wipeout = true
|
|
96
|
+
end
|
|
97
|
+
revisedVariables << @lhs
|
|
98
|
+
end
|
|
99
|
+
unless pruneListRight.empty?
|
|
100
|
+
begin
|
|
101
|
+
@rhs.domain.prune(pruneListRight)
|
|
102
|
+
rescue DomainWipeoutException
|
|
103
|
+
wipeout = true
|
|
104
|
+
end
|
|
105
|
+
revisedVariables << @rhs
|
|
106
|
+
end
|
|
107
|
+
else
|
|
108
|
+
unassigned = ([ @lhs, @rhs ] - [ assigned ]).first
|
|
109
|
+
pruneList, checks = findSupport(assigned, unassigned)
|
|
110
|
+
unless pruneList.empty?
|
|
111
|
+
begin
|
|
112
|
+
unassigned.domain.prune(pruneList)
|
|
113
|
+
rescue DomainWipeoutException
|
|
114
|
+
wipeout = true
|
|
115
|
+
end
|
|
116
|
+
revisedVariables << unassigned
|
|
117
|
+
end
|
|
118
|
+
end
|
|
119
|
+
return revisedVariables, checks, wipeout
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
private
|
|
123
|
+
|
|
124
|
+
# Determines which values in the domain of <i>unassigned</i> are
|
|
125
|
+
# supported by the assignment to <i>assigned</i>.
|
|
126
|
+
# Returned is a list of values which can be pruned from the domain of
|
|
127
|
+
# the unassigned variable and the number of times the constraint was
|
|
128
|
+
# checked during the process.
|
|
129
|
+
def findSupport_ac33_cache(assigned, unassigned)
|
|
130
|
+
checks = 0
|
|
131
|
+
values = unassigned.values - @supported[assigned.name][assigned.value]
|
|
132
|
+
pruneList = Set.new
|
|
133
|
+
pruneList = values & @unsupported[assigned.name][assigned.value]
|
|
134
|
+
values -= @unsupported[assigned.name][assigned.value]
|
|
135
|
+
values.each { |value|
|
|
136
|
+
unassigned.value = value
|
|
137
|
+
checks += 1
|
|
138
|
+
if self.holds?
|
|
139
|
+
@supported[assigned.name][assigned.value] << value
|
|
140
|
+
@supported[unassigned.name][value] << assigned.value
|
|
141
|
+
else
|
|
142
|
+
@unsupported[assigned.name][assigned.value] << value
|
|
143
|
+
@unsupported[unassigned.name][value] << assigned.value
|
|
144
|
+
pruneList << value
|
|
145
|
+
end
|
|
146
|
+
}
|
|
147
|
+
unassigned.reset
|
|
148
|
+
return pruneList, checks
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
def findSupport_ac3(assigned, unassigned)
|
|
152
|
+
checks = 0
|
|
153
|
+
pruneList = Set.new
|
|
154
|
+
unassigned.values.each { |value|
|
|
155
|
+
unassigned.value = value
|
|
156
|
+
checks += 1
|
|
157
|
+
pruneList << value unless self.holds?
|
|
158
|
+
}
|
|
159
|
+
unassigned.reset
|
|
160
|
+
return pruneList, checks
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
alias_method :findSupport, :findSupport_ac3
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
# Represents a binary relation.
|
|
167
|
+
class BinaryRelation
|
|
168
|
+
def initialize(string)
|
|
169
|
+
if string == "!="
|
|
170
|
+
string = "not_equal?"
|
|
171
|
+
end
|
|
172
|
+
@string = string
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
def call(a, b)
|
|
176
|
+
return a.send(@string, b)
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
def arity
|
|
180
|
+
return 2
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
def to_s
|
|
184
|
+
@string
|
|
185
|
+
end
|
|
186
|
+
end
|
|
187
|
+
end
|