Calculations are processed within few draw() refreshes.

edited March 2017 in Questions about Code

I'm a C++ programmer, therefore I'm afraid to have a lack of knowledge about how java works in the inside. I think that if I write some consequent expressions, these should be processed in sequence.

The issue I'm having is the following:

NeuralNetwork n;
void setup()
{
 n = new NeuralNetwork(/*...*/);
}

void draw()
{
 background(0);
 n.Propagate();
 n.Draw();
}

-The Neural Network is a class I just wrote.

-The Propagate() function propagates forward the input values and calculates all the neurons' value.

-The Draw() function plots the network on the canvas aswell as numerical values and weights.

Here comes the problem: If I Propagate() in the setup() function, all works fine. Else if I Propagate() in the draw() function (as shown above), values seems to update within several draw() refreshes. What is happening? Every number is shown, but the last decimal digits vary for about 1sec before converging.

Is the frameRate() forcing the graphic update before the complete calculation is finished? EDIT: setting frameRate(1) doesn't help. Numbers still suffer consecutive variations.

Thanks for any help.

Giro

Answers

Sign In or Register to comment.