Home | Trees | Index | Help |
---|
Module constraint :: Class FunctionConstraint |
|
object
--+ |Constraint
--+ | FunctionConstraint
Constraint which wraps a function defining the constraint logic
Examples:>>> problem = Problem() >>> problem.addVariables(["a", "b"], [1, 2]) >>> def func(a, b): ... return b > a >>> problem.addConstraint(func, ["a", "b"]) >>> problem.getSolution() {'a': 1, 'b': 2}
>>> problem = Problem() >>> problem.addVariables(["a", "b"], [1, 2]) >>> def func(a, b): ... return b > a >>> problem.addConstraint(FunctionConstraint(func), ["a", "b"]) >>> problem.getSolution() {'a': 1, 'b': 2}
Method Summary | |
---|---|
| |
bool |
Perform the constraint checking |
Inherited from Constraint | |
bool |
Helper method for generic forward checking |
Preprocess variable domains | |
Inherited from object | |
x.__delattr__('name') <==> del x.name | |
x.__getattribute__('name') <==> x.name | |
x.__hash__() <==> hash(x) | |
T.__new__(S, ...) -> a new object with type S, a subtype of T | |
helper for pickle | |
helper for pickle | |
x.__repr__() <==> repr(x) | |
x.__setattr__('name', value) <==> x.name = value | |
x.__str__() <==> str(x) |
Method Details |
---|
__init__(self,
func,
assigned=True)
|
__call__(self,
variables,
domains,
assignments,
forwardcheck=False,
_unassigned=Unassigned)
|
Home | Trees | Index | Help |
---|
Generated by Epydoc 2.1 on Thu Jul 7 02:05:09 2005 | http://epydoc.sf.net |