Results 1 to 16 of 16

Thread: Advice needed: Functional programming

  1. #1
    Let sleeping tigers lie Khendraja'aro's Avatar
    Join Date
    Jan 2010
    Location
    In the forests of the night
    Posts
    6,239

    Default Advice needed: Functional programming

    So, here's the gist:

    I want to rearrange the seating in my classes. Following procedure: Each pupil gets to write a wish list with three names - his/her own name, one other pupil he/she would like to have as a neighbour and one pupil he/she does not want to have as a neighbour. They can also say whether they want to sit in front or not. Those wishes are not binding.

    I myself want to have a list for some pupils which should not be seated next to each other under any circumstances. These entries are binding.

    Then there are the seats themselves to consider - in some rooms they're arranged by 2x4 seats in a row, other rooms have the seats arranged along a U.

    So, those are the requirements. Then I though about implementation - finding a nice way of solving this would probably amount to solving the travelling salesman problem. Thus, bruteforce. Also, from what I've read and heard, functional languages like Haskell or F# should be better suited for a task like this.

    May approach would be to create all possible combinations of pupils through a recursive function, assign a numeric value to each combination (based on the number of fulfilled criteria) and then pick the combination(s) with the highest values.

    My questions now would be, if I'm deluding myself and this can't be done, or if this is even worthwhile or if someone else here has any experience with functional languages and could give me some pointers or point out pitfalls.
    When the stars threw down their spears
    And watered heaven with their tears:
    Did he smile his work to see?
    Did he who made the lamb make thee?

  2. #2
    I have no experience with functional languages, so won't be able to help there.

    On the problem: It also sounds very doable, and not horribly complex. I'm thinking it can be solved similarly to the 8 queens problem. Current setup goes down, best solution with score comes back up. It's still pretty brute force, but we both think the problem is NP-Hard or NP-Complete, so no shocker there. It should be fairly simple to program the algorithm, though.

    If you want to use this as an excuse to learn one of those other languages, go for it, but if you just want the problem solved, it's probably easier to stick with a language you already know.

  3. #3
    Let sleeping tigers lie Khendraja'aro's Avatar
    Join Date
    Jan 2010
    Location
    In the forests of the night
    Posts
    6,239
    So, I finally sat down to implement the algorithm. It's crunching numbers at the moment - though brute-forcing the beast is a massive task.

    I mean, one of my classes has 28 pupils. That's 28! possible seating combinations.

    Oh, well, I'll probably let it run for some time and then pick the best result to date. Currently it's at 46 of 76 possible points.
    When the stars threw down their spears
    And watered heaven with their tears:
    Did he smile his work to see?
    Did he who made the lamb make thee?

  4. #4
    Determine your list of forbidden pairs. For each pair, determine which student is the greatest villain. Send these villainous students to vocational school and let the remainder sit wherever they please.
    "One day, we shall die. All the other days, we shall live."

  5. #5
    What grades are you teaching? Teachers stop trying to assign seats here after elementary school.
    Hope is the denial of reality

  6. #6
    Quote Originally Posted by Loki View Post
    What grades are you teaching?
    German
    "One day, we shall die. All the other days, we shall live."

  7. #7
    Let sleeping tigers lie Khendraja'aro's Avatar
    Join Date
    Jan 2010
    Location
    In the forests of the night
    Posts
    6,239
    Quote Originally Posted by Loki View Post
    What grades are you teaching? Teachers stop trying to assign seats here after elementary school.
    Yes, Loki, and we all know what a dang job the US is doing regarding teaching

    Seriously, though, over here we do change seating arrangements from time to time, especially when it turns out that two pupils should not sit next to each other.

    Not to mention the "Oh my god, I have to talk to a girl!" disease. In some of my classes it feels like there's the Berlin Wall running straight through the middle
    When the stars threw down their spears
    And watered heaven with their tears:
    Did he smile his work to see?
    Did he who made the lamb make thee?

  8. #8
    That's why I ask which grades you're teaching. That's a perfectly reasonable approach for primary school and maybe middle school, but there are far deeper problems if the only way to get high school students to do work is by forcing them to sit away from their friends or members of the opposite gender. Older students need to be held accountable for their results, and appropriate measures need to be taken if they are incapable of doing work in a class environment.
    Hope is the denial of reality

  9. #9
    I am not sure if I'd go for functional programming. Prolog might be a better choice for this problem if you really want to break out the imperative paradigm.
    "Wer Visionen hat, sollte zum Arzt gehen." - Helmut Schmidt

  10. #10
    Let sleeping tigers lie Khendraja'aro's Avatar
    Join Date
    Jan 2010
    Location
    In the forests of the night
    Posts
    6,239
    Quote Originally Posted by Loki View Post
    That's why I ask which grades you're teaching. That's a perfectly reasonable approach for primary school and maybe middle school, but there are far deeper problems if the only way to get high school students to do work is by forcing them to sit away from their friends or members of the opposite gender. Older students need to be held accountable for their results, and appropriate measures need to be taken if they are incapable of doing work in a class environment.
    Loki, let me ask you this: What is the basis for your opinion? Actual experience as a teacher in school? Mostly this is grade 7 and 8 stuff we're talking about here.

    For instance, you've got this cluster of weak pupils - the problem is that you can't always take the whole class down to their level because then you'll bore the strong pupils to death. Yes, you can use differentiating methods, but not all the time - there are simply not enough hours in a day to plan for such details for every lesson.

    Point is that at some point, the weak pupils will be bored due to non-understanding. You now can either watch them like a hawk or you can sit them next to a stronger pupil which has two effects: a) the stronger pupil may explain the problem point thus strengthening understanding in both of them and b) the stronger pupil is less likely to give in to a weaker pupil's antics because 1) he's usually interested in a topic / good grades and 2) thus usually more disciplined.

    Not to mention that I'm a Physics and Chemistry teacher. Which means that my classes are not in the usual class rooms but in special science rooms. Which then means that the seating of the pupils differs from the "normal" seating anyway. Which in turn means that any changes in seating will bar them from their friends' side only for one hour, tops.

    Did you really never run across a combination of pupils where you immediately noticed: "That does not really work?" - and not due to mutual loathing.

    And, Loki, it may astound you but those are actually part of the "appropriate measures".
    When the stars threw down their spears
    And watered heaven with their tears:
    Did he smile his work to see?
    Did he who made the lamb make thee?

  11. #11
    You forgot the third possibility: the poor student bothers/bullies the better student, and both end up doing nothing.

    You're also neglecting the possibility that by treating these students like little children, you're encouraging them to act like little children. Giving out seats shows a profound lack of trust on your part, and that lack of trust gets internalized.
    Hope is the denial of reality

  12. #12
    It doesn't have to.
    "One day, we shall die. All the other days, we shall live."

  13. #13
    Let sleeping tigers lie Khendraja'aro's Avatar
    Join Date
    Jan 2010
    Location
    In the forests of the night
    Posts
    6,239
    Again, Loki, did you actually ever teach at those grades for a longer period of time? I.e. kids which are in full-blown puberty?

    I did try to be nice. And the pupils promptly walked all over me. They actually demand a firm hand, this is no joke! And no, this is not a "Well, from their behaviour I conclude that..." conclusion but something they stated flat out.

    And your third possibility is strange: If I'm able to notice that two pupils should not be seated next to each other because they're constantly inattentive/disruptive, do you really think that I'm unable to notice when two pupils are inattentive/disruptive? Because that's what you're saying right now.

    If you're shocked by this, I guess it's time to inform you about other methods in my arsenal:
    a) Having a seat plan upon which I note plusses and minuses quite visibly for good and bad behaviour. Please take note, though, that currently the plusses massively outweigh the amount of minuses and that minuses can only be gained for disruptive behaviour. Plusses can be gained for taking part in group activities, signalling that you're willing to give an answer to a question/task I posed (does not need to be correct!) or thinking ahead. Of course, correct answers weigh a bit more than wrong answers, but I never tell someone off for being wrong.
    b) Writing the name of a disruptive pupil on the board, one letter at a time (or two, if it's a long name ) If the whole name is completed, the pupil has to do an extra task (like writing an essay)
    c) If the whole class does not behave, I add one bar for every minute we just wasted to the board. If the class collects 45 of these bars, they have to do an extra lesson in the afternoon. Works wonders - in one class which I now had for 2 months, we only collected 3 bars up till now. I don't see them reaching 45 - but they were quite noisy in the beginning. This quieted them down real fast.
    The effect is really impressive - you don't have to scream, you don't have to yell, you don't have to wave your arms. Simply turn around, chalk up another bar and watch them go quiet.

    It's also a bit Machiavellian because it turns a "us versus the teacher" into a "us who don't want an extra lesson versus the noisy ones".

    For the grades below (5 & 6) and the grades above (9 - 12) this is not neccessary. For 7&8 this is a neccessary evil - it's quite impressive if you know the class because you taught them in grade 6 and suddenly they turn into small monsters ( ) at some point in the 7th grade.
    When the stars threw down their spears
    And watered heaven with their tears:
    Did he smile his work to see?
    Did he who made the lamb make thee?

  14. #14
    I sympathize with your predicament; I have friends who were teachers at your age, and it's hard to get respect from teens when you're straight out of college. Having said that, some of your methods (sitting charts, pluses/minuses, writing names on board) seem like something that is more appropriate in primary school, not with ~13-year-olds. Group punishment might have some of the desired effect, but it's also a fast way to lose whatever respect you have in your students' eyes.

    I'm not a teacher, so I'm not in a position to tell you what works, but every teacher I've had in middle school and high school that had the respect of the class did not have to resort to gimmicks or collective punishments. They seemed to maintain discipline through their teaching alone. Maybe the students see you as a friend or as one of them. That's a quick way to lose control in the classroom.
    Hope is the denial of reality

  15. #15
    Let sleeping tigers lie Khendraja'aro's Avatar
    Join Date
    Jan 2010
    Location
    In the forests of the night
    Posts
    6,239
    Those methods are no inventions of mine. And, as I said, they actually asked for it. Well, maybe not the specific implementation.

    And, Loki, as I said, it's the grades 7&8 which actually require stuff like this. And I don't actually believe that none of your respected teachers did not have such methods or did not use it. That's several years back now for you.

    Furthermore, you're thinking too simplistic here. Yes, if I went berzerk every time the class annoyed me and gave them group punishment on the drop of a hat, then yes, I might lose respect.
    However, this method does not work that way. It's cumulative - more akin to filling a bucket of water. The pupils know what happens when the bucket is full and they know what fills it and how to avoid it. And, as I said, I don't think I'll actually have to implement it.

    Additionally, visibly giving plusses and minuses is direct feedback (important) and at the same time a quite mild reaction. I don't have to say anything, I don't have to wave hands. It also shows the pupils how their oral grade is constructed. They see it's not a magic box - they can easily see what their final oral grade will look like if they continue their behaviour (be that good, bad or neutral).
    When the stars threw down their spears
    And watered heaven with their tears:
    Did he smile his work to see?
    Did he who made the lamb make thee?

  16. #16
    Senior Member Flixy's Avatar
    Join Date
    Jan 2010
    Location
    The Netherlands
    Posts
    6,435
    Quote Originally Posted by Loki View Post
    I sympathize with your predicament; I have friends who were teachers at your age, and it's hard to get respect from teens when you're straight out of college. Having said that, some of your methods (sitting charts, pluses/minuses, writing names on board) seem like something that is more appropriate in primary school, not with ~13-year-olds. Group punishment might have some of the desired effect, but it's also a fast way to lose whatever respect you have in your students' eyes.

    I'm not a teacher, so I'm not in a position to tell you what works, but every teacher I've had in middle school and high school that had the respect of the class did not have to resort to gimmicks or collective punishments. They seemed to maintain discipline through their teaching alone. Maybe the students see you as a friend or as one of them. That's a quick way to lose control in the classroom.
    I think I've encountered some of those methods in high school (then again, I did start high school at 11 not 13). Generally we were allowed to sit where we want, but if you were disruptive you could be moved. For example, when two people talk all the time they'd be separated, or someone who cheats could be placed in front so the teacher would have a better view, things like that. Even at university I've encountered 'forced' seating to mix groups of people quicklyand pretty much force people to work with people who are not their friends. Forced project groups are also pretty common.
    Keep on keepin' the beat alive!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •