Beispiel #1
0
 def __init__(self, dimension):
     """initialize a new problem"""
     Notifier.__init__(self)
     Listener.__init__(self)
     self.dimension = dimension
     self.prototype = {}
     self.cg = ConstraintGraph()
Beispiel #2
0
 def __init__(self, methodclasses):
     """Create a new solver, using the given subclasses of ClusterMethod."""
     # init superclasses
     Notifier.__init__(self)
     # store arguments
     self._methodclasses = methodclasses
     self._pattern_methods = filter(lambda m: hasattr(m,"patterngraph"),self._methodclasses)
     self._handcoded_methods = filter(lambda m: hasattr(m,"handcoded_match"),self._methodclasses)
     self._incremental_methods = filter(lambda m: hasattr(m,"incremental_matcher"),self._methodclasses)
     # init instance vars
     self._graph = Graph()
     #self._graph.add_vertex("_root")
     # self._graph.add_vertex("_toplevel")
     self._graph.add_vertex("_variables")
     self._graph.add_vertex("_clusters")
     self._graph.add_vertex("_methods")
     self._new = []
     self._mg = MethodGraph()
     # add prototype_selection boolean var to method graph
     self._prototype_selection_var = "_prototype_selection_enabled"
     self._mg.add_variable(self._prototype_selection_var)
     self._mg.set(self._prototype_selection_var, True)
     # store map of selection_constraints to SelectionMethod (or None)
     self._selection_method = {} 
     # store root cluster (will be assigned when first cluster added)
     self._rootcluster = None
     # an incrementally updated toplevel set
     self._toplevel = MutableSet()
     # incrementally updated set of applicable methods
     self._incremental_matchers = map(lambda method: method.incremental_matcher(self), self._incremental_methods)
     #print "incremental matchers:",self._incremental_matchers
     self._applicable_methods = Union(*self._incremental_matchers)
Beispiel #3
0
    def __init__(self, client, email_info, owner):

        Notifier.__init__(self, client, email_info, owner)
        self.frm = email_info.get("from", None)
        self.name = email_info.get("name", None)
        self.smtp = email_info.get("smtp", None)
        self.username = email_info.get("username", None)
        self.password = email_info.get("password", None)
Beispiel #4
0
 def __init__(self):
     """Create a new, empty ConstraintGraph"""
     Notifier.__init__(self)
     self._variables = {}
     """A set of variables"""
     self._constraints = {}
     """A set of constraints"""
     self._graph = Graph()
     """A graph for fast navigation. The graph contains an
Beispiel #5
0
 def __init__(self):
     """Create a new, empty ConstraintGraph"""
     Notifier.__init__(self)
     self._variables = {}
     """A set of variables"""
     self._constraints = {}
     """A set of constraints"""
     self._graph = Graph()
     """A graph for fast navigation. The graph contains an
Beispiel #6
0
 def __init__(self, graph=None):
     Notifier.__init__(self)
     self._dict = {}
     """the edges are stored in a dictionary of dictionaries"""
     self._reverse = {}
     """the reverse graph is stored here"""
     # copy input graph
     if graph:
         for v in graph.vertices():
             self.add_vertex(v)
         for e in graph.edges():
             (v,w) = e
             self.set(v,w,graph.get(v,w))
Beispiel #7
0
 def __init__(self, graph=None):
     Notifier.__init__(self)
     self._dict = {}
     """the edges are stored in a dictionary of dictionaries"""
     self._reverse = {}
     """the reverse graph is stored here"""
     # copy input graph
     if graph:
         for v in graph.vertices():
             self.add_vertex(v)
         for e in graph.edges():
             (v,w) = e
             self.set(v,w,graph.get(v,w))
Beispiel #8
0
 def __init__(self, dimension):
     """Create a new empty solver"""
     Notifier.__init__(self)
     self.dimension = dimension
     self._graph = Graph()
     self._graph.add_vertex("_root")
     self._graph.add_vertex("_toplevel")
     self._graph.add_vertex("_variables")
     self._graph.add_vertex("_distances")
     self._graph.add_vertex("_angles")
     self._graph.add_vertex("_rigids")
     self._graph.add_vertex("_hedgehogs")
     self._graph.add_vertex("_balloons")
     self._graph.add_vertex("_methods")
     # queue of new objects to process
     self._new = []
     # methodgraph
     self._mg = MethodGraph()
Beispiel #9
0
    def __init__(self, graph=None):
        Notifier.__init__(self)
        self._dict = {}
        """the edges are stored in a dictionary of dictionaries"""
        self._reverse = {}
        """the reverse graph is stored here"""

        self._fanin = {}
        """map from vertices to fan-in number"""  
        self._fanout = {}
        """map from vertices to fan-out number"""  
        self._infan = {}
        """map from fan-in numbers to vertices with that fan-in"""  
        self._outfan = {}
        """map from fan-out numbers to vertices with that fan-out"""  
        # copy input graph
        if graph:
            for v in graph.vertices():
                self.add_vertex(v)
            for e in graph.edges():
                (v,w) = e
                self.set(v,w,graph.get(v,w))
Beispiel #10
0
    def __init__(self, graph=None):
        Notifier.__init__(self)
        self._dict = {}
        """the edges are stored in a dictionary of dictionaries"""
        self._reverse = {}
        """the reverse graph is stored here"""

        self._fanin = {}
        """map from vertices to fan-in number"""  
        self._fanout = {}
        """map from vertices to fan-out number"""  
        self._infan = {}
        """map from fan-in numbers to vertices with that fan-in"""  
        self._outfan = {}
        """map from fan-out numbers to vertices with that fan-out"""  
        # copy input graph
        if graph:
            for v in graph.vertices():
                self.add_vertex(v)
            for e in graph.edges():
                (v,w) = e
                self.set(v,w,graph.get(v,w))
Beispiel #11
0
 def __init__(self, methodclasses):
     """Create a new solver, using the given subclasses of ClusterMethod."""
     # init superclasses
     Notifier.__init__(self)
     # store arguments
     self._methodclasses = methodclasses
     self._pattern_methods = filter(lambda m: hasattr(m, "patterngraph"),
                                    self._methodclasses)
     self._handcoded_methods = filter(
         lambda m: hasattr(m, "handcoded_match"), self._methodclasses)
     self._incremental_methods = filter(
         lambda m: hasattr(m, "incremental_matcher"), self._methodclasses)
     # init instance vars
     self._graph = Graph()
     #self._graph.add_vertex("_root")
     # self._graph.add_vertex("_toplevel")
     self._graph.add_vertex("_variables")
     self._graph.add_vertex("_clusters")
     self._graph.add_vertex("_methods")
     self._new = []
     self._mg = MethodGraph()
     # add prototype_selection boolean var to method graph
     self._prototype_selection_var = "_prototype_selection_enabled"
     self._mg.add_variable(self._prototype_selection_var)
     self._mg.set(self._prototype_selection_var, True)
     # store map of selection_constraints to SelectionMethod (or None)
     self._selection_method = {}
     # store root cluster (will be assigned when first cluster added)
     self._rootcluster = None
     # an incrementally updated toplevel set
     self._toplevel = MutableSet()
     # incrementally updated set of applicable methods
     self._incremental_matchers = map(
         lambda method: method.incremental_matcher(self),
         self._incremental_methods)
     #print "incremental matchers:",self._incremental_matchers
     self._applicable_methods = Union(*self._incremental_matchers)
Beispiel #12
0
 def __init__(self):
     """initialize ParametricConstraint"""
     Notifier.__init__(self)
     self._value = None