(self, constraints=None)
Solve a problem with the given constraints.

        constraints is a matrix of integer numbers, -1 indicates an
        empty cell.

        The function returns a completed matrix of integer numbers or
        None if the problem is unsolvable
Solve a problem with the given constraints.
Solve a problem with the given constraints .
def solve(self, constraints=None):
        """Solve a problem with the given constraints.

        constraints is a matrix of integer numbers, -1 indicates an
        empty cell.

        The function returns a completed matrix of integer numbers or
        None if the problem is unsolvable

        """
        self.solver.push()

        if constraints is not None:
            # User constraints
            for i, row in enumerate(constraints):
                for j, val in enumerate(row):
                    if val > 0:
                        self.solver.add_assertion(Equals(self.var_table[i][j],
                                                         self.const(val)))

        res = self.solver.solve()

        if res:
            result = []
            for r, lst in enumerate(self.var_table):
                r = []
                for var in lst:
                    val = self.solver.get_py_value(var)
                    r.append(val)
                result.append(r)
            self.solver.pop()
            return result
        else:
            self.solver.pop()
            return None
def solve ( self , constraints = None ) : self . solver . push ( ) if constraints is not None : # User constraints for i , row in enumerate ( constraints ) : for j , val in enumerate ( row ) : if val > 0 : self . solver . add_assertion ( Equals ( self . var_table [ i ] [ j ] , self . const ( val ) ) ) res = self . solver . solve ( ) if res : result = [ ] for r , lst in enumerate ( self . var_table ) : r = [ ] for var in lst : val = self . solver . get_py_value ( var ) r . append ( val ) result . append ( r ) self . solver . pop ( ) return result else : self . solver . pop ( ) return None