Re: Re: ctypes typecasting in perl

2013-09-09 Thread Shantanu Bhadoria
Thanks Abigail, That works perfectly. I had a inkling that the solution lies in pack unpack. This is it. > > I think you want pack/unpack: > > $ perl -E 'say unpack s => pack S => 64256' > -1280 > $ > > > Abigail > > > From: Yitzchak Scott-Thoennes > > Abigail's pack/unpack suggestion wil

Re: Assigning Classes

2013-09-09 Thread D Perrett
I suspect this is the sort of problem where no solution will give you consistently unremarkable results if in the long run there are any unspoken requirements like 'students shouldn't be able to game the system by lying about their preferences'. Leaving that aside, a naive (computationally expensi

Re: Assigning Classes

2013-09-09 Thread Avishalom Shalit
I would agree that the problem is ill posed. a formal (and therefor solvable ) definition would be e.g. by defining the cost of a solution and minimizing it. e.g. for each student, for each of his two courses his personal cost for that course is the square of his raking. (so if he ranked it 4, h

Re: Assigning Classes

2013-09-09 Thread Andrew Solomon
Hi Dave I think the area Raphael suggests is 'Integer Programming'. With a bit of luck you'll get acceptable results with *linear* integer programming using something like this: http://sourceforge.net/projects/lipside/ but if you wind up getting the majority of students with exactly what they w

Re: ctypes typecasting in perl

2013-09-09 Thread Yitzchak Scott-Thoennes
On Mon, Sep 9, 2013 at 8:55 AM, Shantanu Bhadoria wrote: > I am trying to read registers off a chip which store data in > int16_t format but since the data is in simple binary code, essentially > when I read the register I get a simple unsigned int value from it. Abigail's pack/unpack suggestion

Re: ctypes typecasting in perl

2013-09-09 Thread Jérôme Étévé
Would that help? http://perldoc.perl.org/perlpacktut.html J. On 9 September 2013 16:55, Shantanu Bhadoria wrote: > I have been playing around with talking to some IMU chips i.e gyroscopes, > magnetometers and accelerometers from my raspberryPi and I am facing a > slight problem which might see

Re: ctypes typecasting in perl

2013-09-09 Thread Abigail
On Mon, Sep 09, 2013 at 10:55:06PM +0700, Shantanu Bhadoria wrote: > I have been playing around with talking to some IMU chips i.e gyroscopes, > magnetometers and accelerometers from my raspberryPi and I am facing a > slight problem which might seem trivial to those familiar more with C or XS > cod

ctypes typecasting in perl

2013-09-09 Thread Shantanu Bhadoria
I have been playing around with talking to some IMU chips i.e gyroscopes, magnetometers and accelerometers from my raspberryPi and I am facing a slight problem which might seem trivial to those familiar more with C or XS code than I. I am trying to read registers off a chip which store data in int1

Re: Assigning Classes

2013-09-09 Thread James Laver
On Mon, Sep 9, 2013 at 4:10 PM, Dave Cross wrote: > > I'm pretty sure that Paul wasn't actually dismissing Prolog. I think you'll > find he was making a joke. ...which I should have gotten but I'm full of cold. James

Re: Assigning Classes

2013-09-09 Thread Paul Johnson
On Mon, Sep 09, 2013 at 03:10:14PM +, Dave Cross wrote: > Quoting James Laver : > > >On Mon, Sep 9, 2013 at 2:57 PM, Paul Johnson wrote: > >>On Mon, Sep 09, 2013 at 01:30:00PM +, Dave Hodgkinson wrote: > >>>Prolog. Facts and rules then go solve. > >> > >>no > > > >Actually, Prolog was my

Re: Assigning Classes

2013-09-09 Thread Abigail
On Mon, Sep 09, 2013 at 12:45:43PM +, Dave Cross wrote: > > I have offered to help a friend[1] solve what sounds like an interesting > problem. > > She has a list of courses that are offered. Some of these courses have a > maximum class size and others are effectively infinite (I don't believ

Re: Assigning Classes

2013-09-09 Thread Dave Cross
Quoting James Laver : On Mon, Sep 9, 2013 at 2:57 PM, Paul Johnson wrote: On Mon, Sep 09, 2013 at 01:30:00PM +, Dave Hodgkinson wrote: Prolog. Facts and rules then go solve. no Actually, Prolog was my first thought too. The major limitation is fallback behaviour. I'm pretty sure tha

Re: Assigning Classes

2013-09-09 Thread Raphael Mankin
Second thoughts: I was slightly wrong in my previous reply. This is not a 0/1 problem so the Hungarian does not apply. However it is a general integer transportation problem with limited link capacities. The Hungarian would apply if you were assigning students to private tutors; that is a 0/1 pro

Re: Assigning Classes

2013-09-09 Thread James Laver
On Mon, Sep 9, 2013 at 2:57 PM, Paul Johnson wrote: > On Mon, Sep 09, 2013 at 01:30:00PM +, Dave Hodgkinson wrote: >> Prolog. Facts and rules then go solve. > > no Actually, Prolog was my first thought too. The major limitation is fallback behaviour. James

Re: Assigning Classes

2013-09-09 Thread Dirk Koopman
On 09/09/13 15:10, Raphael Mankin wrote: This is a classic variation of the transportation problem. If you can assign (different) costs to being in the wrong class and zero cost to being in the right class then the Hungarian Algorithm will do the job. The standard version of the algorithm has q

Re: Assigning Classes

2013-09-09 Thread Raphael Mankin
This is a classic variation of the transportation problem. If you can assign (different) costs to being in the wrong class and zero cost to being in the right class then the Hungarian Algorithm will do the job. The standard version of the algorithm has quartic time complexity, but there is a vers

Re: Assigning Classes

2013-09-09 Thread Paul Johnson
On Mon, Sep 09, 2013 at 01:30:00PM +, Dave Hodgkinson wrote: > Prolog. Facts and rules then go solve. no -- Paul Johnson - p...@pjcj.net http://www.pjcj.net

Re: Assigning Classes

2013-09-09 Thread Dave Hodgkinson
Prolog. Facts and rules then go solve. On Mon, Sep 9, 2013 at 12:45 PM, Dave Cross wrote: > > I have offered to help a friend[1] solve what sounds like an interesting > problem. > > She has a list of courses that are offered. Some of these courses have a > maximum class size and others are eff

Re: Assigning Classes

2013-09-09 Thread Mark Fowler
On Monday, 9 September 2013 at 08:45, Dave Cross wrote: > I have offered to help a friend[1] solve what sounds like an > interesting problem. No idea on the literature, but here's my two pence worth: I'd start by putting everyone in their favourite choice of classes, and seeing how "bad" that

Assigning Classes

2013-09-09 Thread Dave Cross
I have offered to help a friend[1] solve what sounds like an interesting problem. She has a list of courses that are offered. Some of these courses have a maximum class size and others are effectively infinite (I don't believe that second part, but hey!) There are about thirty of these