This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
An interactive visualizer for TSP instances if you add `Visualizer.update(solution)` | |
after improving your solution you will see the new path and its cost. | |
>>> points = [(0, 0), (1, 1), (1, 2)] | |
>>> vis = Visualizer(points) | |
>>> Visualizer.update([0, 1, 2]) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
A simple generic wrapper for calling an external program to solve assignments | |
in Discrete Optimization | |
Copyright (C) 2012 Toby Davies | |
Permission is hereby granted, free of charge, to any person obtaining | |
a copy of this software and associated documentation files (the | |
"Software"), to deal in the Software without restriction, including |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class HashableFunc(object): | |
""" | |
This class acts as a decorator to make a function persistently hashable | |
""" | |
relevant_attr_names = ['co_argcount', 'co_cellvars', 'co_code', 'co_consts', | |
'co_filename', 'co_firstlineno', 'co_flags', 'co_freevars', | |
'co_lnotab', 'co_name', 'co_names', 'co_nlocals', 'co_stacksize', | |
'co_varnames'] |