| spnIteration {spectrino} | R Documentation |
Control iteration count:
- if the expected number of iterations is unknown Initial should be set to -2 or -1 (without or with progress bar)
- if the expected number of iterations is known Initial should be set to that number
after initializing the iteration counter with any Initial<>0, your code should call Iteration() on each iteration (usually at the end)
Apart of the progress bar, the block will react to an iteration depending of how have been set. E.g. Chart will draw next value(s) and/or log will write next status according to the log template.
spnIteration(Initial = 0)
Initial |
if Initial <> 0 the iteration counter is est 0 |
spnIteration - Gets back the iteration counter value.
Teodor Krastev
# Initialization of Spectrino
spnNew()
# generate test group of blocks
spnOpenGroupOfBlocks("<test>")
spnChartBlock("test1",c("objective.0","sug.epsilon"))
# initializing with 20 iteration expected iteration count
spnIteration(20)
for(i in 1:20) {
spnSetProperty("test1", "objective.0", sin(i/2))
spnSetProperty("test1", "sug.epsilon", cos(i/2))
spnIteration(); Sys.sleep(0.1);
}
# Release of Spectrino
spnFree(TRUE)