コード例 #1
0
ファイル: main.cpp プロジェクト: sub77/hobbycode
int main(int argc, char **argv)
{
	std::cout << "===============================================================" << std::endl;
	std::cout << "Verve leaky_neuron test" << std::endl;
	std::cout << "This will test the input/output response of a neuron " << std::endl;
	std::cout << "using various input signal patterns." << std::endl;
	std::cout << "Output data will be saved to files in the current directory." << std::endl;
	std::cout << "===============================================================" << std::endl;

	// create neurons and a connection between them; we will test
	// one neuron and use the other simply as a sensor neuron
	gSensorNeuron = new verve::Neuron(0, verve::NEURON_TYPE_INPUT, gNeuronTimeConstant, 0);
	gOutputNeuron = new verve::Neuron(1, verve::NEURON_TYPE_OUTPUT, gNeuronTimeConstant, 0);
	gConnection = new verve::Connection(gSensorNeuron, gOutputNeuron, 1);
	verve::real eTraceDecayFactor = 
		1 - verve::globals::calcDecayConstant(verve::defaults::ETraceDecayPercent, 
		verve::defaults::ETraceDecayTime, gDT);
	gConnection->setETraceDecayFactor(eTraceDecayFactor);
	gOutputNeuron->addDendrite(gConnection);

	// run the tests
	testSineWave();
	resetDynamics();

	testSawtoothWave();
	resetDynamics();

	testSquareWave();
	resetDynamics();

	testSpikeTrain();
	resetDynamics();

	gSensorNeuron->destroy();
	gOutputNeuron->destroy();
	gConnection->destroy();
	return 0;
}
 void DynamicalSystemSimulator::resetSimulator()
 {
     resetDynamics();
     f_=0x0;
 }