def finishesFormula(dist1, dist2): #a+ = b+ and b- < a- beg_1 = getBeginning(dist1) end_1 = getEnding(dist1) beg_2 = getBeginning(dist2) end_2 = getEnding(dist2) com_beg_1 = calculateCenterMass(beg_1) com_end_1 = calculateCenterMass(end_1) com_beg_2 = calculateCenterMass(beg_2) com_end_2 = calculateCenterMass(end_2) size_beg_1 = getSize(beg_1) size_end_1 = getSize(end_1) size_beg_2 = getSize(beg_2) size_end_2 = getSize(end_2) print size_beg_1 print size_beg_2 print size_end_1 print size_end_2 return normalize(min(((size_end_1 + size_end_2) - abs(com_end_1[0] - com_end_2[0])) / (size_end_1 + size_end_2), (com_beg_1[0] - com_beg_2[0]) / (size_beg_1 + size_beg_2)))
def startsFormula(dist1, dist2): #a- = b- and a+ < b+ beg_1 = getBeginning(dist1) end_1 = getEnding(dist1) beg_2 = getBeginning(dist2) end_2 = getEnding(dist2) com_beg_1 = calculateCenterMass(beg_1) com_end_1 = calculateCenterMass(end_1) com_beg_2 = calculateCenterMass(beg_2) com_end_2 = calculateCenterMass(end_2) size_beg_1 = getSize(beg_1) size_end_1 = getSize(end_1) size_beg_2 = getSize(beg_2) size_end_2 = getSize(end_2) print("Beg1: {0}, end1: {1}".format(beg_1, end_1)) print("Beg2: {0}, end2: {1}".format(beg_2, end_2)) print("{0}, {1}".format(dist1, dist2)) print(size_beg_1 + size_beg_2) print(size_end_2 + size_end_1) return normalize(min(((size_beg_1 + size_beg_2) - abs(com_beg_1[0] - com_beg_2[0])) / (size_beg_1 + size_beg_2), (com_end_2[0] - com_end_1[0]) / (size_end_2 + size_end_1)))
def finishesFormula(dist1, dist2): #a+ = b+ and b- < a- beg_1 = temporal_interval_handling.getBeginning(dist1) end_1 = temporal_interval_handling.getEnding(dist1) beg_2 = temporal_interval_handling.getBeginning(dist2) end_2 = temporal_interval_handling.getEnding(dist2) com_beg_1 = temporal_interval_handling.calculateCenterMass(beg_1) com_end_1 = temporal_interval_handling.calculateCenterMass(end_1) com_beg_2 = temporal_interval_handling.calculateCenterMass(beg_2) com_end_2 = temporal_interval_handling.calculateCenterMass(end_2) size_beg_1 = temporal_interval_handling.getSize(beg_1) size_end_1 = temporal_interval_handling.getSize(end_1) size_beg_2 = temporal_interval_handling.getSize(beg_2) size_end_2 = temporal_interval_handling.getSize(end_2) print size_beg_1 print size_beg_2 print size_end_1 print size_end_2 return temporal_interval_handling.normalize( min(((size_end_1 + size_end_2) - abs(com_end_1[0] - com_end_2[0])) / (size_end_1 + size_end_2), (com_beg_1[0] - com_beg_2[0]) / (size_beg_1 + size_beg_2)))
def startsFormula(dist1, dist2): #a- = b- and a+ < b+ beg_1 = getBeginning(dist1) end_1 = getEnding(dist1) beg_2 = getBeginning(dist2) end_2 = getEnding(dist2) com_beg_1 = calculateCenterMass(beg_1) com_end_1 = calculateCenterMass(end_1) com_beg_2 = calculateCenterMass(beg_2) com_end_2 = calculateCenterMass(end_2) size_beg_1 = getSize(beg_1) size_end_1 = getSize(end_1) size_beg_2 = getSize(beg_2) size_end_2 = getSize(end_2) print("Beg1: {0}, end1: {1}".format(beg_1, end_1)) print("Beg2: {0}, end2: {1}".format(beg_2, end_2)) print("{0}, {1}".format(dist1, dist2)) print(size_beg_1 + size_beg_2) print(size_end_2 + size_end_1) return normalize( min(((size_beg_1 + size_beg_2) - abs(com_beg_1[0] - com_beg_2[0])) / (size_beg_1 + size_beg_2), (com_end_2[0] - com_end_1[0]) / (size_end_2 + size_end_1)))
def meetsFormula(dist1,dist2): #a+ = b- end_1 = temporal_interval_handling.getEnding(dist1) beg_2 = temporal_interval_handling.getBeginning(dist2) com_end_1 = temporal_interval_handling.calculateCenterMass(end_1) com_beg_2 = temporal_interval_handling.calculateCenterMass(beg_2) size_end_1 = temporal_interval_handling.getSize(end_1) size_beg_2 = temporal_interval_handling.getSize(beg_2) return temporal_interval_handling.normalize( ((size_end_1 + size_beg_2) - abs(com_end_1[0] - com_beg_2[0] )) / (size_end_1 + size_beg_2) )
def meetsFormula(dist1, dist2): #a+ = b- end_1 = getEnding(dist1) beg_2 = getBeginning(dist2) com_end_1 = calculateCenterMass(end_1) com_beg_2 = calculateCenterMass(beg_2) size_end_1 = getSize(end_1) size_beg_2 = getSize(beg_2) return normalize(((size_end_1 + size_beg_2) - abs(com_end_1[0] - com_beg_2[0])) / (size_end_1 + size_beg_2))
def beforeFormula(dist1,dist2): #a+ < b- end_1 = temporal_interval_handling.getEnding(dist1) beg_2 = temporal_interval_handling.getBeginning(dist2) com_end_1 = temporal_interval_handling.calculateCenterMass(end_1) com_beg_2 = temporal_interval_handling.calculateCenterMass(beg_2) size_end_1 = temporal_interval_handling.getSize(end_1) size_beg_2 = temporal_interval_handling.getSize(beg_2) #return com_end_1 < com_beg_2 return temporal_interval_handling.normalize( (com_beg_2[0] - com_end_1[0]) / (size_end_1+size_beg_2) )
def beforeFormula(dist1, dist2): #a+ < b- end_1 = getEnding(dist1) beg_2 = getBeginning(dist2) com_end_1 = calculateCenterMass(end_1) com_beg_2 = calculateCenterMass(beg_2) size_end_1 = getSize(end_1) size_beg_2 = getSize(beg_2) #return com_end_1 < com_beg_2 return normalize((com_beg_2[0] - com_end_1[0]) / (size_end_1 + size_beg_2))
def meetsFormula(dist1, dist2): #a+ = b- end_1 = temporal_interval_handling.getEnding(dist1) beg_2 = temporal_interval_handling.getBeginning(dist2) com_end_1 = temporal_interval_handling.calculateCenterMass(end_1) com_beg_2 = temporal_interval_handling.calculateCenterMass(beg_2) size_end_1 = temporal_interval_handling.getSize(end_1) size_beg_2 = temporal_interval_handling.getSize(beg_2) return temporal_interval_handling.normalize( ((size_end_1 + size_beg_2) - abs(com_end_1[0] - com_beg_2[0])) / (size_end_1 + size_beg_2))
def beforeFormula(dist1, dist2): #a+ < b- end_1 = temporal_interval_handling.getEnding(dist1) beg_2 = temporal_interval_handling.getBeginning(dist2) com_end_1 = temporal_interval_handling.calculateCenterMass(end_1) com_beg_2 = temporal_interval_handling.calculateCenterMass(beg_2) size_end_1 = temporal_interval_handling.getSize(end_1) size_beg_2 = temporal_interval_handling.getSize(beg_2) #return com_end_1 < com_beg_2 return temporal_interval_handling.normalize( (com_beg_2[0] - com_end_1[0]) / (size_end_1 + size_beg_2))
def meetsFormula(dist1, dist2): #a+ = b- end_1 = getEnding(dist1) beg_2 = getBeginning(dist2) com_end_1 = calculateCenterMass(end_1) com_beg_2 = calculateCenterMass(beg_2) size_end_1 = getSize(end_1) size_beg_2 = getSize(beg_2) return normalize( ((size_end_1 + size_beg_2) - abs(com_end_1[0] - com_beg_2[0])) / (size_end_1 + size_beg_2))
def duringFormula(dist1,dist2): #b- < a- and a+ < b+ beg_1 = temporal_interval_handling.getBeginning(dist1) end_1 = temporal_interval_handling.getEnding(dist1) beg_2 = temporal_interval_handling.getBeginning(dist2) end_2 = temporal_interval_handling.getEnding(dist2) com_beg_1 = temporal_interval_handling.calculateCenterMass(beg_1) com_end_1 = temporal_interval_handling.calculateCenterMass(end_1) com_beg_2 = temporal_interval_handling.calculateCenterMass(beg_2) com_end_2 = temporal_interval_handling.calculateCenterMass(end_2) size_beg_1 = temporal_interval_handling.getSize(beg_1) size_end_1 = temporal_interval_handling.getSize(end_1) size_beg_2 = temporal_interval_handling.getSize(beg_2) size_end_2 = temporal_interval_handling.getSize(end_2) return temporal_interval_handling.normalize( min((com_beg_1[0] - com_beg_2[0]) / (size_beg_1 + size_beg_2) , (com_end_2[0] - com_end_1[0]) / (size_end_2 + size_end_1)) )
def overlapsFormula(dist1, dist2): #a- < b- and b- < a+ and a+ < b+ beg_1 = getBeginning(dist1) end_1 = getEnding(dist1) beg_2 = getBeginning(dist2) end_2 = getEnding(dist2) com_beg_1 = calculateCenterMass(beg_1) com_end_1 = calculateCenterMass(end_1) com_beg_2 = calculateCenterMass(beg_2) com_end_2 = calculateCenterMass(end_2) size_beg_1 = getSize(beg_1) size_end_1 = getSize(end_1) size_beg_2 = getSize(beg_2) size_end_2 = getSize(end_2) return normalize(min((com_beg_2[0] - com_beg_1[0]) / (size_beg_2 + size_beg_1), (com_end_1[0] - com_beg_2[0]) / (size_end_1 + size_beg_2), (com_end_2[0] - com_end_1[0]) / (size_end_2 + size_end_1)))
def duringFormula(dist1, dist2): #b- < a- and a+ < b+ beg_1 = temporal_interval_handling.getBeginning(dist1) end_1 = temporal_interval_handling.getEnding(dist1) beg_2 = temporal_interval_handling.getBeginning(dist2) end_2 = temporal_interval_handling.getEnding(dist2) com_beg_1 = temporal_interval_handling.calculateCenterMass(beg_1) com_end_1 = temporal_interval_handling.calculateCenterMass(end_1) com_beg_2 = temporal_interval_handling.calculateCenterMass(beg_2) com_end_2 = temporal_interval_handling.calculateCenterMass(end_2) size_beg_1 = temporal_interval_handling.getSize(beg_1) size_end_1 = temporal_interval_handling.getSize(end_1) size_beg_2 = temporal_interval_handling.getSize(beg_2) size_end_2 = temporal_interval_handling.getSize(end_2) return temporal_interval_handling.normalize( min((com_beg_1[0] - com_beg_2[0]) / (size_beg_1 + size_beg_2), (com_end_2[0] - com_end_1[0]) / (size_end_2 + size_end_1)))
def equalsFormula(dist1, dist2): #a- = b- and a+ = b+ beg_1 = getBeginning(dist1) end_1 = getEnding(dist1) beg_2 = getBeginning(dist2) end_2 = getEnding(dist2) com_beg_1 = calculateCenterMass(beg_1) com_end_1 = calculateCenterMass(end_1) com_beg_2 = calculateCenterMass(beg_2) com_end_2 = calculateCenterMass(end_2) size_beg_1 = getSize(beg_1) size_end_1 = getSize(end_1) size_beg_2 = getSize(beg_2) size_end_2 = getSize(end_2) return normalize( min(((size_beg_1 + size_beg_2) - abs(com_beg_1[0] - com_beg_2[0])) / (size_beg_1 + size_beg_2), ((size_end_1 + size_end_2) - abs(com_end_1[0] - com_end_2[0])) / (size_end_1 + size_end_2)))
def overlapsFormula(dist1, dist2): #a- < b- and b- < a+ and a+ < b+ beg_1 = getBeginning(dist1) end_1 = getEnding(dist1) beg_2 = getBeginning(dist2) end_2 = getEnding(dist2) com_beg_1 = calculateCenterMass(beg_1) com_end_1 = calculateCenterMass(end_1) com_beg_2 = calculateCenterMass(beg_2) com_end_2 = calculateCenterMass(end_2) size_beg_1 = getSize(beg_1) size_end_1 = getSize(end_1) size_beg_2 = getSize(beg_2) size_end_2 = getSize(end_2) return normalize( min((com_beg_2[0] - com_beg_1[0]) / (size_beg_2 + size_beg_1), (com_end_1[0] - com_beg_2[0]) / (size_end_1 + size_beg_2), (com_end_2[0] - com_end_1[0]) / (size_end_2 + size_end_1)))