From b41ef425e5e9f8ab1e567e38b17f250bf4a75c75 Mon Sep 17 00:00:00 2001 From: couchot Date: Wed, 4 Dec 2013 15:58:49 +0100 Subject: [PATCH] ajout dune image --- IWCMC14/SensorNetwork.png | Bin 0 -> 17107 bytes exp_controle_asynchrone/simulMWSN.py | 80 ++++++++++++++++++++++----- 2 files changed, 66 insertions(+), 14 deletions(-) create mode 100644 IWCMC14/SensorNetwork.png diff --git a/IWCMC14/SensorNetwork.png b/IWCMC14/SensorNetwork.png new file mode 100644 index 0000000000000000000000000000000000000000..14bc26297b7d684b7f546698a27873254665df83 GIT binary patch literal 17107 zcmb814OrA=y8lsEDN@+Y|EzB$l@_}*nh_gdqWJzU3@{8fD(bN4I-xXHipioz={hEs zHuwU{o5GAZ66Tn$r0elap1_y0%T$<#XJ?nw<%uZB6chD)?q{HF`=9Ij|Ic;h1;g)| z=eh6ux$p1&z3=DwwOJoOtzXdKpn!mYelw;|P6`OW=x)7 z$nMc{CUM2%^L`m{=Fl4nxqtug()8&CnXjBIj?f#i0X{OK?S|^x`J=@x{C>}xoP!Lks|_2j3X+`j77z!n%cLPFPXb< zj%)74sjiqfw|UKDSI)m1TWG2&ddp;8Y4NmAJhprBnkct<^kZ&cC+nnSMxJdqSUfA^ zEuPy>O?{OJ;N-zkukBkA;9Uer=D{+j5@6I~1o$FRSAcZ!@d)rQ2ym&~I3m1K2~c$H zfB2kGW*jkUf)Z%-2@!BIUwqAE&1Kz{BH(5u|CwK)zl(r2>q zife9Dp5K7~i_dKjW4BlgeEAIw-p}oO0=uoj1CBg|!NdIq|KEI`g(vR7V=@M?LGfPO zPCPNZh7I`}2E5a?0cH$*4p+KW?l;K4V!&2hT_Xj+e}KpzTyF~2oz`W z$O4h#l5I$S*P+3S=3ZRXHR1dF{S%()nlNjIf5N=(3AdZ9sTR*EzN+SYnmPI0&yZW< zJHsEpk%hYcSnZha^ez6$AMJ(}`nCXUo-Izg3!CZOzH^4w{l3FL8F|TZHN}H`^?wz2 zwVSNS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rI!X_lJr{r1w3x|45DPdZ;Q9mn#RI#-$Oi-LgYtMLaIQE*$xzamD0bc7>}6 za9_Z1s6;C5b0>oP2@2c9BbQJ{FzlQxTX|%I?fPskDX3wo zutwE3lR$`)&Eo#cVjN_F10yxf(yj-}Zdsw^$(lrGs0^gH6M>(>0k=h}Sn6Ym2S}eKDMDLEaAQSW7 zw;X6N|884<3Zt4gBX(7wqbxxa8uG#6XKjD`)|4W`b|=pC8y9yJIk2S|RgYDuXQXSw zIdK>Re#~wd>=h(~hY(LY6eEZ(;qAKylH~i{)6;7QJ>jRj$ua~=Ja5m1a}GLfZr2Pr zAkYJ|Kmn4YdP7eSx?|~vqg?tVZ!br$82lMP`Z9@#u|gk4-oJZmq31VaVZqxugOxMj zmz0a9y$$Zln;_Ew5ep-z5xbbOPKtRvexW+S;Ee6C zyr0saop=}?ivv|uGwg+AT}3oK4frA*bEz9S%>V$f+E{IcjuAuf`s;hC{#8oI;ZvMw z!DjG(1CaZ-4OxtW%2d2htAPr(ShD6|t^$XWpW}I#rlL^gBIE3@xts-Wkc<~q!rOYQ z@q@k$oW1S{nVBmYv*mqwC{{Q}bz`|^Mb?dF3xPWQLBt6=;tR!JYr$U&)NAjaz6DOH>9jYd!~@K zy&vN|Aj}P|TwvA^Wwa;Mdq&sa0BD4oG;nv5oAUDs6P&mScb`3KF*62h^$}w^G@WMg z2*gk?+`*z>0K>9nyY_KfPNQ0GfZz>so9@PW)cFD^Z{X4x>{DVDM#1|45o29gi-g&b zOdZE54rL;re!c(z literal 0 HcmV?d00001 diff --git a/exp_controle_asynchrone/simulMWSN.py b/exp_controle_asynchrone/simulMWSN.py index bf17462..41e82c6 100644 --- a/exp_controle_asynchrone/simulMWSN.py +++ b/exp_controle_asynchrone/simulMWSN.py @@ -7,14 +7,14 @@ from itertools import * from scipy import optimize as opt from copy import deepcopy import sys as sy - - +import cv as cv +import cv2 as cv2 error = 0.1 epsilon = 1E-10 vrate = 0.8 p = 0.7 coteCarre = 50 -distanceEmmissionMax = 30 +distanceEmmissionMax = 20 nbiter = 1000 POS = 1 POS_NUL = 2 @@ -32,6 +32,9 @@ lg = [(0, 1, 22.004323820359151), (0, 2, 28.750632705280324), (0, 3, 29.68069293 #lg= [(0,1,23),(1,0,15),(1,2,45)] sink = n-1 +def distance(d1,d2): + return mt.sqrt(sum([(d1[t]-d2[t])**2 for t in d1])) + def genereGraph(): test = False @@ -46,7 +49,53 @@ def genereGraph(): G.add_edge(io,ie,weight=dist) G.add_edge(ie,io,weight=dist) test = not(any([ not(nx.has_path(G,o,sink)) for o in G.nodes() if sink in G.nodes() and o != sink])) - return G + return (G,l) + + +def afficheGraph(G,l,tx,ty,sink): + r = 20 + img = cv.CreateImage ((tx, ty), 32, 3) + cv.Rectangle(img, (0,0),(tx,ty), cv.Scalar(255,255,255), thickness=-1) + def px((x,y)): + return(int(tx*x/coteCarre),ty-int(ty*y/coteCarre)) + for i in set(range(len(l)))-set([sink]): + (x,y) = l[i] + pix,piy = px((x,y)) + demx = distanceEmmissionMax*tx/coteCarre + cv.Circle(img, (pix,piy),demx, cv.Scalar(125,125,125)) + + for i in set(range(len(l)))-set([sink]): + (x,y) = l[i] + pix,piy = px((x,y)) + cv.Circle(img, (pix,piy),r, cv.Scalar(125,125,125),thickness=-1) + + #sink + (x,y) = l[sink] + pix,piy = px((x,y)) + + cv.Rectangle(img, (pix-r/2,piy-r/2),(pix+r/2,piy+r/2), cv.Scalar(125,125,125), thickness=-1) + + for i in range(len(l)): + for j in range(len(l)): + + if np.linalg.norm(np.array(l[i])-np.array(l[j])) < distanceEmmissionMax : + (xi,yi) = l[i] + pixi,piyi = px((xi,yi)) + (xj,yj) = l[j] + pixj,piyj = px((xj,yj)) + cv.Line(img, (pixi,piyi), (pixj,piyj), cv.Scalar(125,125,125)) + + + """ + for i in range(len(l)): + (x,y) = l[i] + pix,piy = px((x,y)) + print i + textColor = (0, 0, 255) # red + font = cv2.FONT_HERSHEY_SIMPLEX + imgp = + cv2.putText(img, str(i), (pix-r/4,piy-r/2),font, 3.0, textColor)#,thickn """ + cv.SaveImage("SensorNetwork.png",img) G = nx.DiGraph() G.add_weighted_edges_from(lg) @@ -56,6 +105,18 @@ G.add_weighted_edges_from(lg) #nx.draw(G) #pb.show() +(G,l) = genereGraph() +N = G.nodes() +#V = list(set(sample(N,int(len(N)*vrate)))-set([sink])) +V = list(set(N)-set([sink])) +source = V +print "source",source +afficheGraph(G,l,500,500,sink) +#nx.draw(G) +#pb.show() + + + @@ -64,16 +125,9 @@ G.add_weighted_edges_from(lg) #print G.edges(data=True) #TODO afficher le graphe et etre sur qu'il est connexe -N = G.nodes() - -#V = list(set(sample(N,int(len(N)*vrate)))-set([sink])) -V = list(set(N)-set([sink])) -source = V -print "source",source - L = range(len(G.edges())) d = [di['weight'] for (_,_,di) in G.edges(data=True)] @@ -146,8 +200,6 @@ def aminp(l): -def distance(d1,d2): - return mt.sqrt(sum([(d1[t]-d2[t])**2 for t in d1])) def AfficheVariation (up,vp,lap,wp,thetap,etap,qp,Psp,Rhp,xp,valeurFonctionDualep): @@ -311,7 +363,7 @@ def maj(k,maj_theta,mxg,idxexp): def f_Ps(psh,h): #print "ds f_ps",psh, v[h]* mt.log(float(sigma2)/D)/(gamma*((psh**2)**(float(2)/3))) +la[h]*psh return v[h]* mt.log(float(sigma2)/D)/(gamma*mt.pow(float(2)/3)) +la[h]*psh - for h in V: + for h in V: if not ASYNC or random() < taux_succes: """ lah = 0.05 if la[h] == 0 else la[h] -- 2.39.5