def __init__(self, idelta=0): #Define the Initial Rectangle P left = -1.5 top = -1.5 width = 3.0 height = 3.0 #L = sup_{x in P}(||grad(phi(x))||) self.halfL = self.getCurrentHalfL(Rect(left, top, width, height)) CoveringTree.__init__(self, Rect(left, top, width, height), idelta)
def hSplitter(iBox): newleft1 = iBox.left newtop1 = iBox.top newwidth1 = iBox.width newheight1 = iBox.height/2.0 Rleft = Rect(newleft1, newtop1, newwidth1, newheight1) newleft2 = iBox.left newtop2 = iBox.top + iBox.height/2.0 newwidth2 = iBox.width newheight2 = iBox.height/2.0 Rright = Rect(newleft2, newtop2, newwidth2, newheight2) return Rleft, Rright
def getMinVal(self, xbounds, ybounds, diam): iBox = Rect(xbounds[0], ybounds[0], xbounds[1] - xbounds[0], ybounds[1] - ybounds[0]) curBoxes = [iBox] lCntrs = [self.getCurrentCntrVal(iBox)] tempBoxes = [] eps = self.getCurrentHalfL(iBox)*self.delta while curBoxes: for box in curBoxes: minorant = self.getCurrentMinVal(box) if minorant >= min(lCntrs) - eps: continue lCntrs.append(self.getCurrentCntrVal(box)) box1, box2 = self.splitCurrentBox(box) tempBoxes.append(box1) tempBoxes.append(box2) curBoxes = tempBoxes tempBoxes = [] minVal = min(lCntrs) lCntrs = [] return minVal
def __init__(self, idelta=0): # The Initial Rectangle P definition left = -1.5 top = -1.5 width = 3.0 height = 3.0 # The algorithm parameters initialization self.delta = idelta self.eps = self.getCurrentHalfL(Rect(left, top, width, height)) * idelta self.halfL = self.getCurrentHalfL(Rect(left, top, width, height)) # The CoveringTree class constructor CoveringTree.__init__(self, Rect(left, top, width, height), self.delta, self.eps)
def __init__(self, l0, l1_bounds, l2_bounds, idelta=0): # Initialize Base self.__l0 = l0 # Initialize the Bounds self.__l1_bounds = l1_bounds self.__l2_bounds = l2_bounds # Define the Initial Rectangle P left = -self.__l1_bounds[1]-idelta top = 0-idelta width = self.__l1_bounds[1]+self.__l0+self.__l2_bounds[1]+2*idelta height = min(self.__l1_bounds[1], self.__l2_bounds[1])+2*idelta # Initialize algorithm parameters self.delta = idelta self.eps = self.getCurrentHalfL(Rect(left, top, width, height))*idelta # The CoveringTree class constructor CoveringTree.__init__(self, Rect(left, top, width, height), self.delta, self.eps)
def __init__(self, idelta=0): #Define the Initial Rectangle P left = -1.5 top = -1.5 width = 3.0 height = 3.0 CoveringTree.__init__(self, Rect(left, top, width, height), idelta)
def __init__(self, l0, l1_bounds, l2_bounds, idelta=0): #Initialize Base self.__l0 = l0 #Initialize the Bounds self.__l1_bounds = l1_bounds self.__l2_bounds = l2_bounds #Define the Initial Rectangle P left = -self.__l1_bounds[1] top = 0 width = self.__l1_bounds[1]+self.__l0+self.__l2_bounds[1] height = min(self.__l1_bounds[1], self.__l2_bounds[1]) CoveringTree.__init__(self, Rect(left, top, width, height), idelta)