spnIteration {spectrino}R Documentation

Iteration control in blocks

Description

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.

Usage

spnIteration(Initial = 0)

Arguments

Initial

if Initial <> 0 the iteration counter is est 0
-2: only internal count (no progress bar)
-1: normal count including progress bar, when the final count is unknown
0: one iteration (moves the iteration count 1 up)
n: (n>0) the expected number of iterations, with progress bar

Value

spnIteration - Gets back the iteration counter value.

Author(s)

Teodor Krastev

Examples

# 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)

[Package spectrino version 2.0.0 Index]