Re: How to rearrange array using Python?

2015-10-21 Thread Martin Schöön
Den 2015-10-20 skrev Ian Kelly : >> >> Anyone into CSP willing to offer me a hint? > > I assume that your variables are the individuals and the domains of > those variables are the rooms. Based on the python-constraint docs, > your constraint could look something like this:

Re: How to rearrange array using Python?

2015-10-20 Thread Martin Schöön
It has been a while. I have mastered solving Kenken and Sudoku using Python-constraint. I still have no clue on how to tell the solver how to constrain the number of occupants in rooms: I have made up an simple example with nine persons and three rooms. Wishes for room mates are mild in the

Re: How to rearrange array using Python?

2015-10-20 Thread Ian Kelly
On Tue, Oct 20, 2015 at 1:26 PM, Ian Kelly wrote: > def room_size_constraint(*v): > counter = Counter(v.values()) Sorry, this should just be Counter(v), since v here is a tuple, not a dict. -- https://mail.python.org/mailman/listinfo/python-list

Re: How to rearrange array using Python?

2015-10-20 Thread Ian Kelly
On Tue, Oct 20, 2015 at 12:57 PM, Martin Schöön wrote: > It has been a while. > I have mastered solving Kenken and Sudoku using Python-constraint. > > I still have no clue on how to tell the solver how to constrain > the number of occupants in rooms: I have made up an

Re: How to rearrange array using Python?

2015-10-20 Thread Oscar Benjamin
On Tue, 20 Oct 2015 20:01 Martin Schöön wrote: It has been a while. I have mastered solving Kenken and Sudoku using Python-constraint. I still have no clue on how to tell the solver how to constrain the number of occupants in rooms: I have made up an simple example with

Re: How to rearrange array using Python?

2015-08-17 Thread Martin Schöön
Den 2015-07-31 skrev Martin Schöön martin.sch...@gmail.com: Den 2015-07-31 skrev Thomas 'PointedEars' Lahn pointede...@web.de: 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

Re: How to rearrange array using Python?

2015-07-31 Thread Martin Schöön
Den 2015-07-31 skrev Thomas 'PointedEars' Lahn pointede...@web.de: 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

Re: How to rearrange array using Python?

2015-07-31 Thread Martin Schöön
Den 2015-07-31 skrev Robin Koch robin.k...@t-online.de: Am 30.07.2015 um 22:31 schrieb Martin Schöön: Scores to the right show how many wishes are fulfilled in each room Is it possible the is a mistake in the sum column on the third row? Should the be a 1? Indeed. The goal is to

How to rearrange array using Python?

2015-07-30 Thread Martin Schöön
Here is a problem I think I should be able to solve using Python but after having searched the internet for the better part of this evening my head spins and I would apreciate some guidance. Disclaimer My formal programming training happened 35+ years ago and initially involved F77 and later

Re: How to rearrange array using Python?

2015-07-30 Thread Robin Koch
Am 30.07.2015 um 22:31 schrieb Martin Schöön: Scores to the right show how many wishes are fulfilled in each room Is it possible the is a mistake in the sum column on the third row? Should the be a 1? The goal is to re-shuffle the array to maximize this score. How do I go about doing that?

Re: How to rearrange array using Python?

2015-07-30 Thread Mark Lawrence
On 30/07/2015 21:31, Martin Schöön wrote: Here is a problem I think I should be able to solve using Python but after having searched the internet for the better part of this evening my head spins and I would apreciate some guidance. Disclaimer My formal programming training happened 35+ years

Re: How to rearrange array using Python?

2015-07-30 Thread ltc.hotspot
Hi Mark, I’m still confused because line 4 reads: fh=open(fname,'r') # Open a new file handle, not fn = open(fname) Can you write down line by line from error to correction? Hal Sent from Surface From: Mark Lawrence Sent: ‎Thursday‎, ‎July‎ ‎30‎, ‎2015 ‎3‎:‎21‎ ‎PM To:

Re: How to rearrange array using Python?

2015-07-30 Thread Thomas 'PointedEars' Lahn
Mark Lawrence wrote: On 30/07/2015 21:31, Martin Schöön wrote: I am just back from visiting my sisters and the younger of them was busy planning a youth orchestra summer camp. For some reason the kids are allowed to wish with whom they want to share rooms and my sister spent several evenings

Re: How to rearrange array using Python?

2015-07-30 Thread Mark Lawrence
On 30/07/2015 23:31, ltc.hots...@gmail.com wrote: Hi Mark, I’m still confused because line 4 reads: fh=open(fname,'r') # Open a new file handle, not fn = open(fname) Can you write down line by line from error to correction? I'd think about it if you could find the correct thread :) -- My