Path: csiph.com!au2pb.net!feeder.erje.net!1.eu.feeder.erje.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Martin =?UTF-8?Q?Sch=C3=B6=C3=B6n?= Newsgroups: comp.lang.python Subject: Re: How to rearrange array using Python? Date: 17 Aug 2015 21:14:20 GMT Organization: @ Home Lines: 50 Message-ID: References: <1468455.P0rGZF1LBf@PointedEars.de> Mime-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit X-Trace: individual.net zUi21G9LsiFxXDcJK7oJtQnqI6VPrJD5msLNq9EJAi0LMnpQNY Cancel-Lock: sha1:DV66yUG3WD7defjJnjEmqGZ0TOE= User-Agent: slrn/pre1.0.0-18 (Linux) Xref: csiph.com comp.lang.python:95446 Den 2015-07-31 skrev Martin Schöön : > Den 2015-07-31 skrev Thomas 'PointedEars' Lahn : >> Mark Lawrence wrote: >>> >>> I'm not absolutely certain but I think you're into what's known as a >>> constraint satisfaction problem, in which case this >>> https://pypi.python.org/pypi/python-constraint/1.2 is as good a starting >>> point as any. If I'm wrong we'll soon get told :) >> >> It is a CSP indeed, and as I was reading the OP I was thinking of SWI- >> > Thanks guys, I will follow up on the CSP lead. It is not something I > have prior experience of so it will be interesting. > Brief progress report (just to tell you that your advice has been 'absorbed'). I have been reading a bit, here is one example. http://kti.ms.mff.cuni.cz/~bartak/constraints/index.html Interesting stuff but sometimes head-spinning -- I don't always follow the lingo. I have also downloaded and installed Python-Constraint. It works as advertised as long as I replicate the examples found at: http://labix.org/python-constraint I can even scale some of the examples. Creating my own examples has proven harder -- in part because the documentation is minimalistic but also because I have not tried very hard. We have, finally, got some nice summer weather here... I have tried my hand at a *very* basic room placement problem. It works apart from the fact that I have not figured out how to tell the solver there are limits to how many occupants each room can house. Yesterday I started on a basic Kenken example. I need to experiment a little to find a way to add the needed division and subtraction constraints. I haven't given this much thought yet. Today I found Numberjack: http://numberjack.ucc.ie/ It seems better documented than Python-Constraint but that is all I know. Anyone with experience of Numberjack? In summary: I am having fun using ipython and org-mode for emacs. I am not making much headway but then I don't have a dead-line :-) /Martin