Commits on Jul 29, 2011
Commits on Jul 27, 2011
  1. @johanlindberg

    Minor formatting.

    johanlindberg committed Jul 27, 2011
  2. @johanlindberg

    Added the results from running s1.py on rectangles.txt.

    Total cost is 486 and it takes about 12 minutes to run on
    my laptop. There are a few of the fields that I know are
    not solved in an optimal way. See p3.text for example.
    johanlindberg committed Jul 27, 2011
  3. @johanlindberg

    Fixed the problem highlighted by p4.text.

    Now, we've come to the point where it's possible to say
    that we cannot find a solution. we do that by returning
    None instead of a field. In order for that to work in the
    solve chain I updated the cost function to return
    sys.maxint when it encounters None.
    johanlindberg committed Jul 27, 2011
  4. @johanlindberg

    Added another example from rectangles.txt.

    This one also violated the max constraint but since that bug
    has been stomped it instead crashes.
    johanlindberg committed Jul 27, 2011
  5. @johanlindberg
  6. @johanlindberg

    Fixed the one-off bug with the max constraint violation.

    The solution proposed to p3.text however, is not looking very good
    and needs to be explored a bit more.
    johanlindberg committed Jul 27, 2011
  7. @johanlindberg

    Added another example from rectangle.txt. The solution proposed viola…

    …tes the max constraint.
    johanlindberg committed Jul 27, 2011
  8. @johanlindberg

    Minor bugfix.

    johanlindberg committed Jul 27, 2011
  9. @johanlindberg
  10. @johanlindberg

    Added another test file.

    This one is taken from rectangles.txt and shows that if the
    best solution is already provided after the joins the solver
    still continues and produces a worse solution.
    johanlindberg committed Jul 27, 2011
  11. @johanlindberg
Commits on Jul 26, 2011
  1. @johanlindberg
  2. @johanlindberg

    Modified solve so it uses variant_reduction instead and moved out all…

    … tests to tests.text.
    
    If we run python2.6 s1.py p1.text all of the test puzzles
    should have the same cost.
    johanlindberg committed Jul 26, 2011
  3. @johanlindberg

    Added implementation to pass the second test in variant_reduction.

    Also added a test and implementation for an unrotate function
    that I found was neccesary.
    johanlindberg committed Jul 26, 2011
  4. @johanlindberg
  5. @johanlindberg
  6. @johanlindberg
  7. @johanlindberg

    Added some comments.

    johanlindberg committed Jul 26, 2011
  8. @johanlindberg
  9. @johanlindberg
  10. @johanlindberg
  11. @johanlindberg
  12. @johanlindberg
  13. @johanlindberg

    Added a test and function def for flipping fields horizontally.

    Running simple_reduction on p1.text which contains all 8 variations
    of the same puzzle reveals that we can get a better solution if we
    explore the puzzle from different angles.
    
    I intend to have a reduciton method that simple feeds all variations
    to simple_reduction and returns the best one.
    johanlindberg committed Jul 26, 2011
  14. @johanlindberg

    Refactored simple_reduction.

    I updated it to have it continue reducing greenhouses even
    though the max constraint is met if that means cost can be
    lowered. This also meant I had to update one of the tests.
    johanlindberg committed Jul 26, 2011
  15. @johanlindberg

    Added more variations of the puzzle.

    Since the simple reduction used is working from left to right, up to
    down. It will end up with different solutions if you rotate and/or
    flip the field. A simple way of improving the results is to produce
    all 8 variations of a given puzzle and use the one with the lowest
    cost.
    johanlindberg committed Jul 26, 2011
  16. @johanlindberg
Commits on Jul 25, 2011
  1. @johanlindberg
Commits on Jul 15, 2011
  1. @johanlindberg
  2. @johanlindberg

    Added a test to outer_bounds.

    Still trying to locate the problem with solve4 generating
    faulty solutions. One way to go about it is to have
    outer_bounds behave differently, returning None instead of
    a calculated size if the outer_bounds contain any cell
    not found in the list of greenhouse ids to look for. This
    way, solve4 can reject faulty joins.
    johanlindberg committed Jul 15, 2011
  3. @johanlindberg
Commits on Jul 14, 2011
  1. @johanlindberg

    Factored out the formatting code for printing field.

    I'm looking into why running python2.6 s1.py p1.txt results in
    an invalid solution (the point 8,3 overlaps).
    johanlindberg committed Jul 14, 2011
  2. @johanlindberg

    Updated solve function.

    johanlindberg committed Jul 14, 2011
  3. @johanlindberg