|
Data Structures and Algorithms
with Object-Oriented Design Patterns in Ruby |
Devise a suitable representation for the state of a node and then implement the following methods feasible?, complete?, objective, bound, and successors. Note, the successors method returns an iterator object that enumerates all the successors of a given node.
class GreedySolution < Solution
def greedySuccessor
# ...
end
endclass SimulatedAnnealingSolution < Solution
def randomSuccessor
# ...
end
end ![]()