This is an old revision of the document!
Define the target, define the model's result from the last iteration and move the leaver by that deviation ratio and try again.
Here's a simple example which is not fully templated but is a good start
creview USDomFDperPerson[com,ts][] view USGDPConDollar[esect,ts][] integer $trackStartYr = 2010 integer $trackEndYr = 2035 integer $lastScnYr getobjinfo (USGDPConDollar[esect,ts][2], $lastScnYr; info=sequenceEnd, dim=time) keep varTarget[tsTrack] say ("Iteration: ", $fbViewIteration) if ($fbViewIteration == 1) string $importEIAData buildstring ($importEIAData, $home, "/primaryData/energyConsumption/EIARefCase") say ("Importing EIA GDP to track on") local EIAUSGDPConDollarTotalx[ts] = changeseq (copyshape (sum (USGDPConDollar[esect,ts][2]; \ dim=econSector)); \ dim=time, start=2008, end=$trackEndYr) EIAUSGDPConDollarTotalx[ts] = import (; dataFormat="odometer", delimiter=",", firstLine=5, lastLine=5, ignoreExtraCols=on, \ rowTitles=on, file=$importEIAData/AEO2011-Industrial_Sector_Macroeconomic_Indicators-AEO2011_Reference_Case.csv) local EIAUSGDPConDollarTotal[ts] = EIAUSGDPConDollarTotalx[ts] * 1e9 varTarget[tsTrack] = extract (EIAUSGDPConDollarTotal[ts]; time:$trackStartYr..$trackEndYr) endif local varLI[tsTrack] = extract (sum (USGDPConDollar[esect,ts][2]; dim=econSector); time:$trackStartYr..$trackEndYr) local devRatio[tsTrack] = varLI[tsTrack] - varTarget[tsTrack] / varTarget[tsTrack] !table (devRatio[tsTrack], varTarget[tsTrack], varLI[tsTrack]; overlay=on) !display (devRatio[tsTrack]) local creVarLI[com,ts] if ($fbViewIteration == 1) creVarLI[com,ts] = USDomFDperPerson[com,ts][2] else creVarLI[com,ts] = USDomFDperPerson[com,ts][3] endif local numNotConv[] = sum (boolgt (abs (devRatio[tsTrack]), $fbViewTolerance); dim=all) integer $numNotConv getobjinfo(numNotConv[], $numNotConv; info=dataElement) if ($numNotConv == 0) or ($fbViewIteration == $fbViewMaxIters) mumble (" numNotConv = ", $numNotConv, " at iteration ",$fbViewIteration, " stopping due to ") if ($numNotConv == 0) say ("convergence") else say ("maximum iterations") endif ! Set the outputs USDomFDperPerson[com,ts][3] = creVarLI[com,ts] quit(0) else say (" numNotConv = ", $numNotConv, " at iteration ",$fbViewIteration, " continuing") endif local multiplier[ts] = extend (min (max (devRatio[tsTrack], -0.5), 0.5) + 1.0; dim=time, end=$lastScnYr) USDomFDperPerson[com,ts][3] = creVarLI[com,ts] * multiplier[ts] quit(1)