public TargetNetwork(double[][,] NewW, int m, int n, int acts, int newH) { h = newH; I = new InpN[(m * n)]; O = new OutN[(m * n * acts)]; H[0] = new Neuron[h]; H[1] = new Neuron[h]; for (int i = 0; i < m * n; i++) { I[i] = new InpN(Rand.NextDouble()); } for (int i = 0; i < m * n * acts; i++) { O[i] = new OutN(Rand.NextDouble()); } for (int i = 0; i < h; i++) { H[0][i] = new Neuron(Rand.NextDouble()); H[1][i] = new Neuron(Rand.NextDouble()); } W = NewW; M = m; N = n; ACTS = acts; }
public NeuralNetwork(int m, int n, int acts, bool[] Rules, bool[,] Allowed, bool[,] Restricted) { // Инициализация нейронов, весов и нейросети цели I = new InpN[(m * n)]; O = new OutN[(m * n * acts)]; H[0] = new Neuron[h]; H[1] = new Neuron[h]; for (int i = 0; i < m * n; i++) { I[i] = new InpN(Rand.NextDouble()); } for (int i = 0; i < m * n * acts; i++) { O[i] = new OutN(Rand.NextDouble()); } for (int i = 0; i < h; i++) { H[0][i] = new Neuron(Rand.NextDouble()); H[1][i] = new Neuron(Rand.NextDouble()); } dW[0] = new double[m * n + 1, h]; dW[1] = new double[h + 1, h]; dW[2] = new double[h + 1, m *n *acts]; W[0] = new double[m * n + 1, h]; W[1] = new double[h + 1, h]; W[2] = new double[h + 1, m *n *acts]; for (int i = 0; i < (m * n) + 1; i++) { for (int j = 0; j < h; j++) { W[0][i, j] = Rand.Next(-10, 10) / 10.0; } } for (int i = 0; i < h + 1; i++) { for (int j = 0; j < h; j++) { W[1][i, j] = Rand.Next(-10, 10) / 10.0; } } for (int i = 0; i < h + 1; i++) { for (int j = 0; j < (m * n * acts); j++) { W[2][i, j] = Rand.Next(-10, 10) / 10.0; } } M = m; N = n; ACTS = acts; TN = new TargetNetwork(W, M, N, ACTS, h); this.Rules = Rules; this.Allowed = Allowed; this.Restricted = Restricted; }