def __evalue_maj_theta__():
global u, v, la, w, theta , q, Ps, Rh, eta, x, valeurFonctionDuale
- nbexp = 5
+ nbexp = 10
res = {}
m = []
- itermax = 10000
+ itermax = 100000
def __maj_theta(k):
om = omega/(mt.pow(k,0.75))
arret = errorq < error
k+=1
variation = "+" if smax > sm else "-"
- sm = smax
print variation,
if k%100 ==0 :
print "k:",k,"erreur sur q", errorq, "et q:",q
print "init"
print init
exit
+ sm = smax
+
if k == itermax:
print "nbre d'iteration trop grand"
print "init"
+def __une_seule_exp__(fichier_donees):
+ global u, v, la, w, theta , q, Ps, Rh, eta, x, valeurFonctionDuale
+ initialisation()
+
+ fichier = open(fichier_donees, "r")
+ instructions ={}
+ for line in fichier:
+ l = line.split("=")
+ instructions[l[0]] = eval(l[1])
+ u, v, la, w, q, Ps, Rh, eta, x, = instructions['u'], instructions['v'], instructions['la'], instructions['w'], instructions['q'], instructions['Ps'], instructions['Rh'], instructions['eta'], instructions['x']
+ nbexp = 1
+ res = {}
+ m = []
+ itermax = 100000
+
+ def __maj_theta(k):
+ om = omega/(mt.pow(k,0.75))
+ return om
+ for idxexp in range(nbexp):
+ mxg = 0
+ k = 1
+ arret = False
+ sm = 0
+ while k < itermax and not arret :
+ (u,v,la,w,theta,eta,q,Ps,Rh,x,valeurFonctionDuale,ar,mxg,smax)=maj(k,__maj_theta,mxg,idxexp)
+ errorq = (max(q.values()) - min(q.values()))/min(q.values())
+ arret = errorq < error
+ k+=1
+ variation = "+" if smax > sm else "-"
+ print variation,
+ if k%100 ==0 :
+ print "k:",k,"erreur sur q", errorq, "et q:",q
+ print "maxg=", mxg
+ if smax - sm > 500:
+ print "variation trop grande"
+ print "init"
+ print init
+ exit
+ sm = smax
-ASYNC = False
-__evalue_maj_theta__()
-#ASYNC = True
-#taux_succes = 0.9
-#__evalue_maj_theta__()
+ if k == itermax:
+ print "nbre d'iteration trop grand"
+ print "init"
+ print init
+ exit
+ print "###############"
+ print k
+ print "###############"
+ m += [k]
-"""
-initialisation()
-k = 1
-arret = False
-while k < 10000 and not arret :
- (u,v,la,w,theta,eta,q,Ps,Rh,x,valeurFonctionDuale,ar)=maj(k,maj_theta)
- arret = ar
- k+=1
- errorq = abs(min(q.values())-max(q.values()))
- print "errorq",errorq
- arret = errorq < error
-"""
+ print (min(m),max(m),float(sum(m))/nbexp,m),m
-"""
- print "u",u
- print "w",w
- print "theta",theta
- print "eta", eta
- print "q",q
- print "v",v
- print "lambda",la
- print "Ps",Ps
- print "Rh",Rh
- print "x",x
-"""
-"""
- k +=1
-"""
+ASYNC = False
+__une_seule_exp__("config_initiale.py")
+#__evalue_maj_theta__()
+#ASYNC = True
+#taux_succes = 0.9
+#__evalue_maj_theta__()
+
+