Beispiel #1
0
 def __init__(self, cactusHistory):
     super(OrderedHistory, self).__init__(cactusHistory.cactus)
     self.copy(cactusHistory)
     self.eventCosts = cactusHistory.eventCosts
     self.ordering = PartialOrderSet(X for X in self.parent)
     for event in self.parent:
         if self.parent[event] is not None and (
                 debug.DEBUG or event.ratio > debug.RATIO_CUTOFF):
             assert self.ordering.addConstraint(self.parent[event], event)
Beispiel #2
0
	def __init__(self, cactusHistory):
		super(OrderedHistory, self).__init__(cactusHistory.cactus)
		self.copy(cactusHistory)
		self.eventCosts = cactusHistory.eventCosts
		self.ordering = PartialOrderSet(X for X in self.parent)
		for event in self.parent:
			if self.parent[event] is not None and (debug.DEBUG or event.ratio > debug.RATIO_CUTOFF): 
				assert self.ordering.addConstraint(self.parent[event], event)
Beispiel #3
0
class OrderedHistory(ScheduledHistory):
	""" History with arbitrary linear ordering compatible with tree structure """

	def __init__(self, cactusHistory):
		super(OrderedHistory, self).__init__(cactusHistory.cactus)
		self.copy(cactusHistory)
		self.eventCosts = cactusHistory.eventCosts
		self.ordering = PartialOrderSet(X for X in self.parent)
		for event in self.parent:
			if self.parent[event] is not None and (debug.DEBUG or event.ratio > debug.RATIO_CUTOFF): 
				assert self.ordering.addConstraint(self.parent[event], event)
	
	def braneyText(self, ID, cost=None):
		if cost is None:
			cost = self.rearrangementCost()
		return "\n".join(filter(lambda X: len(X) > 0, (X[1].braneyText(ID, X[0], self.ordering, cost, self.eventCosts) for X in enumerate(self.netHistories.values()))))
Beispiel #4
0
class OrderedHistory(ScheduledHistory):
    """ History with arbitrary linear ordering compatible with tree structure """
    def __init__(self, cactusHistory):
        super(OrderedHistory, self).__init__(cactusHistory.cactus)
        self.copy(cactusHistory)
        self.eventCosts = cactusHistory.eventCosts
        self.ordering = PartialOrderSet(X for X in self.parent)
        for event in self.parent:
            if self.parent[event] is not None and (
                    debug.DEBUG or event.ratio > debug.RATIO_CUTOFF):
                assert self.ordering.addConstraint(self.parent[event], event)

    def braneyText(self, ID, cost=None):
        if cost is None:
            cost = self.rearrangementCost()
        return "\n".join(
            filter(lambda X: len(X) > 0,
                   (X[1].braneyText(ID, X[0], self.ordering, cost,
                                    self.eventCosts)
                    for X in enumerate(self.netHistories.values()))))