ConstraintSolver 0.1
Sign up to get free protection for your applications and to get access to all the features.
- 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,158 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Class: ConstraintSolver::UndoStackEmptyException</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<table class="header-table">
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>Class</strong></td>
|
53
|
+
<td class="class-name-in-header">ConstraintSolver::UndoStackEmptyException</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../files/lib/Domain_rb.html">
|
59
|
+
lib/Domain.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
<tr class="top-aligned-row">
|
66
|
+
<td><strong>Parent:</strong></td>
|
67
|
+
<td>
|
68
|
+
Exception
|
69
|
+
</td>
|
70
|
+
</tr>
|
71
|
+
</table>
|
72
|
+
</div>
|
73
|
+
<!-- banner header -->
|
74
|
+
|
75
|
+
<div id="bodyContent">
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
<div id="contextContent">
|
80
|
+
<div id="diagram">
|
81
|
+
<map id="map" name="map">
|
82
|
+
<area shape="rect" coords="1537,5,1665,53" href="../Test/Unit/TestCase.html" alt="Test::Unit::TestCase" />
|
83
|
+
<area shape="rect" coords="937,133,1089,181" href="AllDifferentConstraintTest.html" alt="AllDifferentConstraintTest" />
|
84
|
+
<area shape="rect" coords="2305,133,2396,181" href="SolutionTest.html" alt="SolutionTest" />
|
85
|
+
<area shape="rect" coords="204,133,335,181" href="ConstraintSolverTest.html" alt="ConstraintSolverTest" />
|
86
|
+
<area shape="rect" coords="1923,133,2040,181" href="ConstraintListTest.html" alt="ConstraintListTest" />
|
87
|
+
<area shape="rect" coords="1123,133,1213,181" href="VariableTest.html" alt="VariableTest" />
|
88
|
+
<area shape="rect" coords="2429,133,2517,181" href="DomainTest.html" alt="DomainTest" />
|
89
|
+
<area shape="rect" coords="1387,133,1517,181" href="BinaryConstraintTest.html" alt="BinaryConstraintTest" />
|
90
|
+
<area shape="rect" coords="1797,133,1888,181" href="ProblemTest.html" alt="ProblemTest" />
|
91
|
+
<area shape="rect" coords="1541,133,1661,181" href="BinaryRelationTest.html" alt="BinaryRelationTest" />
|
92
|
+
<area shape="rect" coords="589,5,667,53" href="../Exception.html" alt="Exception" />
|
93
|
+
<area shape="rect" coords="463,133,615,181" href="DomainWipeoutException.html" alt="DomainWipeoutException" />
|
94
|
+
<area shape="rect" coords="639,133,799,181" href="UndoStackEmptyException.html" alt="UndoStackEmptyException" />
|
95
|
+
<area shape="rect" coords="53,133,171,181" href="AbstractConstraint.html" alt="AbstractConstraint" />
|
96
|
+
<area shape="rect" coords="160,237,269,285" href="BinaryConstraint.html" alt="BinaryConstraint" />
|
97
|
+
<area shape="rect" coords="301,237,432,285" href="AllDifferentConstraint.html" alt="AllDifferentConstraint" />
|
98
|
+
<area shape="rect" coords="2085,5,2157,53" href="../Array.html" alt="Array" />
|
99
|
+
<area shape="rect" coords="2073,133,2169,181" href="ConstraintList.html" alt="ConstraintList" />
|
100
|
+
<area shape="rect" coords="37,237,136,285" href="BinaryRelation.html" alt="BinaryRelation" />
|
101
|
+
<area shape="rect" coords="2201,133,2273,181" href="Variable.html" alt="Variable" />
|
102
|
+
<area shape="rect" coords="1693,133,1765,181" href="Solution.html" alt="Solution" />
|
103
|
+
<area shape="rect" coords="1245,133,1355,181" href="ConstraintSolver.html" alt="ConstraintSolver" />
|
104
|
+
<area shape="rect" coords="831,133,903,181" href="Problem.html" alt="Problem" />
|
105
|
+
<area shape="rect" coords="367,133,439,181" href="Domain.html" alt="Domain" />
|
106
|
+
<area shape="rect" coords="2419,99,2531,192" href="../ConstraintSolver.html" alt="test/DomainTest.rb" />
|
107
|
+
<area shape="rect" coords="2295,99,2408,192" href="../ConstraintSolver.html" alt="test/SolutionTest.rb" />
|
108
|
+
<area shape="rect" coords="27,203,280,296" href="../ConstraintSolver.html" alt="lib/BinaryConstraint.rb" />
|
109
|
+
<area shape="rect" coords="2191,99,2284,192" href="../ConstraintSolver.html" alt="lib/Variable.rb" />
|
110
|
+
<area shape="rect" coords="1912,99,2052,192" href="../ConstraintSolver.html" alt="test/ConstraintListTest.rb" />
|
111
|
+
<area shape="rect" coords="2063,99,2180,192" href="../ConstraintSolver.html" alt="lib/ConstraintList.rb" />
|
112
|
+
<area shape="rect" coords="1787,99,1901,192" href="../ConstraintSolver.html" alt="test/ProblemTest.rb" />
|
113
|
+
<area shape="rect" coords="1683,99,1776,192" href="../ConstraintSolver.html" alt="lib/Solution.rb" />
|
114
|
+
<area shape="rect" coords="1376,99,1672,192" href="../ConstraintSolver.html" alt="test/BinaryConstraintTest.rb" />
|
115
|
+
<area shape="rect" coords="1235,99,1365,192" href="../ConstraintSolver.html" alt="lib/ConstraintSolver.rb" />
|
116
|
+
<area shape="rect" coords="1111,99,1224,192" href="../ConstraintSolver.html" alt="test/VariableTest.rb" />
|
117
|
+
<area shape="rect" coords="924,99,1100,192" href="../ConstraintSolver.html" alt="test/AllDifferentConstraintTest.rb" />
|
118
|
+
<area shape="rect" coords="291,203,443,296" href="../ConstraintSolver.html" alt="lib/AllDifferentConstraint.rb" />
|
119
|
+
<area shape="rect" coords="820,99,913,192" href="../ConstraintSolver.html" alt="lib/Problem.rb" />
|
120
|
+
<area shape="rect" coords="192,99,345,192" href="../ConstraintSolver.html" alt="test/ConstraintSolverTest.rb" />
|
121
|
+
<area shape="rect" coords="356,99,809,192" href="../ConstraintSolver.html" alt="lib/Domain.rb" />
|
122
|
+
<area shape="rect" coords="43,99,181,192" href="../ConstraintSolver.html" alt="lib/AbstractConstraint.rb" />
|
123
|
+
<area shape="rect" coords="16,64,2541,307" href="../ConstraintSolver.html" alt="ConstraintSolver" />
|
124
|
+
</map>
|
125
|
+
<img src="../../dot/m_19_0.png" usemap="#map" border="0" alt="dot/m_19_0.png">
|
126
|
+
</div>
|
127
|
+
|
128
|
+
|
129
|
+
|
130
|
+
</div>
|
131
|
+
|
132
|
+
|
133
|
+
</div>
|
134
|
+
|
135
|
+
|
136
|
+
<!-- if includes -->
|
137
|
+
|
138
|
+
<div id="section">
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
<!-- if method_list -->
|
148
|
+
|
149
|
+
|
150
|
+
</div>
|
151
|
+
|
152
|
+
|
153
|
+
<div id="validator-badges">
|
154
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
155
|
+
</div>
|
156
|
+
|
157
|
+
</body>
|
158
|
+
</html>
|
@@ -0,0 +1,418 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Class: ConstraintSolver::Variable</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<table class="header-table">
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>Class</strong></td>
|
53
|
+
<td class="class-name-in-header">ConstraintSolver::Variable</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../files/lib/Variable_rb.html">
|
59
|
+
lib/Variable.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
<tr class="top-aligned-row">
|
66
|
+
<td><strong>Parent:</strong></td>
|
67
|
+
<td>
|
68
|
+
Object
|
69
|
+
</td>
|
70
|
+
</tr>
|
71
|
+
</table>
|
72
|
+
</div>
|
73
|
+
<!-- banner header -->
|
74
|
+
|
75
|
+
<div id="bodyContent">
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
<div id="contextContent">
|
80
|
+
<div id="diagram">
|
81
|
+
<map id="map" name="map">
|
82
|
+
<area shape="rect" coords="1537,5,1665,53" href="../Test/Unit/TestCase.html" alt="Test::Unit::TestCase" />
|
83
|
+
<area shape="rect" coords="937,133,1089,181" href="AllDifferentConstraintTest.html" alt="AllDifferentConstraintTest" />
|
84
|
+
<area shape="rect" coords="2305,133,2396,181" href="SolutionTest.html" alt="SolutionTest" />
|
85
|
+
<area shape="rect" coords="204,133,335,181" href="ConstraintSolverTest.html" alt="ConstraintSolverTest" />
|
86
|
+
<area shape="rect" coords="1923,133,2040,181" href="ConstraintListTest.html" alt="ConstraintListTest" />
|
87
|
+
<area shape="rect" coords="1123,133,1213,181" href="VariableTest.html" alt="VariableTest" />
|
88
|
+
<area shape="rect" coords="2429,133,2517,181" href="DomainTest.html" alt="DomainTest" />
|
89
|
+
<area shape="rect" coords="1387,133,1517,181" href="BinaryConstraintTest.html" alt="BinaryConstraintTest" />
|
90
|
+
<area shape="rect" coords="1797,133,1888,181" href="ProblemTest.html" alt="ProblemTest" />
|
91
|
+
<area shape="rect" coords="1541,133,1661,181" href="BinaryRelationTest.html" alt="BinaryRelationTest" />
|
92
|
+
<area shape="rect" coords="589,5,667,53" href="../Exception.html" alt="Exception" />
|
93
|
+
<area shape="rect" coords="463,133,615,181" href="DomainWipeoutException.html" alt="DomainWipeoutException" />
|
94
|
+
<area shape="rect" coords="639,133,799,181" href="UndoStackEmptyException.html" alt="UndoStackEmptyException" />
|
95
|
+
<area shape="rect" coords="53,133,171,181" href="AbstractConstraint.html" alt="AbstractConstraint" />
|
96
|
+
<area shape="rect" coords="160,237,269,285" href="BinaryConstraint.html" alt="BinaryConstraint" />
|
97
|
+
<area shape="rect" coords="301,237,432,285" href="AllDifferentConstraint.html" alt="AllDifferentConstraint" />
|
98
|
+
<area shape="rect" coords="2085,5,2157,53" href="../Array.html" alt="Array" />
|
99
|
+
<area shape="rect" coords="2073,133,2169,181" href="ConstraintList.html" alt="ConstraintList" />
|
100
|
+
<area shape="rect" coords="37,237,136,285" href="BinaryRelation.html" alt="BinaryRelation" />
|
101
|
+
<area shape="rect" coords="2201,133,2273,181" href="Variable.html" alt="Variable" />
|
102
|
+
<area shape="rect" coords="1693,133,1765,181" href="Solution.html" alt="Solution" />
|
103
|
+
<area shape="rect" coords="1245,133,1355,181" href="ConstraintSolver.html" alt="ConstraintSolver" />
|
104
|
+
<area shape="rect" coords="831,133,903,181" href="Problem.html" alt="Problem" />
|
105
|
+
<area shape="rect" coords="367,133,439,181" href="Domain.html" alt="Domain" />
|
106
|
+
<area shape="rect" coords="2419,99,2531,192" href="../ConstraintSolver.html" alt="test/DomainTest.rb" />
|
107
|
+
<area shape="rect" coords="2295,99,2408,192" href="../ConstraintSolver.html" alt="test/SolutionTest.rb" />
|
108
|
+
<area shape="rect" coords="27,203,280,296" href="../ConstraintSolver.html" alt="lib/BinaryConstraint.rb" />
|
109
|
+
<area shape="rect" coords="2191,99,2284,192" href="../ConstraintSolver.html" alt="lib/Variable.rb" />
|
110
|
+
<area shape="rect" coords="1912,99,2052,192" href="../ConstraintSolver.html" alt="test/ConstraintListTest.rb" />
|
111
|
+
<area shape="rect" coords="2063,99,2180,192" href="../ConstraintSolver.html" alt="lib/ConstraintList.rb" />
|
112
|
+
<area shape="rect" coords="1787,99,1901,192" href="../ConstraintSolver.html" alt="test/ProblemTest.rb" />
|
113
|
+
<area shape="rect" coords="1683,99,1776,192" href="../ConstraintSolver.html" alt="lib/Solution.rb" />
|
114
|
+
<area shape="rect" coords="1376,99,1672,192" href="../ConstraintSolver.html" alt="test/BinaryConstraintTest.rb" />
|
115
|
+
<area shape="rect" coords="1235,99,1365,192" href="../ConstraintSolver.html" alt="lib/ConstraintSolver.rb" />
|
116
|
+
<area shape="rect" coords="1111,99,1224,192" href="../ConstraintSolver.html" alt="test/VariableTest.rb" />
|
117
|
+
<area shape="rect" coords="924,99,1100,192" href="../ConstraintSolver.html" alt="test/AllDifferentConstraintTest.rb" />
|
118
|
+
<area shape="rect" coords="291,203,443,296" href="../ConstraintSolver.html" alt="lib/AllDifferentConstraint.rb" />
|
119
|
+
<area shape="rect" coords="820,99,913,192" href="../ConstraintSolver.html" alt="lib/Problem.rb" />
|
120
|
+
<area shape="rect" coords="192,99,345,192" href="../ConstraintSolver.html" alt="test/ConstraintSolverTest.rb" />
|
121
|
+
<area shape="rect" coords="356,99,809,192" href="../ConstraintSolver.html" alt="lib/Domain.rb" />
|
122
|
+
<area shape="rect" coords="43,99,181,192" href="../ConstraintSolver.html" alt="lib/AbstractConstraint.rb" />
|
123
|
+
<area shape="rect" coords="16,64,2541,307" href="../ConstraintSolver.html" alt="ConstraintSolver" />
|
124
|
+
</map>
|
125
|
+
<img src="../../dot/m_19_0.png" usemap="#map" border="0" alt="dot/m_19_0.png">
|
126
|
+
</div>
|
127
|
+
|
128
|
+
<div id="description">
|
129
|
+
<p>
|
130
|
+
This class represents a variable in a constraint satisfaction problem.
|
131
|
+
</p>
|
132
|
+
|
133
|
+
</div>
|
134
|
+
|
135
|
+
|
136
|
+
</div>
|
137
|
+
|
138
|
+
<div id="method-list">
|
139
|
+
<h3 class="section-bar">Methods</h3>
|
140
|
+
|
141
|
+
<div class="name-list">
|
142
|
+
<a href="#M000082">==</a>
|
143
|
+
<a href="#M000083">assigned?</a>
|
144
|
+
<a href="#M000078">new</a>
|
145
|
+
<a href="#M000084">reset</a>
|
146
|
+
<a href="#M000081">to_s</a>
|
147
|
+
<a href="#M000079">value=</a>
|
148
|
+
<a href="#M000080">values</a>
|
149
|
+
</div>
|
150
|
+
</div>
|
151
|
+
|
152
|
+
</div>
|
153
|
+
|
154
|
+
|
155
|
+
<!-- if includes -->
|
156
|
+
|
157
|
+
<div id="section">
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
<div id="attribute-list">
|
164
|
+
<h3 class="section-bar">Attributes</h3>
|
165
|
+
|
166
|
+
<div class="name-list">
|
167
|
+
<table>
|
168
|
+
<tr class="top-aligned-row context-row">
|
169
|
+
<td class="context-item-name">domain</td>
|
170
|
+
<td class="context-item-value"> [R] </td>
|
171
|
+
<td class="context-item-desc"></td>
|
172
|
+
</tr>
|
173
|
+
<tr class="top-aligned-row context-row">
|
174
|
+
<td class="context-item-name">merit</td>
|
175
|
+
<td class="context-item-value"> [R] </td>
|
176
|
+
<td class="context-item-desc"></td>
|
177
|
+
</tr>
|
178
|
+
<tr class="top-aligned-row context-row">
|
179
|
+
<td class="context-item-name">name</td>
|
180
|
+
<td class="context-item-value"> [R] </td>
|
181
|
+
<td class="context-item-desc"></td>
|
182
|
+
</tr>
|
183
|
+
<tr class="top-aligned-row context-row">
|
184
|
+
<td class="context-item-name">value</td>
|
185
|
+
<td class="context-item-value"> [R] </td>
|
186
|
+
<td class="context-item-desc"></td>
|
187
|
+
</tr>
|
188
|
+
</table>
|
189
|
+
</div>
|
190
|
+
</div>
|
191
|
+
|
192
|
+
|
193
|
+
|
194
|
+
<!-- if method_list -->
|
195
|
+
<div id="methods">
|
196
|
+
<h3 class="section-bar">Public Class methods</h3>
|
197
|
+
|
198
|
+
<div id="method-M000078" class="method-detail">
|
199
|
+
<a name="M000078"></a>
|
200
|
+
|
201
|
+
<div class="method-heading">
|
202
|
+
<a href="#M000078" class="method-signature">
|
203
|
+
<span class="method-name">new</span><span class="method-args">(name, domain=nil, value=nil, merit=0)</span>
|
204
|
+
</a>
|
205
|
+
</div>
|
206
|
+
|
207
|
+
<div class="method-description">
|
208
|
+
<p>
|
209
|
+
Initialises a <a href="Variable.html#M000078">new</a> variable. The name of
|
210
|
+
the variable and at least one of domain or value are required. If domain is
|
211
|
+
nil and a value is given, a <a href="Variable.html#M000078">new</a> <a
|
212
|
+
href="Domain.html">Domain</a> is constructed with only the value specified
|
213
|
+
in it. The fourth argument is the merit of the variable.
|
214
|
+
</p>
|
215
|
+
<p><a class="source-toggle" href="#"
|
216
|
+
onclick="toggleCode('M000078-source');return false;">[Source]</a></p>
|
217
|
+
<div class="method-source-code" id="M000078-source">
|
218
|
+
<pre>
|
219
|
+
<span class="ruby-comment cmt"># File lib/Variable.rb, line 12</span>
|
220
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">domain</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">value</span>=<span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">merit</span>=<span class="ruby-value">0</span>)
|
221
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">name</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-constant">String</span>)
|
222
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">"The name of the variable has to be specified."</span>
|
223
|
+
<span class="ruby-keyword kw">end</span>
|
224
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">domain</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">nil?</span>
|
225
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">"At least one of domain or value are required."</span>
|
226
|
+
<span class="ruby-keyword kw">end</span>
|
227
|
+
<span class="ruby-ivar">@name</span> = <span class="ruby-identifier">name</span>
|
228
|
+
<span class="ruby-ivar">@value</span> = <span class="ruby-identifier">value</span>
|
229
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">domain</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-keyword kw">and</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">domain</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-constant">Domain</span>)
|
230
|
+
<span class="ruby-identifier">domain</span> = <span class="ruby-constant">Domain</span>.<span class="ruby-identifier">new</span>([ <span class="ruby-identifier">domain</span> ].<span class="ruby-identifier">to_set</span>);
|
231
|
+
<span class="ruby-keyword kw">end</span>
|
232
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">nil?</span>
|
233
|
+
<span class="ruby-ivar">@domain</span> = <span class="ruby-identifier">domain</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-value">? </span><span class="ruby-constant">Domain</span>.<span class="ruby-identifier">new</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">domain</span>
|
234
|
+
<span class="ruby-keyword kw">else</span>
|
235
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">domain</span>.<span class="ruby-identifier">nil?</span>
|
236
|
+
<span class="ruby-ivar">@domain</span> = <span class="ruby-constant">Domain</span>.<span class="ruby-identifier">new</span>([ <span class="ruby-identifier">value</span> ].<span class="ruby-identifier">to_set</span>)
|
237
|
+
<span class="ruby-keyword kw">else</span>
|
238
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">domain</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">value</span>)
|
239
|
+
<span class="ruby-ivar">@domain</span> = <span class="ruby-identifier">domain</span>
|
240
|
+
<span class="ruby-keyword kw">else</span>
|
241
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">"Value "</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-value str">" not in domain "</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">domain</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-value str">"!"</span>
|
242
|
+
<span class="ruby-keyword kw">end</span>
|
243
|
+
<span class="ruby-keyword kw">end</span>
|
244
|
+
<span class="ruby-keyword kw">end</span>
|
245
|
+
<span class="ruby-ivar">@merit</span> = <span class="ruby-identifier">merit</span>
|
246
|
+
<span class="ruby-keyword kw">end</span>
|
247
|
+
</pre>
|
248
|
+
</div>
|
249
|
+
</div>
|
250
|
+
</div>
|
251
|
+
|
252
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
253
|
+
|
254
|
+
<div id="method-M000082" class="method-detail">
|
255
|
+
<a name="M000082"></a>
|
256
|
+
|
257
|
+
<div class="method-heading">
|
258
|
+
<a href="#M000082" class="method-signature">
|
259
|
+
<span class="method-name">==</span><span class="method-args">(variable)</span>
|
260
|
+
</a>
|
261
|
+
</div>
|
262
|
+
|
263
|
+
<div class="method-description">
|
264
|
+
<p><a class="source-toggle" href="#"
|
265
|
+
onclick="toggleCode('M000082-source');return false;">[Source]</a></p>
|
266
|
+
<div class="method-source-code" id="M000082-source">
|
267
|
+
<pre>
|
268
|
+
<span class="ruby-comment cmt"># File lib/Variable.rb, line 62</span>
|
269
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-operator">==</span>(<span class="ruby-identifier">variable</span>)
|
270
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">variable</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-constant">Variable</span>)
|
271
|
+
(<span class="ruby-ivar">@name</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">variable</span>.<span class="ruby-identifier">name</span>) <span class="ruby-keyword kw">and</span> (<span class="ruby-ivar">@value</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">variable</span>.<span class="ruby-identifier">value</span>)
|
272
|
+
<span class="ruby-keyword kw">end</span>
|
273
|
+
</pre>
|
274
|
+
</div>
|
275
|
+
</div>
|
276
|
+
</div>
|
277
|
+
|
278
|
+
<div id="method-M000083" class="method-detail">
|
279
|
+
<a name="M000083"></a>
|
280
|
+
|
281
|
+
<div class="method-heading">
|
282
|
+
<a href="#M000083" class="method-signature">
|
283
|
+
<span class="method-name">assigned?</span><span class="method-args">()</span>
|
284
|
+
</a>
|
285
|
+
</div>
|
286
|
+
|
287
|
+
<div class="method-description">
|
288
|
+
<p><a class="source-toggle" href="#"
|
289
|
+
onclick="toggleCode('M000083-source');return false;">[Source]</a></p>
|
290
|
+
<div class="method-source-code" id="M000083-source">
|
291
|
+
<pre>
|
292
|
+
<span class="ruby-comment cmt"># File lib/Variable.rb, line 67</span>
|
293
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">assigned?</span>
|
294
|
+
<span class="ruby-keyword kw">not</span> <span class="ruby-ivar">@value</span>.<span class="ruby-identifier">nil?</span>
|
295
|
+
<span class="ruby-keyword kw">end</span>
|
296
|
+
</pre>
|
297
|
+
</div>
|
298
|
+
</div>
|
299
|
+
</div>
|
300
|
+
|
301
|
+
<div id="method-M000084" class="method-detail">
|
302
|
+
<a name="M000084"></a>
|
303
|
+
|
304
|
+
<div class="method-heading">
|
305
|
+
<a href="#M000084" class="method-signature">
|
306
|
+
<span class="method-name">reset</span><span class="method-args">()</span>
|
307
|
+
</a>
|
308
|
+
</div>
|
309
|
+
|
310
|
+
<div class="method-description">
|
311
|
+
<p><a class="source-toggle" href="#"
|
312
|
+
onclick="toggleCode('M000084-source');return false;">[Source]</a></p>
|
313
|
+
<div class="method-source-code" id="M000084-source">
|
314
|
+
<pre>
|
315
|
+
<span class="ruby-comment cmt"># File lib/Variable.rb, line 71</span>
|
316
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">reset</span>
|
317
|
+
<span class="ruby-ivar">@value</span> = <span class="ruby-keyword kw">nil</span>
|
318
|
+
<span class="ruby-keyword kw">end</span>
|
319
|
+
</pre>
|
320
|
+
</div>
|
321
|
+
</div>
|
322
|
+
</div>
|
323
|
+
|
324
|
+
<div id="method-M000081" class="method-detail">
|
325
|
+
<a name="M000081"></a>
|
326
|
+
|
327
|
+
<div class="method-heading">
|
328
|
+
<a href="#M000081" class="method-signature">
|
329
|
+
<span class="method-name">to_s</span><span class="method-args">()</span>
|
330
|
+
</a>
|
331
|
+
</div>
|
332
|
+
|
333
|
+
<div class="method-description">
|
334
|
+
<p><a class="source-toggle" href="#"
|
335
|
+
onclick="toggleCode('M000081-source');return false;">[Source]</a></p>
|
336
|
+
<div class="method-source-code" id="M000081-source">
|
337
|
+
<pre>
|
338
|
+
<span class="ruby-comment cmt"># File lib/Variable.rb, line 58</span>
|
339
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s</span>
|
340
|
+
<span class="ruby-ivar">@name</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-value str">" = "</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@value</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-value str">" \\in "</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@domain</span>.<span class="ruby-identifier">to_s</span>
|
341
|
+
<span class="ruby-keyword kw">end</span>
|
342
|
+
</pre>
|
343
|
+
</div>
|
344
|
+
</div>
|
345
|
+
</div>
|
346
|
+
|
347
|
+
<div id="method-M000079" class="method-detail">
|
348
|
+
<a name="M000079"></a>
|
349
|
+
|
350
|
+
<div class="method-heading">
|
351
|
+
<a href="#M000079" class="method-signature">
|
352
|
+
<span class="method-name">value=</span><span class="method-args">(value)</span>
|
353
|
+
</a>
|
354
|
+
</div>
|
355
|
+
|
356
|
+
<div class="method-description">
|
357
|
+
<p>
|
358
|
+
Assigns a <a href="Variable.html#M000078">new</a> value to the variable.
|
359
|
+
The <a href="Variable.html#M000078">new</a> value has to be in the domain
|
360
|
+
of the variable.
|
361
|
+
</p>
|
362
|
+
<p><a class="source-toggle" href="#"
|
363
|
+
onclick="toggleCode('M000079-source');return false;">[Source]</a></p>
|
364
|
+
<div class="method-source-code" id="M000079-source">
|
365
|
+
<pre>
|
366
|
+
<span class="ruby-comment cmt"># File lib/Variable.rb, line 42</span>
|
367
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">value=</span>(<span class="ruby-identifier">value</span>)
|
368
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">nil?</span>
|
369
|
+
<span class="ruby-keyword kw">return</span>
|
370
|
+
<span class="ruby-keyword kw">end</span>
|
371
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@domain</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">value</span>)
|
372
|
+
<span class="ruby-ivar">@value</span> = <span class="ruby-identifier">value</span>
|
373
|
+
<span class="ruby-keyword kw">else</span>
|
374
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">"The domain of "</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@name</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-value str">" ("</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@domain</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span>
|
375
|
+
<span class="ruby-value str">") does not contain "</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">value</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-value str">"!"</span>
|
376
|
+
<span class="ruby-keyword kw">end</span>
|
377
|
+
<span class="ruby-keyword kw">end</span>
|
378
|
+
</pre>
|
379
|
+
</div>
|
380
|
+
</div>
|
381
|
+
</div>
|
382
|
+
|
383
|
+
<div id="method-M000080" class="method-detail">
|
384
|
+
<a name="M000080"></a>
|
385
|
+
|
386
|
+
<div class="method-heading">
|
387
|
+
<a href="#M000080" class="method-signature">
|
388
|
+
<span class="method-name">values</span><span class="method-args">()</span>
|
389
|
+
</a>
|
390
|
+
</div>
|
391
|
+
|
392
|
+
<div class="method-description">
|
393
|
+
<p><a class="source-toggle" href="#"
|
394
|
+
onclick="toggleCode('M000080-source');return false;">[Source]</a></p>
|
395
|
+
<div class="method-source-code" id="M000080-source">
|
396
|
+
<pre>
|
397
|
+
<span class="ruby-comment cmt"># File lib/Variable.rb, line 54</span>
|
398
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">values</span>
|
399
|
+
<span class="ruby-identifier">domain</span>.<span class="ruby-identifier">values</span>
|
400
|
+
<span class="ruby-keyword kw">end</span>
|
401
|
+
</pre>
|
402
|
+
</div>
|
403
|
+
</div>
|
404
|
+
</div>
|
405
|
+
|
406
|
+
|
407
|
+
</div>
|
408
|
+
|
409
|
+
|
410
|
+
</div>
|
411
|
+
|
412
|
+
|
413
|
+
<div id="validator-badges">
|
414
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
415
|
+
</div>
|
416
|
+
|
417
|
+
</body>
|
418
|
+
</html>
|