def validation(Point_P, Point_Q, gEpG,radius,a=0.7):
    P = compactPoint(Point_P)
    P_list = P.keys()
    Q = compactPoint(Point_Q)
    Q_list = Q.keys()
    vr = validationReport()
    PQ_EpG = cross_EpG(gEpG,P_list,Q_list)
    #identificazione prove
    IJK,IKL,I=observations(P_list, Q_list, PQ_EpG)
    if len(IJK)+len(IKL)<4:
        vr.merge=True
        PE=[]
        QE=[]
        vr.setMerge(P,Q,PE,QE)
    #osservazione
    inlier_IJK,rkp,inlier_IKL,rip,inlier_I=pointTransferVectorized(P,Q,PQ_EpG,maxLevel=radius,alfa=a,IJK=IJK,IKL=IKL,I=I)
    #calcolo punteggio==>parte da rifare
    ISB=iterativeScoreBoard(P_list,Q_list,IJK,inlier_IJK,IKL,inlier_IKL,I,inlier_I)
    iterations=0
    while ISB.board.outliers_count > 0 and ISB.tick(ExcludeClassifier):
        iterations+=1
    #now the point is stable under worst point exclusion
    merge_x=ISB.mergeInputModel()
    vr.merge=MergeClassifier.predict(merge_x)
    if vr.merge:
        PE=ISB.Pe
        QE=ISB.Qe
        vr.setMerge(P,Q,PE,QE)
    else:
        vr.setSplit(P,Q,I)
    return vr       
def validation_old(Point_P, Point_Q, gEpG,radius,a=0.7):
    P = compactPoint(Point_P)
    P_list = P.keys()
    Q = compactPoint(Point_Q)
    Q_list = Q.keys()
    vr = validationReport(Point_P,P,Point_Q,Q)
    PQ_EpG = cross_EpG(gEpG,P_list,Q_list)
    #identificazione prove
    IJK,IKL,I=observations(P_list, Q_list, PQ_EpG)
    #osservazione
    inlier_IJK,rkp,inlier_IKL,rip,inlier_I=pointTransferVectorized(P,Q,PQ_EpG,maxLevel=radius,alfa=a,IJK=IJK,IKL=IKL,I=I)
    #calcolo punteggio
    inliers_count,outliers_count,P_inliers,Q_inliers,P_outliers,Q_outliers=score(P_list,Q_list,IJK,inlier_IJK,IKL,inlier_IKL,I,inlier_I)
    vr.R_in = inliers_count
    vr.R_out = outliers_count
    vr.merge=vr.R_in>vr.R_out
    if vr.merge :
        clearCommons(I,inlier_I,vr,P_inliers,P_outliers,Q_inliers,Q_outliers)
        qualityRatio=float(vr.R_in)/(vr.R_in+vr.R_out)
        P_worst = max(P_list, key=lambda I: P_outliers[I]-P_inliers[I] if I not in vr.P_exclude else -10000) 
        Q_worst = max(Q_list, key=lambda I: Q_outliers[I]-Q_inliers[I] if I not in vr.Q_exclude else -10000)
        P_gain = P_outliers[P_worst]-P_inliers[P_worst]
        Q_gain = Q_outliers[Q_worst]-Q_inliers[Q_worst]
        P_qualityRatio=P_inliers[P_worst]/float(P_inliers[P_worst]+P_outliers[P_worst]) if P_outliers[P_worst]>0 else 0.
        Q_qualityRatio=Q_inliers[Q_worst]/float(Q_inliers[Q_worst]+Q_outliers[Q_worst]) if Q_outliers[Q_worst]>0 else 0.
        if P_gain>0 and P_qualityRatio<qualityRatio and len(P_list)>2:
            vr.P_exclude.add(P_worst)
        if Q_gain>0 and Q_qualityRatio<qualityRatio and len(Q_list)>2:
            vr.Q_exclude.add(Q_worst) 
    return vr
def validation(Point_P, Point_Q):
    P = compactPoint(Point_P)
    P_list = P.keys()
    Q = compactPoint(Point_Q)
    Q_list = Q.keys()
    vr = validationReport()
    vr.merge=True
    PE=[]
    QE=[]
    vr.setMerge(P,Q,PE,QE)
    return vr