def TwoHops_CF_ICFsch3(Ps, P3, P4, g13, g14, g23, g24): ''' First, take the intersection of rate regions of 1st and 2nd hop Then, the the convex hull. Note: Conceptually, we should do 1). for bigR1, take the intersection of CF_bigR1 and ICF_bigR2 2). for bigR2, take the intersection of CF_bigR2 and ICF_bigR2 3). take the union of the above two intersections 4). take the convex hull. Actually, we did a) take the union of ICF_bigR1 and ICF_bigR2 b) take the intersection of a) and CF_whole c) take the convex hull of b) ''' alternative = True if alternative: # use alternative_rate_region.py return rr.intersection( [rr.union( [alternative_compute.ICF_sch3_bigR1(P3, P4), alternative_compute.ICF_sch3_bigR2(P3, P4)]), CF_scheme_integerCoeff(Ps, g13, g14, g23, g24)] ).convexHull() else: # use rate_region.py return rr.intersection( [rr.union( [ICF_sch3_bigR1(P3, P4), ICF_sch3_bigR2(P3, P4)]), CF_scheme_integerCoeff(Ps, g13, g14, g23, g24) ] ).convexHull()
def TwoHops_CF_ICFsch3_fromRegions(cf_scheme_integerCoeff, *icf_sch3 ): ''' compute the achievable rate region for the (whole) two-hop network from the given rate regions for the 1st and 2nd hops ''' if len(icf_sch3) == 1: return rr.intersection( [rr.union( [icf_sch3[0], icf_sch3[0].symmetricRegion_yEqualToX() ]), cf_scheme_integerCoeff] ).convexHull() elif len(icf_sch3) == 2: return rr.intersection( [rr.union( [icf_sch3[0], icf_sch3[1]]), cf_scheme_integerCoeff] ).convexHull()
def TwoHops_DFIntegerCoeff_FCo_fromRegions(df_scheme, fCo_scheme): ''' take the convex hull of the intersection of two rate regions for 1st and 2nd hop. ''' return rr.intersection( [df_scheme, fCo_scheme ]).convexHull()
def TwoHops_DFIntegerCoeff_FCo(Ps, P3, P4, g13, g14, g23, g24): ''' Both relays decode both messages and then forward these two messages coherently to the destination node. ''' return rr.intersection( [DF_scheme(Ps, Ps, g13, g14, g23, g24), FCo_scheme(P3, P4) ]).convexHull()
def TwoHops_CF_ICFsch2_fromRegions(icf_sch2_bigR1, icf_sch2_bigR2, cf_scheme_integerCoeff): ''' compute the achievable rate region for the (whole) two-hop network from the given rate regions for the 1st and 2nd hops ''' return rr.intersection( [rr.union( [icf_sch2_bigR1, icf_sch2_bigR2]), cf_scheme_integerCoeff ] ).convexHull()
def DF_scheme(P1, P2, g13, g14, g23, g24): ''' Let two relay nodes (node 3 and node 4) both decode both messages, which are independent. DF region is the intersection of two 2-user MAC capacity region For details: check documents within folder "notes_TwoUserCase" ''' return rr.intersection([MAC_capacity_independentMessages(P1, P2, g13, g23), MAC_capacity_independentMessages(P1, P2, g14, g24) ])
def TwoHops_noInterference_fromRegions(noInterference_1stHop, noInterference_2ndHop): ''' take the convex hull of the intersection. ''' return rr.intersection( [noInterference_1stHop, noInterference_2ndHop ] ).convexHull()
def TwoHops_noInterference(P1, P2, P3, P4): ''' take the convex hull of the intersection. ''' return rr.intersection( [NoInterference_1stHop(P1, P2), NoInterference_2ndHop(P3, P4) ]).convexHull()