override public void Init(NeuralNetwork p_network = null) { NeuralNetwork network = null; Optimizer optimizer = null; if (p_network == null) { network = new NeuralNetwork(); network.AddLayer("input", new InputLayer(GetParam(STATE_DIM)), BaseLayer.TYPE.INPUT); network.AddLayer("hidden0", new CoreLayer(SolverConfig.GetInstance().hidden_layer, ACTIVATION.RELU, BaseLayer.TYPE.HIDDEN), BaseLayer.TYPE.HIDDEN); network.AddLayer("output", new CoreLayer(GetParam(ACTION_DIM), ACTIVATION.TANH, BaseLayer.TYPE.OUTPUT), BaseLayer.TYPE.OUTPUT); // feed-forward connections network.AddConnection("input", "hidden0", Connection.INIT.GLOROT_UNIFORM); network.AddConnection("hidden0", "output", Connection.INIT.GLOROT_UNIFORM); } else { network = p_network; } optimizer = new ADAM(network); //optimizer = new RMSProp(network); //optimizer = new BackProp(network, 1e-5f, 0.99f, true); _critic = new DeepQLearning(optimizer, network, 0.99f, SolverConfig.GetInstance().memory_size, SolverConfig.GetInstance().batch_size, SolverConfig.GetInstance().qtupdate_size); _critic.SetAlpha(SolverConfig.GetInstance().learning_rate); }
public Clock(ADAM adma) { _adam = adma; _timer = new DispatcherTimer(); _timer.Interval = TimeSpan.FromSeconds(1); _timer.Tick += _timer_Tick; }
/// <summary> /// 打开串口的事件方法,也是启动所有功能的方法 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ButtonClick_OpenSerial(object sender, RoutedEventArgs e) { _adam = new ADAM( comBoBox_SerialNames.Text, //串口 Convert.ToInt32(comBoBox_SerialPort)); //波特率 _adam.Open(); //启动 _data = new BackData(_adam); //后台注册 }
/// <summary> /// 用空控件间传递控制数据 /// </summary> /// <param name="adam"></param> public BackData(ADAM adam) { Adam = adam; Timer = new Clock(adam); }