Thread: Your work

  1. #31
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    Quote Originally Posted by Matticus View Post
    Not the way I did it. I know algorithms already exist, but I just developed my own that model how I do them by hand. Not nearly as efficient as mathematical trickery, but overall an enjoyable process for me.
    I was following a recent discussion on this topic on alt.python. I was a bit disappointed with the apparent general support to the idea of creating these solvers by mimicking human reasoning.

    Note that the following isn't a criticism of your decision to do it that way. Everyone should choose how they wish to use their time. The personal satisfaction of reaching a solution that performs reasonably well is a worthy feeling if one is doing it to have fun. It is instead a criticism of the idea that these type of algorithms gather support and are worth a debate on their merits.

    Sodoku solvers are a dime a dozen, but the problem is that these mostly all fall down in the category of brute-force solutions of "do it as I play it". These are relatively fun and make up a good addition to the list of "Things I Must Code before I Die". But certainly they aren't worth much of a debate. There's very little to argue about brute-force sudoku solutions:

    1. Performance can't be qualitatively measured because solutions aren't based on the puzzle difficulty.
    2. They are rigid algorithms incapable of easily adapting to the large number of Sudoku variants because they are logic-derived instead of deductive-based algorithms.
    3. Speed and scalability is entirely delegated to the system capabilities.

    That so many people in alt.python chose to happily discuss the merits of a number of sudoku brute-force solvers left me with a bad taste in my mouth. Things like "my algorithm gives me a solution in x microseconds" feels like someone saying he's a pilot because he flies a drone.

    However -- and this is the disheartening bit I'm trying to express -- there's very little mathematics involved in many of the less-logic-and-more-deductive algorithms that can also solve sudoku puzzles. These algorithms offer better performance, are more generic and can be more easily modified to support other variants and often the solutions are based on the puzzle difficulty, making for a better scaleable solution and indirectly providing important data on how difficult the puzzle could be for humans.

    Most of the proven deductive algorithms only require a modest amount of computer science knowledge in fields that we would do well to have a modest knowledge about. And yet, it seems, no one in alt.python, including seasoned veterans, remembered to advise towards better solutions that put to the test our CS knowledge since we are all, you know, programmers...
    Last edited by Mario F.; 04-02-2015 at 08:54 AM.
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  2. #32
    Registered User
    Join Date
    Jun 2011
    Posts
    4,513
    I can see your point - for someone who wants to create a "real" application like that, effort should be made to understand the underlying mathematics to make an efficient and general solution. I certainly agree that this should be encouraged, and the preferable way to implement such a solution. To me, that would be the only way to justify bragging.

    I understand your aren't criticising my own approach. Mine was just an effort to scratch my programming itch, and it did the job nicely. I also encountered a huge hurdle when my algorithms failed to solve a class of "very difficult" puzzles - but encountering this hurdle and applying problem-solving to overcome it also contributed to the fun.

    Your overall point of "thinking like a programmer" when trying to solve such problems is something I do agree with.

  3. #33
    Registered User MutantJohn's Avatar
    Join Date
    Feb 2013
    Posts
    2,665
    That so many people in alt.python chose to happily discuss the merits of a number of sudoku brute-force solvers left me with a bad taste in my mouth. Things like "my algorithm gives me a solution in x microseconds" feels like someone saying he's a pilot because he flies a drone.
    Wait, how is "I solved this the fastest!" bad?

  4. #34
    Registered User
    Join Date
    Oct 2006
    Posts
    3,445
    Quote Originally Posted by MutantJohn View Post
    Wait, how is "I solved this the fastest!" bad?
    There's a difference between performance and efficiency. Brute force is not efficient, no matter how fast it gets the job done.
    What can this strange device be?
    When I touch it, it gives forth a sound
    It's got wires that vibrate and give music
    What can this thing be that I found?

  5. #35
    Registered User Alpo's Avatar
    Join Date
    Apr 2014
    Posts
    877
    Quote Originally Posted by MutantJohn View Post
    Wait, how is "I solved this the fastest!" bad?
    It's the ad hoc nature of the solution that could make it slightly less useful in situations other than the one it was created for. I saw something like this recently on a youtube video about matrix rotation, where the solution that the speaker came up with was very specific to the exact problem it was meant to solve (It was basically like, "So long as the matrix has these known attributes, we can do things this way").
    WndProc = (2[b] || !(2[b])) ? SufferNobly : TakeArms;

  6. #36
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    Quote Originally Posted by MutantJohn View Post
    Wait, how is "I solved this the fastest!" bad?
    When a deductive algorithm is 10x or 100x faster than your "fastest" brute force solution? And it is more efficient, as Elkvis mentioned and more generic, as Alpo said?
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  7. #37
    Registered User MutantJohn's Avatar
    Join Date
    Feb 2013
    Posts
    2,665
    Quote Originally Posted by Mario F. View Post
    When a deductive algorithm is 10x or 100x faster than your "fastest" brute force solution? And it is more efficient, as Elkvis mentioned and more generic, as Alpo said?
    Maybe I misinterpreted. I assumed your post was about the people writing brute force code that was indeed faster than anything else.

    Oh, did you mean that they implemented one algorithm the fastest? That'd make more sense then.

    I was gonna say, if there's an algorithm that's faster than other algorithms (implementation put aside) then I don't see what's wrong with it. Your criticism makes a lot more sense now.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Why did this not work????
    By mohnish_khiani in forum C Programming
    Replies: 16
    Last Post: 02-26-2011, 04:16 AM
  2. Could this work?
    By stormdizzle in forum C++ Programming
    Replies: 7
    Last Post: 08-08-2010, 04:42 PM
  3. Will this set up work?
    By adr in forum A Brief History of Cprogramming.com
    Replies: 11
    Last Post: 05-09-2007, 02:08 PM
  4. Can anyone get this to work ?
    By slx47 in forum C++ Programming
    Replies: 11
    Last Post: 05-10-2002, 08:35 PM
  5. my function doesn't work! it should work
    By Unregistered in forum C Programming
    Replies: 13
    Last Post: 05-02-2002, 02:53 PM