SPEX CONVERGENCE Marc Courtois Dec 1, 97 Spex convergence allows an lqns input variable to be specified as some expression of one or more lqns output (and input) variables. If the convergence feature is used, Spex will calculate the value for the input convergence variable after the model is solved and will re-solve the model using this new value. Spex will continue to re-solve the model until the value for the input convergence variable converges or until the number of iterations exceeds a specified limit. A convergence report for each Spex case is written to the file $casename.conv RELEVANT VARIABLES: ******************* The default values for each variable are shown. The user is free to provide different values $convergence_limit = 0.00001 ---------------------------- - If the percentage change between the previous and current value of the input convergence variable is less than $convergence_limit , then the model is considered to have converged and Spex will stop re-solving it. -The stopping rule is: STOP if abs(($cur - $prev) / $prev) < $convergence_limit $convergence_iters = 50 ----------------------- - Specifies the maximum number of times a model will be resolved. If the model does not converge after $convergence_iters iterations, Spex will print a warning in the convergence report that the model could not converge $convergence_under_relax = 1 ---------------------------- - Under relaxation is used to encourage convergence. Sometimes the value of a convergence variable may fluctuate between two values indefinitely. Under relaxation increasingly softens this fluctuation. - Suppose the previous value for the input convergence variable is $prev and suppose the newly calculate value is $cur. Instead of using $cur as the new value, Spex will re-solve the model using the value of $relaxed, where $relaxed is defined as: $a = $convergence_under_relax; $relaxed = (($a * $cur) + ((1 - $a) * $prev)); The $relaxed value lies somewhere in between the previous and current values. The greater the under relaxation, the closer the new value will be to the previous value. $convergence_under_relax can take on a value in the range (0,1]. SYNTAX: ******* The convergence section follows the results section and takes on almost identical syntax. C 0 $some_input_variable = $some_output_variable1 * $another_variable2 -1 The '0' following the 'C' is required for the same reason that a '0' is required after the 'R' in the results section. Don't ask me what that reason is. EXAMPLE: ******** Take a look at the code in /home/artt/spexdistr/csmacd.xlqn