Beispiel #1
0
import numpy as np
import tensorflow as tf
import math
import cPickle
import graph
import RLAgent
import httpConec as hC
import matplotlib.pyplot as plt
import geneTopo

topo, hosts, nodes, links = geneTopo.getDCtopo()
ag = RLAgent.PGNAgent(links, nodes * 2 + 1)
atest = graph.graf(nodes, links, initopo=topo, inihost=hosts)
atest.initial()
#atest.printTopo()
batch_size = 16
batch_number = 0
total_episodes = 640
episode_number = 0
valid_action = 0
invalid_action = 0
xs, ys, rs = [], [], []

epslon = 0.9
plt_x = range(total_episodes / batch_size)
plt_y = []
r_batch = []

valid_action_combo = 0
gradBuffer = ag.sess.run(ag.tvars)
Beispiel #2
0
import numpy as np
import tensorflow as tf
import config
import csv
import graph
import RLAgent
import httpConec2 as hC
import matplotlib.pyplot as plt
from matplotlib.pyplot import draw

topo,hosts,nodes,hostnum,links=config.topo
print "host num:",hostnum
print "nodes num:",nodes
ag=RLAgent.PGNAgent(links,(nodes-hostnum)*2+1)
atest=graph.graf(nodes,links,initopo=topo,inihost=hosts)
atest.initial()
atest.printTopo() 
stepnum=2000
batch_size=config.batchsize
batch_sum=0   
episode_number=0
valid_action=0
total_episodes=config.episodes
xs,ys,rs=[],[],[]
epslon=config.explore_rate
plt_ANPB=[]
plt_ENPB=[]
plt_RNPB=[]
plt_rb=[]
overlink_record=[]
rsp=hC.sendTopo(atest.E,atest.host)