[show private | hide private] [frames | no frames]

## Type MinConflictsSolver

````object` --+
|
`Solver` --+
|
MinConflictsSolver
```

Problem solver based on the minimum conflicts theory

Examples:
```>>> result = [[('a', 1), ('b', 2)],
...           [('a', 1), ('b', 3)],
...           [('a', 2), ('b', 3)]]```
```>>> problem = Problem(MinConflictsSolver())
>>> problem.addVariables(["a", "b"], [1, 2, 3])
>>> problem.addConstraint(lambda a, b: b > a, ["a", "b"])```
```>>> solution = problem.getSolution()
>>> sorted(solution.items()) in result
True```
```>>> problem.getSolutions()
Traceback (most recent call last):

...

NotImplementedError: MinConflictsSolver provides only a single solution```
```>>> problem.getSolutionIter()
Traceback (most recent call last):

...

NotImplementedError: MinConflictsSolver doesn't provide iteration```

Method Summary
```__init__(self, steps)```
```getSolution(self, domains, constraints, vconstraints)```
Return one solution for the given problem
Inherited from Solver
```getSolutionIter(self, domains, constraints, vconstraints)```
Return an iterator for the solutions of the given problem
```getSolutions(self, domains, constraints, vconstraints)```
Return all solutions for the given problem
Inherited from object
`__delattr__(...)`
x.__delattr__('name') <==> del x.name
`__getattribute__(...)`
x.__getattribute__('name') <==> x.name
`__hash__(x)`
x.__hash__() <==> hash(x)
```__new__(T, S, ...)```
T.__new__(S, ...) -> a new object with type S, a subtype of T
`__reduce__(...)`
helper for pickle
`__reduce_ex__(...)`
helper for pickle
`__repr__(x)`
x.__repr__() <==> repr(x)
`__setattr__(...)`
x.__setattr__('name', value) <==> x.name = value
`__str__(x)`
x.__str__() <==> str(x)

Method Details

### __init__(self, steps=1000)(Constructor)

Parameters:
`steps` - Maximum number of steps to perform before giving up when looking for a solution (default is 1000)
(type=int)
Overrides:
`__builtin__.object.__init__`

### getSolution(self, domains, constraints, vconstraints)

Return one solution for the given problem
Parameters:
`domains` - Dictionary mapping variables to their domains
(type=dict)
`constraints` - List of pairs of (constraint, variables)
(type=list)
`vconstraints` - Dictionary mapping variables to a list of constraints affecting the given variables.
(type=dict)
Overrides:
`constraint.Solver.getSolution` (inherited documentation)

 Generated by Epydoc 2.1 on Thu Jul 7 02:05:09 2005 http://epydoc.sf.net