Last active
December 8, 2021 05:36
-
-
Save jogam5/d1a91163ea54bee497bf1d618a2acf58 to your computer and use it in GitHub Desktop.
wwmse example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Note: 1 and 2 are simplifications to be more clear | |
# 1. Generate distribution: simplification | |
data_from_distribution = generate_rayleigh_CSI(parameter_1, parameter_2, parameter_3, ...) | |
# 2 Loop over data to compute wwmse: simplification | |
for sample in range(data_from_distribution): | |
wwmse = WMMSE(number_of_transceivers, sample, max_power_budget, noise) | |
# ==Parameters==: | |
# | |
# number_of_transceivers: number of single-antenna | |
# transceivers pairs (type: ndarray, shape: (10,), default=10) | |
# sample: sample of the distribution to be computed (type: ndarray, shape: (10,10)) | |
# max_power_budget: power budget of each transmitter (type: int, default:1) | |
# noise: noise (type: float, default:1.0) | |
# ========================= | |
# Note: 3 and 4 are real code | |
# 3. Output from one of the different distributions methods (rayleigh) before | |
# entering the loop. When it enters the loop, the array (1,100) is reshaped into a | |
# (10,10) array. The (10,10) array is the one used as input for parameter "H". | |
# | |
Rayleigh: (20000, 100) , <class 'numpy.ndarray'> | |
Rayleigh first row exammple (1, 100): [0.73726645 0.4591307 1.17678047 1.06890929 1.7022319 0.70239894 | |
1.00141185 1.28763866 1.07092557 0.08352788 0.76777986 1.38532127 | |
0.42888726 0.27903338 0.58691025 0.69247862 1.38472584 1.31138042 | |
0.33567388 0.66638627 0.95206096 1.05981347 2.24319029 0.84454063 | |
1.04057974 0.40758808 0.9311077 0.56890818 0.55937325 0.89496559 | |
0.8980085 0.83251139 0.58396146 0.97541061 1.26303782 1.32623366 | |
0.54001067 0.58822374 0.41641521 0.31058773 0.50976306 0.39001463 | |
1.70138358 1.74412918 0.95101006 0.36662434 0.2295487 0.59322144 | |
0.54342352 0.33651321 2.34283749 1.21255351 0.51790161 0.70098649 | |
0.60306511 0.87564781 1.50796222 0.26442621 1.04125186 0.36776211 | |
0.71884519 0.92494189 0.58118326 1.27835902 0.22412188 1.45130246 | |
0.86711031 0.35353472 1.28052904 0.82492686 0.33711347 0.93950375 | |
0.84693652 0.9374323 1.99400671 1.71494858 0.69775086 0.16599246 | |
0.79118827 0.8957736 0.39370973 1.20624926 1.61031853 0.27995009 | |
0.98711437 1.67149709 1.13517947 0.62234045 0.85480029 0.57429993 | |
0.39867545 1.65346519 0.54472579 1.69342232 0.26588566 0.92129592 | |
0.17996725 1.22113943 0.8252 0.90242043] | |
# 4. Inside wmmse | |
def WMMSE_sum_rate(p_int, H, Pmax, var_noise): | |
""" | |
Returns the Weighted System Throughput based on the | |
WMMSE algorithm [3]. | |
The WMMSE algorithm converts the weighted sum-rate (WSR) | |
maximization problem to a higher dimensional space where | |
it can be solved. Following [2], the algorithm was modified | |
to work in the real domain. | |
Input | |
# variables/values can be found in channel.py and generate_data.py file | |
p_int: number of single-antenna transceivers pairs (type: ndarray, shape: (10,), default: 10) | |
H: sample of the distribution to be computed (type: ndarray, shape: (10,10)) | |
Pmax: power budget of each transmitter (type: int, default:1) | |
var_noise: noise (type: float, default:1.0) | |
Output | |
p_opt: weighted system throughput (type: ndarray, shape: (10,10)) | |
""" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment