int main3() { MersenneTwister x; for (int j=0; j<1000; j++) { printf("%10u ", x.random()); if (j%8==7) printf("\n"); } return 0; }
void Route::fillweights(void) { int i = 0, j = 0; for (i = 0; i < places; ++i) { for (j = 0; j < places; ++j) { if (i == j) { weights[i][j] = 100 * places; } else{ weights[i][j] = mt.random() * places; } } } }
bool Route::moveTo(double E, double newE, int T) { double P = 0; //double k = 0.1; // Needs to be some function of places number (DOES NOTHING) P = exp((E - newE)/(double)T); if (newE < E){ return true; } else if (P > mt.random()){ return true; } else{ return false; } }
int main(int argc, char const *argv[]) { MersenneTwister mt; ANN net(3, 0.1); vector<double> inputs; for (int i = 0; i < 10; ++i){ vector<double> inputs; double i1 = boolize(1); double i2 = boolize(mt.random()); double i3 = boolize(mt.random()); double d = (i1 && i2 && i3) ? 0 : 1; inputs.push_back(i1); inputs.push_back(i2); inputs.push_back(i3); net.setInputs(inputs, d); // cout << net.getOutput() << endl; net.adjustWeights(); } inputs.push_back(1); inputs.push_back(1); inputs.push_back(1); net.setInputs(inputs, 0); cout << net.getOutput() << endl; return 0; }