class documentation

class Solver: (source)

View In Hierarchy

The solver class is instantiated for a given "problem" instance. It maintains a cache of solutions for subproblems to be able to recall them if they reoccur in the solving process.

Method __init__ Initialize a solver instance. Every instance has their own cache.
Method Solve Try to solve the given problem.
Instance Variable program Undocumented
Method _FindSolution Find a sequence of assignments that would solve the given state.
Method _RecallOrFindSolution Memoized version of FindSolution().
Class Variable _cache_metric Undocumented
Class Variable _goals_per_find_metric Undocumented
Instance Variable _path_finder Undocumented
Instance Variable _solved_states Undocumented
def __init__(self, program): (source)

Initialize a solver instance. Every instance has their own cache. Arguments: program: The program we're in.

def Solve(self, start_attrs, start_node): (source)

Try to solve the given problem. Try to prove one or more bindings starting (and going backwards from) a given node, all the way to the program entrypoint. Arguments: start_attrs: The assignments we're trying to have, at the start node. start_node: The CFG node where we want the assignments to be active. Returns: True if there is a path through the program that would give "start_attr" its binding at the "start_node" program position. For larger programs, this might only look for a partial path (i.e., a path that doesn't go back all the way to the entry point of the program).

Undocumented

def _FindSolution(self, state, seen_states): (source)

Find a sequence of assignments that would solve the given state.

def _RecallOrFindSolution(self, state, seen_states): (source)

Memoized version of FindSolution().

_cache_metric = (source)

Undocumented

_goals_per_find_metric = (source)

Undocumented

_path_finder = (source)

Undocumented

_solved_states: dict = (source)

Undocumented