Download User`s Guide for SNOPT Version 7.4 - CCoM
Transcript
30 SNOPT 7.4 User’s Guide after the storage limits are known. Here we illustrate the use of snMemA using the same arrays for snMemA and snOptA. Note that the snMemA arrays are used to store the optional parameters, and so any temporary arrays must be copied into the final cw, iw, rw arrays in order to retain the options. The work arrays must have length at least 500, so we define ltmpcw = 500 ltmpiw = 500 ltmprw = 500 As with all SNOPT routines, snInit must be called to set default options: call snInit & ( iPrint, iSumm, cw, ltmpcw, iw, ltmpiw, rw, ltmprw ) This installs ltmpcw, ltmpiw, ltmprw as the default internal upper limits on the snOptA workspace (see Total real workspace p. 84). They are used to compute the boundaries of any user-defined workspace in cw, iw, or rw. The next step is to call snMemA to obtain mincw, miniw, minrw as estimates of the storage needed by snOptA: call & ( & & snMemA INFO, nF, n, nxname, nFname, neA, neG, mincw, miniw, minrw, cw, ltmpcw, iw, ltmpiw, rw, ltmprw ) The output values of mincw, miniw, minrw may now be used to define the lengths of the snOptA work arrays: lencw = mincw leniw = miniw lenrw = minrw These values may be used in f90 or C to allocate the final work arrays for the problem. One last step is needed before snOptA is called. The current upper limits ltmpcw, ltmpiw, ltmprw must be replaced by the estimates mincw, miniw, minrw. This can be done using the option setting routine snSeti as follows: Errors = 0 ! Counts the number of errors iPrt = 0 ! Suppress print output iSum = 0 ! Suppress summary output call snSeti & ( ’Total character workspace’, lencw, iPrt, iSum, Errors, & cw, ltmpcw, iw, ltmpiw, rw, ltmprw ) call snSeti & ( ’Total integer workspace’, leniw, iPrt, iSum, Errors, & cw, ltmpcw, iw, ltmpiw, rw, ltmprw ) call snSeti & ( ’Total real workspace’, lenrw, iPrt, iSum, Errors, & cw, ltmpcw, iw, ltmpiw, rw, ltmprw ) An alternative way is to call snInit again with arguments lencw, leniw, lenrw: call snInit & ( iPrint, iSumm, cw, lencw, iw, leniw, rw, lenrw ) However, this has the twin effects of resetting all options to their default values and reprinting the SNOPT banner (unless iPrint = 0 and iSumm = 0 are set for the Print and Summary files).