New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extending the project to include NOMA signal detection #11
Comments
This paper cites [2] S. Kasi and K. Jamieson, “Towards quantum belief propagation for LDPC See equation (1) and (2) from the NOMA paper you cite. We have codes to support mimo, which are based on the same formulation. Our code should support abitrary s (called F, the channel, in our code) and y (the signal), create a QUBO appropriate for maximum likelihood (subject to the spin-encoding described in cited papers), and perform transforms from symbols to spins. Symbols need to be from the BPSK, QPSK, 16QAM or 64QAM constellations.. |
Hi, indeed the citation seems to be mistaken. |
https://github.com/dwavesystems/dimod/blob/63d46298655621f54206ce2d86d20f5baa65fc57/dimod/generators/wireless.py#L540 To calculate the bit error rate, you can solve the bqm and then take your best solution (spins_ideal, a numpy array) and compare it to As you mention, NOMA has some domain specific channel features (per Figure 1). A function that generates F accordingly might be appropriate. |
I have tried to follow your path and have written the following for simple case of 2 users employing BPSK: Construct the channel matrix FF = np.array([[h1], # Channel gain for user 1 Set other parametersnum_receiver = 2 Construct channel_noise as a (num_receiver, 1) shaped numpy arraychannel_noise = np.sqrt(variance) * np.random.randn(num_receiver, 1) Construct transmitted_symbols as a (num_transmitter, 1) shaped array (BPSK modulation)transmitted_symbols = np.random.choice([-1, 1], size=(num_transmitter, 1)) Generate the Ising model using dimodbqm = dimod.generators.wireless.mimo(modulation='BPSK', F=F, channel_noise=channel_noise, transmitted_symbols=transmitted_symbols) Print the generated Ising modelprint(f"BQM has {len(bqm)} variables with {len(bqm.quadratic)} quadratic interactions.") sampler = FixedEmbeddingComposite(qpu, embedding) Sample the Ising modelsampleset = sampler.sample(bqm, Get the best solutionsample = sampleset.first.sample 3. Convert transmitted symbols to spinsspins_ideal = dimod.generators.wireless._symbols_to_bits(transmitted_symbols, modulation='BPSK') Calculate the bit error rate (assuming spins_ideal is already calculated)bit_error_rate = (1 - np.mean(spins_ideal * spins_best)) / 2 Print the bit error rateprint("Bit Error Rate:", bit_error_rate)` everytime i run this i get this result: Thanks alot for your time helping me, i really appreciate your support. |
@jackraymond also, i forgot to ask you how to do embedding for my problem, I tried to read the documentation on DWave's website but i feel kind of lost. i am grateful for your help :) |
A 1 transmitter problem has no interference and so the decoding problem is easy, subject to noise. Your noise here is also small (compared to your gain). As such, I think it makes sense that you see a bit error rate of zero. If F is dense, then you will need a clique embedding. The quickest way to start sampling is to use https://docs.ocean.dwavesys.com/projects/system/en/stable/_modules/dwave/system/samplers/clique.html the DWaveCliqueSampler in place of FixedEmbeddingComposite. |
you are right, I have flipped the num# of Rx, Tx it should be the reverse. the weird thing is that if you notice the {len(bqm)} variables with {len(bqm.quadratic)} quadratic interactions. gives 'BQM has 1 variables with 0 quadratic interactions' which is not correct i think..
Define the number of receivers and transmittersnum_receiver = 1 # Single base station Define the transmit power (assumed to be the same for all users)P = 1.0 Define the path-loss exponenttau = 2 Define the distances of end-users from the base stationdistances = np.array([50, 75, 100, 120]) Construct the channel coefficients (h_k) based on the given modelh_tilde = np.random.randn(num_transmitter) + 1j * np.random.randn(num_transmitter) Construct F as a (num_receiver, num_transmitter) shaped numpy arrayF = np.sqrt(P) * h.reshape(1, -1) Define the noise variancesigma_n_squared = 0.1 Construct channel_noise as a (num_receiver, 1) shaped numpy arraychannel_noise = np.sqrt(sigma_n_squared) * (np.random.randn(num_receiver, 1) + 1j * np.random.randn(num_receiver, 1)) Decide on the modulation (example: QPSK)modulation = 'QPSK' Construct transmitted_symbols as a (num_transmitter, 1) shaped arrayif modulation == 'QPSK': Generate the Ising model using mimo functionbqm = mimo(modulation=modulation, F=F, channel_noise=channel_noise, transmitted_symbols=transmitted_symbols) Set up the QPU samplerqpu = DWaveSampler() Create the EmbeddingComposite samplersampler = EmbeddingComposite(qpu) Solve the BQM using the EmbeddingComposite samplersampleset = sampler.sample(bqm, Get the best solution (spins) from the samplesetspins_best = sampleset.first.sample Convert the transmitted symbols to spins (ideal spins)spins_ideal = dimod.generators.wireless._symbols_to_bits(transmitted_symbols, modulation=modulation) Extract the spin values from the best solution dictionaryspins_best_values = np.array(list(spins_best.values())) Calculate the bit error ratebit_error_rate = (1 - np.mean(spins_ideal == spins_best_values)) / 2 print(f"Bit Error Rate: {bit_error_rate}") Calculate the signal power for each usersignal_power = np.abs(h)**2 * P Calculate the noise powernoise_power = sigma_n_squared Calculate the SNR for each user (in linear scale)snr_linear = signal_power / noise_power Convert the SNR to dB scalesnr_db = 10 * np.log10(snr_linear) Print the SNR for each userfor i, snr in enumerate(snr_db): the code seems to work but gives higher than expected (compared with results in the paper) BER hovering around ~0.25, i have tried to fiddle around with different SNR ( changing Power , pathloss distance , AWGN) but same results, how can i know if i am going on the right track? also, I noticed the author of the paper mention something about running the same problem many times
I know that the solution of QA will differ each run but is it critical to run the simulation many times( the author mentions 380times) and take the average to ensure accurateness? sorry for the many questions but i don't have anyone else to talk to about it ! can't express my gratitude to your help 👍 |
also, when using CoMP (your demo) for higher modulation schemes (16QAM,64QAM,256QAM), i get this error `--------------------------------------------------------------------------- KeyError: 1920 During handling of the above exception, another exception occurred: MissingChainError Traceback (most recent call last) File ~\AppData\Roaming\Python\Python312\site-packages\dwave\system\composites\embedding.py:499, in LazyFixedEmbeddingComposite.sample(self, bqm, **parameters) MissingChainError: chain for 1920 is empty or not contained in this embedding the issue also seems to be related to embedding, i tried changing it to clique but it gave error limit of 3xx something.. embedding composite seem to work ( takes alot of time ) but then it throws an error of mismatch in _compare_signals |
The embedding is unfortunately specific both to the combination of the modulation scheme and the structure of network, it is BPSK only (as you found). |
I copy pasted some of this code to run, but there are missing dependencies. Regardless, I dont have much time to reproduce results. |
QPSK also works, and other modulation schemes require
but it also seems to be lacking something.. as QAM is symbols that have more than one bit embedded, how does QA output the spins in this case? from the paper you have as reference (by KIM) mentions mapping of symbols to qubo variables but i don't really understand it! |
can you elaborate on how to submit multiple (M) jobs in parallel at the same time? is it just simple loop that sequentially submit each time (not really parallel) or there's a specific command? also for BER it seems that there's something associated with the array shape of BER method, that's why it's always giving 0.25 while it was giving 0
I have tried to fix it using
but now I get 0 errors! I mean literally everytime it decodes the bits correctly (too perfect as there must be some errors!) and the weird thing changing the channel coefficients in (F) or the number of users doesn't change the results, the only solution i can think of (not really a solution) is not to consider only best solution (first sample) but get many samples to account for BER. |
Hi, I am actively working to extend this to include also the leading NOMA detection along with MIMO. I have QUBO formulation from one of the research papers but I have no idea to implement it using your libraries. can you help me?
2301.03872_3.pdf
The text was updated successfully, but these errors were encountered: