Пример #1
0
def LErrorTypedPrefix(G, M, E):
    # possible number of edges in an undirected, non-self-connected graph of N nodes
    posNumEdges = (G.numNodes * G.numNodes - G.numNodes) / 2
    costM = LnU(E.numCellsCovered - E.numCellsExcluded, E.numModellingErrors)
    if config.optVerbosity > 1: print ' - L_tp(E+)', costM
    costU = LnU(posNumEdges - E.numCellsCovered, E.numUnmodelledErrors)
    if config.optVerbosity > 1: print ' - L_tp(E-)', costU
    #print E.numCellsCovered, E.numCellsExcluded, E.numModellingErrors, posNumEdges, E.numUnmodelledErrors;
    if config.optOverlap:
        # possible number of edges overlapped, number of edges overlapped
        #costO = LnU(E.numCellsCovered - E.numCellsExcluded, E.numEdgeOverlapped);
        countOverlappedCells = E.listToSet()
        if config.optDebug:
            print "overlap counts: " + str(countOverlappedCells)
        numOverlappedCells = len(countOverlappedCells)
        if config.optDebug:
            print "# overlaps: " + str(numOverlappedCells)
        if numOverlappedCells >= 1:
            costO = log(numOverlappedCells, 2)
            costO += LnU(posNumEdges, posNumEdges - numOverlappedCells)
            for i in range(len(countOverlappedCells)):
                for j in range(len(countOverlappedCells[i])):
                    if config.optDebug:
                        print "i: " + str(i) + " j: " + str(j)
                    costO += LN(countOverlappedCells[i][j])
        else:
            costO = 0

    if config.optOverlap:
        return costM + costU + costO
    else:
        return costM + costU
Пример #2
0
def LErrorTypedPrefix(G, M, E) :
    # possible number of edges in an undirected, non-self-connected graph of N nodes
    posNumEdges = (G.numNodes * G.numNodes - G.numNodes) / 2
    costM = LnU(E.numCellsCovered - E.numCellsExcluded, E.numModellingErrors);
    if config.optVerbosity > 1 : print ' - L_tp(E+)', costM;
    costU = LnU(posNumEdges - E.numCellsCovered, E.numUnmodelledErrors);
    if config.optVerbosity > 1 : print ' - L_tp(E-)', costU;
    #print E.numCellsCovered, E.numCellsExcluded, E.numModellingErrors, posNumEdges, E.numUnmodelledErrors;
    return costM + costU;
Пример #3
0
def LErrorNaivePrefix(G, M, E):
    # possible number of edges in an undirected, non-self-connected graph of N nodes
    posNumEdges = (G.numNodes * G.numNodes - G.numNodes) / 2
    cost = LnU(posNumEdges - E.numCellsExcluded,
               E.numModellingErrors + E.numUnmodelledErrors)
    if config.optVerbosity > 1: print ' - L_np(E)', cost
    return cost