Προς το περιεχόμενο

Αποθήκευση ισοζυγίου Nash σε MATLAB


jmo2005

Προτεινόμενες αναρτήσεις

Δημοσ.

My code is about power control via game theory.

I want to save players' utilities @ Nash equilibrium.

Ok, the problem is about telecommunications.

Specifically, it is efficient power control via pricing in wireless data networks.

There is a utility function (u=L*R.*f./(M.*pj)-c.*pj)

f is the efficiency function (f=(1-2.*pe).^M)

pe is the Bit Error Rate

and g is the Signal to Interference Ratio

k is a constant equal to 7,75*10^(-3)

M is total number of bits per frame

L is number of information bits per frame

W is spread spectrum bandwidth

R is bit rate

s^2 is noise at the receiver

h=k./(d.^4) is simply the gain of the route

and pmax is the maximum powwer constraint for every player

d=[0.31 0.46 0.57 0.66 0.74 0.81 0.88 0.94 1.00] is the list of distances that players have from the terminal

We try all power levels pj=0.001:0.00001:pmax for every player and compute signal, interference and then utility, trying to find the best response.

We also try all cost levels c=10^3:10^4:10^10^5 for every power level, for every player at every trial to find the best response via pricing, as the previous process does not results to an efficient equilibrium!

The general idea is to find the maximum utilities and save them.All I have to do now is the last part which is saving utilities at equilibrium and make a graph of the results!I know that you might still not have a clear picture, but I just tried to describe you the concept...

Any help is welcome and even a little bit of code that is not correct, just to give me an idea of how to do these things...Thanks in advance!

 

Here is my code:

 

>close all; 
clear all; 


L=64;
R=10^4;
M=80;
W=10^6;
s2=5*10^(-15);
pmax=2;
k=0.097*10^(-3);
pj=0.001:0.00001:pmax;
d=[0.31 0.46 0.57 0.66 0.74 0.81 0.88 0.94 1.00];
h=k./(d.^4);
ind=1;
ind2=1;
p(ind,=ones(1,9);
q=zeros(1,9);
for c=10^3:10^4:10^10^5;
c
while max(abs(p(ind,-q))>10^(-4) 
q=p(ind,
ind=ind+1;
for i=1:9
g=(W/R)*(h(i)*pj)/(sum(h(1:(i-1)).*p(ind-1,1:(i-1)))+sum(h((i+1):end).*p(ind-1,(i+1):end)) + s2);
pe=0.5.*exp(-g./2);
f=(1-2.*pe).^M;
u=L*R.*f./(M.*pj)-c.*pj;
um=max(u);
kk=find(u==um);
p(ind,i)=pj(kk);

end

end
pfin(ind2,=p(ind,;
ind2=ind2+1; 
ind=1;
clear p
p(ind,=ones(1,9);

end

 

---------- Προσθήκη στις 17:05 ---------- Προηγούμενο μήνυμα στις 17:04 ----------

 

Κάνω διπλωματική πάνω στην κατανομή ισχύος σε ασύρματα δίκτυα με εφαρμογή της θεωρίας παιγνίων και είμαι κοντά στην ολοκλήρωση της προσωμοίωσης.Μου μένει μόνο να αποθηκεύω τις χρησιμότητες των παιχτών στην ισορροπία και να κάνω τη γραφική παράσταση.Για οποίαδήποτε διευκρίνιση ρωτήστε με!

Κάθε βοήθεια είναι ευπρόσδεκτη!

Δημοσ.

My code is about power control via game theory.

I want to save players' utilities @ Nash equilibrium.

Ok, the problem is about telecommunications.

Specifically, it is efficient power control via pricing in wireless data networks.

There is a utility function (u=L*R.*f./(M.*pj)-c.*pj)

f is the efficiency function (f=(1-2.*pe).^M)

pe is the Bit Error Rate

and g is the Signal to Interference Ratio

k is a constant equal to 7,75*10^(-3)

M is total number of bits per frame

L is number of information bits per frame

W is spread spectrum bandwidth

R is bit rate

s^2 is noise at the receiver

h=k./(d.^4) is simply the gain of the route

and pmax is the maximum powwer constraint for every player

d=[0.31 0.46 0.57 0.66 0.74 0.81 0.88 0.94 1.00] is the list of distances that players have from the terminal

We try all power levels pj=0.001:0.00001:pmax for every player and compute signal, interference and then utility, trying to find the best response.

We also try all cost levels c=10^3:10^4:10^10^5 for every power level, for every player at every trial to find the best response via pricing, as the previous process does not results to an efficient equilibrium!

The general idea is to find the maximum utilities and save them.All I have to do now is the last part which is saving utilities at equilibrium and make a graph of the results!I know that you might still not have a clear picture, but I just tried to describe you the concept...

Any help is welcome and even a little bit of code that is not correct, just to give me an idea of how to do these things...Thanks in advance!

 

Here is my code:

 

>close all; 
clear all; 


L=64;
R=10^4;
M=80;
W=10^6;
s2=5*10^(-15);
pmax=2;
k=0.097*10^(-3);
pj=0.001:0.00001:pmax;
d=[0.31 0.46 0.57 0.66 0.74 0.81 0.88 0.94 1.00];
h=k./(d.^4);
ind=1;
ind2=1;
p(ind,=ones(1,9);
q=zeros(1,9);
for c=10^3:10^4:10^10^5;
c
while max(abs(p(ind,-q))>10^(-4) 
q=p(ind,
ind=ind+1;
for i=1:9
g=(W/R)*(h(i)*pj)/(sum(h(1:(i-1)).*p(ind-1,1:(i-1)))+sum(h((i+1):end).*p(ind-1,(i+1):end)) + s2);
pe=0.5.*exp(-g./2);
f=(1-2.*pe).^M;
u=L*R.*f./(M.*pj)-c.*pj;
um=max(u);
kk=find(u==um);
p(ind,i)=pj(kk);

end

end
pfin(ind2,=p(ind,;
ind2=ind2+1; 
ind=1;
clear p
p(ind,=ones(1,9);

end

 

---------- Προσθήκη στις 17:05 ---------- Προηγούμενο μήνυμα στις 17:04 ----------

 

Κάνω διπλωματική πάνω στην κατανομή ισχύος σε ασύρματα δίκτυα με εφαρμογή της θεωρίας παιγνίων και είμαι κοντά στην ολοκλήρωση της προσωμοίωσης.Μου μένει μόνο να αποθηκεύω τις χρησιμότητες των παιχτών στην ισορροπία και να κάνω τη γραφική παράσταση.Για οποίαδήποτε διευκρίνιση ρωτήστε με!

Κάθε βοήθεια είναι ευπρόσδεκτη!

Δημοσ.
Κανείς να με βοηθήσει?

 

Ναι.

 

1. Βάλε τον κώδικα σε TAGS, διότι έτσι δε διαβάζεται!

2. Πες μας ποιες μεταβλητές θες να αποθηκεύεις και ποιες να τυπώνεις στο graph

3. Ο κώδικας σου θα μπορούσε να είναι vectorized

Δημοσ.
Ναι.

 

1. Βάλε τον κώδικα σε TAGS, διότι έτσι δε διαβάζεται!

2. Πες μας ποιες μεταβλητές θες να αποθηκεύεις και ποιες να τυπώνεις στο graph

3. Ο κώδικας σου θα μπορούσε να είναι vectorized

 

Αυτό που θέλω να κάνω είναι:

Μια γραφική παράσταση με άξονες το c και το άθροισμα των 9 utilities για κάθε c.

Και μια γραφική με αξονες το d (τις 9 αποστάσεις) και το utility κάθε χρήστη στο cBEST το οποίο είναι κοινό για όλους!

Δηλαδή δε μας ενδιαφέρει η μέγιστη τιμή χρησιμότητας για τον κάθε παίχτη.

Μας ενδιαφέρει μόνο ποιά τιμή του c δίνει το καλύτερο άθροισμα για τις 9 χρησιμότητες και ποιές είναι οι 9 χρησιμότητες για αυτό το c!

Επομένως θέλουμε:

Έναν πίνακα που να αποθηκεύει τα αθροίσματα των 9 χρησιμοτήτων για κάθε c για την πρώτη γραφική (άθροισμα 9 utilities ως προς c).

Μια μεταβλητή που να αποθηκεύει την τιμή του c με το καλύτερο αποτέλεσμα (cBEST), δηλαδή με το μεγαλύτερο άθροισμα των 9 χρησιμοτήτων.

Και έναν πίνακα που να αποθηκεύει τη χρησιμότητα κάθε ενός από τους 9 παίχτες στο cBEST για τη δεύτερη γραφική! (Utility@cBEST ως προς απόσταση d)

Ευχαριστώ εκ των προτέρων!

 

---------- Προσθήκη στις 15:39 ---------- Προηγούμενο μήνυμα στις 15:29 ----------

 

Παραθέτω τον αντίστοιχο κώδικα για το παίγνιο χωρίς τιμολόγηση, με τον οποίο θα συγκρίνουμε το παίγνιο με το οποίο ασχολούμαστε, μήπως βοηθήσει!

>close all; %gia na kleisei oles tis proigoumenes eikones
clear all; %gia na katharisei ti mnimi

%orismos dedomenwn
L=64;
R=10^4;
M=80;
W=10^6;
s2=5*10^(-15);
pmax=2;
k=0.097*10^(-3);
pj=0.001:0.00001:pmax;
d=[0.31 0.46 0.57 0.66 0.74 0.81 0.88 0.94 1.00];
h=k./(d.^4);
ind=1;
p(ind,=ones(1,9);
q=zeros(1,9);
while max(abs(p(ind,-q))>10^(-7)   
   q=p(ind,;
   ind=ind+1;
   for i=1:9
       g=(W/R)*(h(i)*pj)/(sum(h(1:(i-1)).*p(ind-1,1:(i-1)))+sum(h((i+1):end).*p(ind-1,(i+1):end)) + s2);
       pe=0.5.*exp(-g./2);
       f=(1-2.*pe).^M;
       u=L*R.*f./(M.*pj);
       um=max(u);
       kk=find(u==um);
       p(ind,i)=pj(kk);
   end
end

%gia na kanei plot tis isxeis isorropias 
figure;
semilogy(d,p(ind,);

%upologismos tou g
for j=1:9
   g_nash(j)=(W/R)*(h(j)*p(ind,j))/(sum(h(1:(j-1)).*p(ind,1:(j-1)))+sum(h((j+1):end).*p(ind,(j+1):end)) + s2);
end

 

---------- Προσθήκη στις 17:35 ---------- Προηγούμενο μήνυμα στις 15:39 ----------

 

Και μια απόπειρα που έκανα:

>close all; %gia na kleisei oles tis proigoumenes eikones
clear all; %gia na katharisei ti mnimi

%orismos dedomenwn
L=64;
R=10^4;
M=80;
W=10^6;
s2=5*10^(-15);
pmax=2;
k=0.097*10^(-3);
pj=0.01:0.001:pmax;
d=[0.31 0.46 0.57 0.66 0.74 0.81 0.88 0.94 1.00];
nash=[0 0 0 0 0 0 0 0 0 ];
h=k./(d.^4);
ind=1;
ind2=1;
p(ind,=ones(1,9);
q=zeros(1,9);
psummax=0;
cbest=0;
pfin(ind2,=zeros(1,9);
psum(ind2)=0;
for c=10^3:10^4:10^12;
  c;
 while max(abs(p(ind,-q))>10^(-4)   
   q=p(ind,;
   ind=ind+1;
   for i=1:9
       g=(W/R)*(h(i)*pj)/(sum(h(1:(i-1)).*p(ind-1,1:(i-1)))+sum(h((i+1):end).*p(ind-1,(i+1):end)) + s2);
       pe=0.5.*exp(-g./2);
       f=(1-2.*pe).^M;
       u=L*R.*f./(M.*pj)-c.*pj;
       um=max(u);
       kk=find(u==um);
       p(ind,i)=pj(kk);
   end     
 end
 pfin(ind2,=p(ind,;
 psum(ind2)=sum(pfin(ind2,1:9));
 if psum(ind2)>psummax
     psummax=psum(ind2);
     cbest=c;
     nash=pfin(ind2,;
 end
 
ind2=ind2+1; 
ind=1;
clear p
p(ind,=ones(1,9);

end

Αρχειοθετημένο

Αυτό το θέμα έχει αρχειοθετηθεί και είναι κλειστό για περαιτέρω απαντήσεις.

  • Δημιουργία νέου...