127 lines
8.6 KiB
HTML
127 lines
8.6 KiB
HTML
|
|
<!doctype html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
|
<html><head><title>Python: module geosolver.constraint</title>
|
|
</head><body bgcolor="#f0f0f8">
|
|
|
|
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
|
|
<tr bgcolor="#7799ee">
|
|
<td valign=bottom> <br>
|
|
<font color="#ffffff" face="helvetica, arial"> <br><big><big><strong><a href="geosolver.html"><font color="#ffffff">geosolver</font></a>.constraint</strong></big></big></font></td
|
|
><td align=right valign=bottom
|
|
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/home/rick/Programming/Python/GeoSolver/geosolver/constraint.py">/home/rick/Programming/Python/GeoSolver/geosolver/constraint.py</a></font></td></tr></table>
|
|
<p><tt>Module for constraint graphs<br>
|
|
Copyright Rick van der Meiden 2003, 2004<br>
|
|
Started 1 Nov 2003.<br>
|
|
<br>
|
|
A constraint graph represents a constraint problem. A constraint defines a<br>
|
|
number of variables, and a relation between those variables that must be<br>
|
|
satisfied.<br>
|
|
<br>
|
|
Note that no values are associated with variables in the constraint graph, i.e.<br>
|
|
satisfying constraints is not considered in this module. <br>
|
|
<br>
|
|
The constraint graph is (internally) represented by a directed bi-partite<br>
|
|
graph; nodes are variables or constraints and edges run from variables to<br>
|
|
constraints. <br>
|
|
<br>
|
|
Variables are just names; any non-mutable hashable object, e.g. a string,<br>
|
|
qualifies for a variable. Constraints must be instances of (suclasses of) class<br>
|
|
<a href="#Constraint">Constraint</a>, and must also be non-mutable, hashable objects. <br>
|
|
<br>
|
|
Changes:<br>
|
|
23 Nov 2004 - added Error classes, updated naming and doc conventions (<a href="http://www.python.org/peps/pep-0008.html">PEP 8</a>, 257)<br>
|
|
24 Nov 2004 - added semi-abstract implementation for <a href="#Constraint">Constraint</a>.variables()</tt></p>
|
|
<p>
|
|
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
|
|
<tr bgcolor="#ee77aa">
|
|
<td colspan=3 valign=bottom> <br>
|
|
<font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr>
|
|
|
|
<tr><td bgcolor="#ee77aa"><tt> </tt></td><td> </td>
|
|
<td width="100%"><dl>
|
|
<dt><font face="helvetica, arial"><a href="geosolver.constraint.html#Constraint">Constraint</a>
|
|
</font></dt><dt><font face="helvetica, arial"><a href="geosolver.notify.html#Notifier">geosolver.notify.Notifier</a>
|
|
</font></dt><dd>
|
|
<dl>
|
|
<dt><font face="helvetica, arial"><a href="geosolver.constraint.html#ConstraintGraph">ConstraintGraph</a>
|
|
</font></dt></dl>
|
|
</dd>
|
|
</dl>
|
|
<p>
|
|
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
|
|
<tr bgcolor="#ffc8d8">
|
|
<td colspan=3 valign=bottom> <br>
|
|
<font color="#000000" face="helvetica, arial"><a name="Constraint">class <strong>Constraint</strong></a></font></td></tr>
|
|
|
|
<tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td>
|
|
<td colspan=2><tt>Abstract constraint<br>
|
|
<br>
|
|
A constraint defines a relation between variables that should be<br>
|
|
satisfied.<br>
|
|
<br>
|
|
Subclasses must define proper __init__(), <a href="#Constraint-variables">variables</a>() and <a href="#Constraint-satisfied">satisfied</a>()<br>
|
|
methods. Constraints must be non-mutable, hashable objects.<br> </tt></td></tr>
|
|
<tr><td> </td>
|
|
<td width="100%">Methods defined here:<br>
|
|
<dl><dt><a name="Constraint-satisfied"><strong>satisfied</strong></a>(self, mapping)</dt><dd><tt>return true iff constraint is satisfied by given mapping<br>
|
|
from variables to values (dictionary)</tt></dd></dl>
|
|
|
|
<dl><dt><a name="Constraint-variables"><strong>variables</strong></a>(self)</dt><dd><tt>return a list of variables<br>
|
|
<br>
|
|
If an attribute '_variables' has been defined, a new list<br>
|
|
with the contents of that attribute will be returned. <br>
|
|
Subclasses may choose to initialise this variable or to <br>
|
|
override this function.</tt></dd></dl>
|
|
|
|
</td></tr></table> <p>
|
|
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
|
|
<tr bgcolor="#ffc8d8">
|
|
<td colspan=3 valign=bottom> <br>
|
|
<font color="#000000" face="helvetica, arial"><a name="ConstraintGraph">class <strong>ConstraintGraph</strong></a>(<a href="geosolver.notify.html#Notifier">geosolver.notify.Notifier</a>)</font></td></tr>
|
|
|
|
<tr bgcolor="#ffc8d8"><td rowspan=2><tt> </tt></td>
|
|
<td colspan=2><tt>A constraint graph.<br>
|
|
<br>
|
|
For more information see module documentation.<br> </tt></td></tr>
|
|
<tr><td> </td>
|
|
<td width="100%">Methods defined here:<br>
|
|
<dl><dt><a name="ConstraintGraph-__init__"><strong>__init__</strong></a>(self)</dt><dd><tt>Create a new, empty <a href="#ConstraintGraph">ConstraintGraph</a></tt></dd></dl>
|
|
|
|
<dl><dt><a name="ConstraintGraph-__str__"><strong>__str__</strong></a>(self)</dt></dl>
|
|
|
|
<dl><dt><a name="ConstraintGraph-add_constraint"><strong>add_constraint</strong></a>(self, con)</dt><dd><tt>add a constraint</tt></dd></dl>
|
|
|
|
<dl><dt><a name="ConstraintGraph-add_variable"><strong>add_variable</strong></a>(self, varname)</dt><dd><tt>add a variable</tt></dd></dl>
|
|
|
|
<dl><dt><a name="ConstraintGraph-constraints"><strong>constraints</strong></a>(self)</dt><dd><tt>return a list of variables</tt></dd></dl>
|
|
|
|
<dl><dt><a name="ConstraintGraph-get_constraints_on"><strong>get_constraints_on</strong></a>(self, var)</dt><dd><tt>get a list of all constraints on var</tt></dd></dl>
|
|
|
|
<dl><dt><a name="ConstraintGraph-get_constraints_on_all"><strong>get_constraints_on_all</strong></a>(self, varlist)</dt><dd><tt>get a list of all constraints on all vars in list</tt></dd></dl>
|
|
|
|
<dl><dt><a name="ConstraintGraph-get_constraints_on_any"><strong>get_constraints_on_any</strong></a>(self, varlist)</dt><dd><tt>get a list of all constraints on any of the vars in list</tt></dd></dl>
|
|
|
|
<dl><dt><a name="ConstraintGraph-rem_constraint"><strong>rem_constraint</strong></a>(self, con)</dt><dd><tt>remove a variable</tt></dd></dl>
|
|
|
|
<dl><dt><a name="ConstraintGraph-rem_variable"><strong>rem_variable</strong></a>(self, varname)</dt><dd><tt>remove a variable</tt></dd></dl>
|
|
|
|
<dl><dt><a name="ConstraintGraph-variables"><strong>variables</strong></a>(self)</dt><dd><tt>return a list of variables</tt></dd></dl>
|
|
|
|
<hr>
|
|
Methods inherited from <a href="geosolver.notify.html#Notifier">geosolver.notify.Notifier</a>:<br>
|
|
<dl><dt><a name="ConstraintGraph-add_listener"><strong>add_listener</strong></a>(self, listener)</dt><dd><tt>add a listener to the list (and self to listers' list)</tt></dd></dl>
|
|
|
|
<dl><dt><a name="ConstraintGraph-rem_listener"><strong>rem_listener</strong></a>(self, listener)</dt><dd><tt>remove a listener from the list (and self from listers' list)</tt></dd></dl>
|
|
|
|
<dl><dt><a name="ConstraintGraph-send_notify"><strong>send_notify</strong></a>(self, message)</dt><dd><tt>send a message to all listeners</tt></dd></dl>
|
|
|
|
</td></tr></table></td></tr></table><p>
|
|
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
|
|
<tr bgcolor="#eeaa77">
|
|
<td colspan=3 valign=bottom> <br>
|
|
<font color="#ffffff" face="helvetica, arial"><big><strong>Functions</strong></big></font></td></tr>
|
|
|
|
<tr><td bgcolor="#eeaa77"><tt> </tt></td><td> </td>
|
|
<td width="100%"><dl><dt><a name="-test"><strong>test</strong></a>()</dt></dl>
|
|
</td></tr></table>
|
|
</body></html> |