资源简介

Neural Network for Model Predictive Control

资源截图

代码片段和文件信息

import numpy as np

class data_construct:
data=[]
length=0
count=0
num_example=0;
def __init__(self length data):
self.data=data
self.length=length
self.num_example=len(data)
self.count=0

def clr_count(self):
self.count=0

def next_batch(selfbatch_xbatch_ybatch_size):
temp_data=self.data[self.count*batch_size
:self.count*batch_size+batch_size+self.length-2+1]
#print temp_data
for i in range(batch_size):
for j in range(self.length):
batch_x+=(temp_data[i+j][0:20].tolist())
batch_y.append(temp_data[i+self.length-1][20].tolist())
self.count+=1#count+=length
batch_x=np.reshape(batch_x(batch_size2*self.length))
batch_y=np.reshape(batch_y(batch_size1))
#print batch_y
#in case list go out of range
if self.count*batch_size+batch_size+self.length-2>=len(self.data):
self.count=0
return batch_x batch_y

def plot_data(selfxysim_len):
for i in range(sim_len):
x+=self.data[self.length+i-1][0:20].tolist()
y.append(self.data[i+self.length-1][20].tolist())
x=np.reshape(x(sim_len2))
y=np.reshape(y(sim_len1))
return xy

#class property
@property
def data(self):
return self.data

@property
def count(self):
return self.count

@property
def num_example(self):
return self.num_example

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2017-04-24 18:38  NN_MPC-master\
     文件        1045  2017-04-24 18:38  NN_MPC-master\.gitignore
     文件          53  2017-04-24 18:38  NN_MPC-master\README.md
     目录           0  2017-04-24 18:38  NN_MPC-master\Simulation\
     文件        4238  2017-04-24 18:38  NN_MPC-master\Simulation\NN.py
     文件        1282  2017-04-24 18:38  NN_MPC-master\Simulation\data_construct.py
     文件        1669  2017-04-24 18:38  NN_MPC-master\Simulation\data_gen.py

评论

共有 条评论