On 16 mai 14:55, MOHAMED AMINE Omrani wrote:
> hello,

Hello,

I'm Ccing (a bit late) your mail to the python-projects mailing list where 
you'll
hopefuly get some answers.

-- Sylvain

> I need your help,
> I use the  "logilab-constraint" package for solving a combinatorial problem
> with constraints that are similar to the constraints of problem magic
> square,
> 
> variables = []
> domains={}
> constraints=[]
> for var in range(n*n):
>             variables.append(var)
>             domains[var]=fd.FiniteDomain([0,1,2,3])
> 
> #begin constraints
> 
> I try to express the following constraint:
> the sum of each matrix row must be equal to 10
> I expressed this constraint with python-constraint package as follows and
> it works
> for row in range(n):
>     problem.addConstraint(ExactSumConstraint(10),
>                          [row*n+i for i in range(n)])
> but i like to express this constraint with the "python-logilab-constraint"
> 
> #end constraints
> 
> r = Repository(variables,domains,constraints)
> solution=Solver().solve_one(r)
> print solution
> 
> big thinks for you
_______________________________________________
Python-Projects mailing list
Python-Projects@lists.logilab.org
http://lists.logilab.org/mailman/listinfo/python-projects

Reply via email to