dsplp.f 71 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683
  1. *DECK DSPLP
  2. SUBROUTINE DSPLP (DUSRMT, MRELAS, NVARS, COSTS, PRGOPT, DATTRV,
  3. + BL, BU, IND, INFO, PRIMAL, DUALS, IBASIS, WORK, LW, IWORK, LIW)
  4. C***BEGIN PROLOGUE DSPLP
  5. C***PURPOSE Solve linear programming problems involving at
  6. C most a few thousand constraints and variables.
  7. C Takes advantage of sparsity in the constraint matrix.
  8. C***LIBRARY SLATEC
  9. C***CATEGORY G2A2
  10. C***TYPE DOUBLE PRECISION (SPLP-S, DSPLP-D)
  11. C***KEYWORDS LINEAR CONSTRAINTS, LINEAR OPTIMIZATION,
  12. C LINEAR PROGRAMMING, LP, SPARSE CONSTRAINTS
  13. C***AUTHOR Hanson, R. J., (SNLA)
  14. C Hiebert, K. L., (SNLA)
  15. C***DESCRIPTION
  16. C
  17. C These are the short usage instructions; for details about
  18. C other features, options and methods for defining the matrix
  19. C A, see the extended usage instructions which are contained in
  20. C the Long Description section below.
  21. C
  22. C |------------|
  23. C |Introduction|
  24. C |------------|
  25. C The subprogram DSPLP( ) solves a linear optimization problem.
  26. C The problem statement is as follows
  27. C
  28. C minimize (transpose of costs)*x
  29. C subject to A*x=w.
  30. C
  31. C The entries of the unknowns x and w may have simple lower or
  32. C upper bounds (or both), or be free to take on any value. By
  33. C setting the bounds for x and w, the user is imposing the con-
  34. C straints of the problem. The matrix A has MRELAS rows and
  35. C NVARS columns. The vectors costs, x, and w respectively
  36. C have NVARS, NVARS, and MRELAS number of entries.
  37. C
  38. C The input for the problem includes the problem dimensions,
  39. C MRELAS and NVARS, the array COSTS(*), data for the matrix
  40. C A, and the bound information for the unknowns x and w, BL(*),
  41. C BU(*), and IND(*). Only the nonzero entries of the matrix A
  42. C are passed to DSPLP( ).
  43. C
  44. C The output from the problem (when output flag INFO=1) includes
  45. C optimal values for x and w in PRIMAL(*), optimal values for
  46. C dual variables of the equations A*x=w and the simple bounds
  47. C on x in DUALS(*), and the indices of the basic columns,
  48. C IBASIS(*).
  49. C
  50. C |------------------------------|
  51. C |Fortran Declarations Required:|
  52. C |------------------------------|
  53. C
  54. C DIMENSION COSTS(NVARS),PRGOPT(*),DATTRV(*),
  55. C *BL(NVARS+MRELAS),BU(NVARS+MRELAS),IND(NVARS+MRELAS),
  56. C *PRIMAL(NVARS+MRELAS),DUALS(MRELAS+NVARS),IBASIS(NVARS+MRELAS),
  57. C *WORK(LW),IWORK(LIW)
  58. C
  59. C EXTERNAL DUSRMT
  60. C
  61. C The dimensions of PRGOPT(*) and DATTRV(*) must be at least 1.
  62. C The exact lengths will be determined by user-required options and
  63. C data transferred to the subprogram DUSRMT( ).
  64. C
  65. C The values of LW and LIW, the lengths of the arrays WORK(*)
  66. C and IWORK(*), must satisfy the inequalities
  67. C
  68. C LW .GE. 4*NVARS+ 8*MRELAS+LAMAT+ LBM
  69. C LIW.GE. NVARS+11*MRELAS+LAMAT+2*LBM
  70. C
  71. C It is an error if they do not both satisfy these inequalities.
  72. C (The subprogram will inform the user of the required lengths
  73. C if either LW or LIW is wrong.) The values of LAMAT and LBM
  74. C nominally are
  75. C
  76. C LAMAT=4*NVARS+7
  77. C and LBM =8*MRELAS
  78. C
  79. C LAMAT determines the length of the sparse matrix storage area.
  80. C The value of LBM determines the amount of storage available
  81. C to decompose and update the active basis matrix.
  82. C
  83. C |------|
  84. C |Input:|
  85. C |------|
  86. C
  87. C MRELAS,NVARS
  88. C ------------
  89. C These parameters are respectively the number of constraints (the
  90. C linear relations A*x=w that the unknowns x and w are to satisfy)
  91. C and the number of entries in the vector x. Both must be .GE. 1.
  92. C Other values are errors.
  93. C
  94. C COSTS(*)
  95. C --------
  96. C The NVARS entries of this array are the coefficients of the
  97. C linear objective function. The value COSTS(J) is the
  98. C multiplier for variable J of the unknown vector x. Each
  99. C entry of this array must be defined.
  100. C
  101. C DUSRMT
  102. C ------
  103. C This is the name of a specific subprogram in the DSPLP( ) package
  104. C used to define the matrix A. In this usage mode of DSPLP( )
  105. C the user places the nonzero entries of A in the
  106. C array DATTRV(*) as given in the description of that parameter.
  107. C The name DUSRMT must appear in a Fortran EXTERNAL statement.
  108. C
  109. C DATTRV(*)
  110. C ---------
  111. C The array DATTRV(*) contains data for the matrix A as follows:
  112. C Each column (numbered J) requires (floating point) data con-
  113. C sisting of the value (-J) followed by pairs of values. Each pair
  114. C consists of the row index immediately followed by the value
  115. C of the matrix at that entry. A value of J=0 signals that there
  116. C are no more columns. The required length of
  117. C DATTRV(*) is 2*no. of nonzeros + NVARS + 1.
  118. C
  119. C BL(*),BU(*),IND(*)
  120. C ------------------
  121. C The values of IND(*) are input parameters that define
  122. C the form of the bounds for the unknowns x and w. The values for
  123. C the bounds are found in the arrays BL(*) and BU(*) as follows.
  124. C
  125. C For values of J between 1 and NVARS,
  126. C if IND(J)=1, then X(J) .GE. BL(J); BU(J) is not used.
  127. C if IND(J)=2, then X(J) .LE. BU(J); BL(J) is not used.
  128. C if IND(J)=3, then BL(J) .LE. X(J) .LE. BU(J),(BL(J)=BU(J) ok)
  129. C if IND(J)=4, then X(J) is free to have any value,
  130. C and BL(J), BU(J) are not used.
  131. C
  132. C For values of I between NVARS+1 and NVARS+MRELAS,
  133. C if IND(I)=1, then W(I-NVARS) .GE. BL(I); BU(I) is not used.
  134. C if IND(I)=2, then W(I-NVARS) .LE. BU(I); BL(I) is not used.
  135. C if IND(I)=3, then BL(I) .LE. W(I-NVARS) .LE. BU(I),
  136. C (BL(I)=BU(I) is ok).
  137. C if IND(I)=4, then W(I-NVARS) is free to have any value,
  138. C and BL(I), BU(I) are not used.
  139. C
  140. C A value of IND(*) not equal to 1,2,3 or 4 is an error. When
  141. C IND(I)=3, BL(I) must be .LE. BU(I). The condition BL(I).GT.
  142. C BU(I) indicates infeasibility and is an error.
  143. C
  144. C PRGOPT(*)
  145. C ---------
  146. C This array is used to redefine various parameters within DSPLP( ).
  147. C Frequently, perhaps most of the time, a user will be satisfied
  148. C and obtain the solutions with no changes to any of these
  149. C parameters. To try this, simply set PRGOPT(1)=1.D0.
  150. C
  151. C For users with more sophisticated needs, DSPLP( ) provides several
  152. C options that may be used to take advantage of more detailed
  153. C knowledge of the problem or satisfy other utilitarian needs.
  154. C The complete description of how to use this option array to
  155. C utilize additional subprogram features is found under the
  156. C heading of DSPLP( ) Subprogram Options in the Extended
  157. C Usage Instructions.
  158. C
  159. C Briefly, the user should note the following value of the parameter
  160. C KEY and the corresponding task or feature desired before turning
  161. C to that document.
  162. C
  163. C Value Brief Statement of Purpose for Option
  164. C of KEY
  165. C ------ -------------------------------------
  166. C 50 Change from a minimization problem to a
  167. C maximization problem.
  168. C 51 Change the amount of printed output.
  169. C Normally, no printed output is obtained.
  170. C 52 Redefine the line length and precision used
  171. C for the printed output.
  172. C 53 Redefine the values of LAMAT and LBM that
  173. C were discussed above under the heading
  174. C Fortran Declarations Required.
  175. C 54 Redefine the unit number where pages of the sparse
  176. C data matrix A are stored. Normally, the unit
  177. C number is 1.
  178. C 55 A computation, partially completed, is
  179. C being continued. Read the up-to-date
  180. C partial results from unit number 2.
  181. C 56 Redefine the unit number where the partial results
  182. C are stored. Normally, the unit number is 2.
  183. C 57 Save partial results on unit 2 either after
  184. C maximum iterations or at the optimum.
  185. C 58 Redefine the value for the maximum number of
  186. C iterations. Normally, the maximum number of
  187. C iterations is 3*(NVARS+MRELAS).
  188. C 59 Provide DSPLP( ) with a starting (feasible)
  189. C nonsingular basis. Normally, DSPLP( ) starts
  190. C with the identity matrix columns corresponding
  191. C to the vector w.
  192. C 60 The user has provided scale factors for the
  193. C columns of A. Normally, DSPLP( ) computes scale
  194. C factors that are the reciprocals of the max. norm
  195. C of each column.
  196. C 61 The user has provided a scale factor
  197. C for the vector costs. Normally, DSPLP( ) computes
  198. C a scale factor equal to the reciprocal of the
  199. C max. norm of the vector costs after the column
  200. C scaling for the data matrix has been applied.
  201. C 62 Size parameters, namely the smallest and
  202. C largest magnitudes of nonzero entries in
  203. C the matrix A, are provided. Values noted
  204. C outside this range are to be considered errors.
  205. C 63 Redefine the tolerance required in
  206. C evaluating residuals for feasibility.
  207. C Normally, this value is set to RELPR,
  208. C where RELPR = relative precision of the arithmetic.
  209. C 64 Change the criterion for bringing new variables
  210. C into the basis from the steepest edge (best
  211. C local move) to the minimum reduced cost.
  212. C 65 Redefine the value for the number of iterations
  213. C between recalculating the error in the primal
  214. C solution. Normally, this value is equal to ten.
  215. C 66 Perform "partial pricing" on variable selection.
  216. C Redefine the value for the number of negative
  217. C reduced costs to compute (at most) when finding
  218. C a variable to enter the basis. Normally this
  219. C value is set to NVARS. This implies that no
  220. C "partial pricing" is used.
  221. C 67 Adjust the tuning factor (normally one) to apply
  222. C to the primal and dual error estimates.
  223. C 68 Pass information to the subprogram DFULMT(),
  224. C provided with the DSPLP() package, so that a Fortran
  225. C two-dimensional array can be used as the argument
  226. C DATTRV(*).
  227. C 69 Pass an absolute tolerance to use for the feasibility
  228. C test when the usual relative error test indicates
  229. C infeasibility. The nominal value of this tolerance,
  230. C TOLABS, is zero.
  231. C
  232. C
  233. C |---------------|
  234. C |Working Arrays:|
  235. C |---------------|
  236. C
  237. C WORK(*),LW,
  238. C IWORK(*),LIW
  239. C ------------
  240. C The arrays WORK(*) and IWORK(*) are respectively floating point
  241. C and type INTEGER working arrays for DSPLP( ) and its
  242. C subprograms. The lengths of these arrays are respectively
  243. C LW and LIW. These parameters must satisfy the inequalities
  244. C noted above under the heading "Fortran Declarations Required:"
  245. C It is an error if either value is too small.
  246. C
  247. C |----------------------------|
  248. C |Input/Output files required:|
  249. C |----------------------------|
  250. C
  251. C Fortran unit 1 is used by DSPLP( ) to store the sparse matrix A
  252. C out of high-speed memory. A crude
  253. C upper bound for the amount of information written on unit 1
  254. C is 6*nz, where nz is the number of nonzero entries in A.
  255. C
  256. C |-------|
  257. C |Output:|
  258. C |-------|
  259. C
  260. C INFO,PRIMAL(*),DUALS(*)
  261. C -----------------------
  262. C The integer flag INFO indicates why DSPLP( ) has returned to the
  263. C user. If INFO=1 the solution has been computed. In this case
  264. C X(J)=PRIMAL(J) and W(I)=PRIMAL(I+NVARS). The dual variables
  265. C for the equations A*x=w are in the array DUALS(I)=dual for
  266. C equation number I. The dual value for the component X(J) that
  267. C has an upper or lower bound (or both) is returned in
  268. C DUALS(J+MRELAS). The only other values for INFO are .LT. 0.
  269. C The meaning of these values can be found by reading
  270. C the diagnostic message in the output file, or by looking for
  271. C error number = (-INFO) in the Extended Usage Instructions
  272. C under the heading:
  273. C
  274. C List of DSPLP( ) Error and Diagnostic Messages.
  275. C
  276. C BL(*),BU(*),IND(*)
  277. C ------------------
  278. C These arrays are output parameters only under the (unusual)
  279. C circumstances where the stated problem is infeasible, has an
  280. C unbounded optimum value, or both. These respective conditions
  281. C correspond to INFO=-1,-2 or -3. See the Extended
  282. C Usage Instructions for further details.
  283. C
  284. C IBASIS(I),I=1,...,MRELAS
  285. C ------------------------
  286. C This array contains the indices of the variables that are
  287. C in the active basis set at the solution (INFO=1). A value
  288. C of IBASIS(I) between 1 and NVARS corresponds to the variable
  289. C X(IBASIS(I)). A value of IBASIS(I) between NVARS+1 and NVARS+
  290. C MRELAS corresponds to the variable W(IBASIS(I)-NVARS).
  291. C
  292. C *Long Description:
  293. C
  294. C SUBROUTINE DSPLP(DUSRMT,MRELAS,NVARS,COSTS,PRGOPT,DATTRV,
  295. C * BL,BU,IND,INFO,PRIMAL,DUALS,IBASIS,WORK,LW,IWORK,LIW)
  296. C
  297. C |------------|
  298. C |Introduction|
  299. C |------------|
  300. C The subprogram DSPLP( ) solves a linear optimization problem.
  301. C The problem statement is as follows
  302. C
  303. C minimize (transpose of costs)*x
  304. C subject to A*x=w.
  305. C
  306. C The entries of the unknowns x and w may have simple lower or
  307. C upper bounds (or both), or be free to take on any value. By
  308. C setting the bounds for x and w, the user is imposing the con-
  309. C straints of the problem.
  310. C
  311. C (The problem may also be stated as a maximization
  312. C problem. This is done by means of input in the option array
  313. C PRGOPT(*).) The matrix A has MRELAS rows and NVARS columns. The
  314. C vectors costs, x, and w respectively have NVARS, NVARS, and
  315. C MRELAS number of entries.
  316. C
  317. C The input for the problem includes the problem dimensions,
  318. C MRELAS and NVARS, the array COSTS(*), data for the matrix
  319. C A, and the bound information for the unknowns x and w, BL(*),
  320. C BU(*), and IND(*).
  321. C
  322. C The output from the problem (when output flag INFO=1) includes
  323. C optimal values for x and w in PRIMAL(*), optimal values for
  324. C dual variables of the equations A*x=w and the simple bounds
  325. C on x in DUALS(*), and the indices of the basic columns in
  326. C IBASIS(*).
  327. C
  328. C |------------------------------|
  329. C |Fortran Declarations Required:|
  330. C |------------------------------|
  331. C
  332. C DIMENSION COSTS(NVARS),PRGOPT(*),DATTRV(*),
  333. C *BL(NVARS+MRELAS),BU(NVARS+MRELAS),IND(NVARS+MRELAS),
  334. C *PRIMAL(NVARS+MRELAS),DUALS(MRELAS+NVARS),IBASIS(NVARS+MRELAS),
  335. C *WORK(LW),IWORK(LIW)
  336. C
  337. C EXTERNAL DUSRMT (or 'NAME', if user provides the subprogram)
  338. C
  339. C The dimensions of PRGOPT(*) and DATTRV(*) must be at least 1.
  340. C The exact lengths will be determined by user-required options and
  341. C data transferred to the subprogram DUSRMT( ) ( or 'NAME').
  342. C
  343. C The values of LW and LIW, the lengths of the arrays WORK(*)
  344. C and IWORK(*), must satisfy the inequalities
  345. C
  346. C LW .GE. 4*NVARS+ 8*MRELAS+LAMAT+ LBM
  347. C LIW.GE. NVARS+11*MRELAS+LAMAT+2*LBM
  348. C
  349. C It is an error if they do not both satisfy these inequalities.
  350. C (The subprogram will inform the user of the required lengths
  351. C if either LW or LIW is wrong.) The values of LAMAT and LBM
  352. C nominally are
  353. C
  354. C LAMAT=4*NVARS+7
  355. C and LBM =8*MRELAS
  356. C
  357. C These values will be as shown unless the user changes them by
  358. C means of input in the option array PRGOPT(*). The value of LAMAT
  359. C determines the length of the sparse matrix "staging" area.
  360. C For reasons of efficiency the user may want to increase the value
  361. C of LAMAT. The value of LBM determines the amount of storage
  362. C available to decompose and update the active basis matrix.
  363. C Due to exhausting the working space because of fill-in,
  364. C it may be necessary for the user to increase the value of LBM.
  365. C (If this situation occurs an informative diagnostic is printed
  366. C and a value of INFO=-28 is obtained as an output parameter.)
  367. C
  368. C |------|
  369. C |Input:|
  370. C |------|
  371. C
  372. C MRELAS,NVARS
  373. C ------------
  374. C These parameters are respectively the number of constraints (the
  375. C linear relations A*x=w that the unknowns x and w are to satisfy)
  376. C and the number of entries in the vector x. Both must be .GE. 1.
  377. C Other values are errors.
  378. C
  379. C COSTS(*)
  380. C --------
  381. C The NVARS entries of this array are the coefficients of the
  382. C linear objective function. The value COSTS(J) is the
  383. C multiplier for variable J of the unknown vector x. Each
  384. C entry of this array must be defined. This array can be changed
  385. C by the user between restarts. See options with KEY=55,57 for
  386. C details of checkpointing and restarting.
  387. C
  388. C DUSRMT
  389. C ------
  390. C This is the name of a specific subprogram in the DSPLP( ) package
  391. C that is used to define the matrix entries when this data is passed
  392. C to DSPLP( ) as a linear array. In this usage mode of DSPLP( )
  393. C the user gives information about the nonzero entries of A
  394. C in DATTRV(*) as given under the description of that parameter.
  395. C The name DUSRMT must appear in a Fortran EXTERNAL statement.
  396. C Users who are passing the matrix data with DUSRMT( ) can skip
  397. C directly to the description of the input parameter DATTRV(*).
  398. C Also see option 68 for passing the constraint matrix data using
  399. C a standard Fortran two-dimensional array.
  400. C
  401. C If the user chooses to provide a subprogram 'NAME'( ) to
  402. C define the matrix A, then DATTRV(*) may be used to pass floating
  403. C point data from the user's program unit to the subprogram
  404. C 'NAME'( ). The content of DATTRV(*) is not changed in any way.
  405. C
  406. C The subprogram 'NAME'( ) can be of the user's choice
  407. C but it must meet Fortran standards and it must appear in a
  408. C Fortran EXTERNAL statement. The first statement of the subprogram
  409. C has the form
  410. C
  411. C SUBROUTINE 'NAME'(I,J,AIJ, INDCAT, PRGOPT, DATTRV, IFLAG)
  412. C
  413. C The variables I,J, INDCAT, IFLAG(10) are type INTEGER,
  414. C while AIJ, PRGOPT(*),DATTRV(*) are type REAL.
  415. C
  416. C The user interacts with the contents of IFLAG(*) to
  417. C direct the appropriate action. The algorithmic steps are
  418. C as follows.
  419. C
  420. C Test IFLAG(1).
  421. C
  422. C IF(IFLAG(1).EQ.1) THEN
  423. C
  424. C Initialize the necessary pointers and data
  425. C for defining the matrix A. The contents
  426. C of IFLAG(K), K=2,...,10, may be used for
  427. C storage of the pointers. This array remains intact
  428. C between calls to 'NAME'( ) by DSPLP( ).
  429. C RETURN
  430. C
  431. C END IF
  432. C
  433. C IF(IFLAG(1).EQ.2) THEN
  434. C
  435. C Define one set of values for I,J,AIJ, and INDCAT.
  436. C Each nonzero entry of A must be defined this way.
  437. C These values can be defined in any convenient order.
  438. C (It is most efficient to define the data by
  439. C columns in the order 1,...,NVARS; within each
  440. C column define the entries in the order 1,...,MRELAS.)
  441. C If this is the last matrix value to be
  442. C defined or updated, then set IFLAG(1)=3.
  443. C (When I and J are positive and respectively no larger
  444. C than MRELAS and NVARS, the value of AIJ is used to
  445. C define (or update) row I and column J of A.)
  446. C RETURN
  447. C
  448. C END IF
  449. C
  450. C END
  451. C
  452. C Remarks: The values of I and J are the row and column
  453. C indices for the nonzero entries of the matrix A.
  454. C The value of this entry is AIJ.
  455. C Set INDCAT=0 if this value defines that entry.
  456. C Set INDCAT=1 if this entry is to be updated,
  457. C new entry=old entry+AIJ.
  458. C A value of I not between 1 and MRELAS, a value of J
  459. C not between 1 and NVARS, or a value of INDCAT
  460. C not equal to 0 or 1 are each errors.
  461. C
  462. C The contents of IFLAG(K), K=2,...,10, can be used to
  463. C remember the status (of the process of defining the
  464. C matrix entries) between calls to 'NAME'( ) by DSPLP( ).
  465. C On entry to 'NAME'( ), only the values 1 or 2 will be
  466. C in IFLAG(1). More than 2*NVARS*MRELAS definitions of
  467. C the matrix elements is considered an error because
  468. C it suggests an infinite loop in the user-written
  469. C subprogram 'NAME'( ). Any matrix element not
  470. C provided by 'NAME'( ) is defined to be zero.
  471. C
  472. C The REAL arrays PRGOPT(*) and DATTRV(*) are passed as
  473. C arguments directly from DSPLP( ) to 'NAME'( ).
  474. C The array PRGOPT(*) contains any user-defined program
  475. C options. In this usage mode the array DATTRV(*) may
  476. C now contain any (type REAL) data that the user needs
  477. C to define the matrix A. Both arrays PRGOPT(*) and
  478. C DATTRV(*) remain intact between calls to 'NAME'( )
  479. C by DSPLP( ).
  480. C Here is a subprogram that communicates the matrix values for A,
  481. C as represented in DATTRV(*), to DSPLP( ). This subprogram,
  482. C called DUSRMT( ), is included as part of the DSPLP( ) package.
  483. C This subprogram 'decodes' the array DATTRV(*) and defines the
  484. C nonzero entries of the matrix A for DSPLP( ) to store. This
  485. C listing is presented here as a guide and example
  486. C for the users who find it necessary to write their own subroutine
  487. C for this purpose. The contents of DATTRV(*) are given below in
  488. C the description of that parameter.
  489. C
  490. C SUBROUTINE DUSRMT(I,J,AIJ, INDCAT,PRGOPT,DATTRV,IFLAG)
  491. C DIMENSION PRGOPT(*),DATTRV(*),IFLAG(10)
  492. C
  493. C IF(IFLAG(1).EQ.1) THEN
  494. C
  495. C THIS IS THE INITIALIZATION STEP. THE VALUES OF IFLAG(K),K=2,3,4,
  496. C ARE RESPECTIVELY THE COLUMN INDEX, THE ROW INDEX (OR THE NEXT COL.
  497. C INDEX), AND THE POINTER TO THE MATRIX ENTRY'S VALUE WITHIN
  498. C DATTRV(*). ALSO CHECK (DATTRV(1)=0.) SIGNIFYING NO DATA.
  499. C IF(DATTRV(1).EQ.0.) THEN
  500. C I = 0
  501. C J = 0
  502. C IFLAG(1) = 3
  503. C ELSE
  504. C IFLAG(2)=-DATTRV(1)
  505. C IFLAG(3)= DATTRV(2)
  506. C IFLAG(4)= 3
  507. C END IF
  508. C
  509. C RETURN
  510. C ELSE
  511. C J=IFLAG(2)
  512. C I=IFLAG(3)
  513. C L=IFLAG(4)
  514. C IF(I.EQ.0) THEN
  515. C
  516. C SIGNAL THAT ALL OF THE NONZERO ENTRIES HAVE BEEN DEFINED.
  517. C IFLAG(1)=3
  518. C RETURN
  519. C ELSE IF(I.LT.0) THEN
  520. C
  521. C SIGNAL THAT A SWITCH IS MADE TO A NEW COLUMN.
  522. C J=-I
  523. C I=DATTRV(L)
  524. C L=L+1
  525. C END IF
  526. C
  527. C AIJ=DATTRV(L)
  528. C
  529. C UPDATE THE INDICES AND POINTERS FOR THE NEXT ENTRY.
  530. C IFLAG(2)=J
  531. C IFLAG(3)=DATTRV(L+1)
  532. C IFLAG(4)=L+2
  533. C
  534. C INDCAT=0 DENOTES THAT ENTRIES OF THE MATRIX ARE ASSIGNED THE
  535. C VALUES FROM DATTRV(*). NO ACCUMULATION IS PERFORMED.
  536. C INDCAT=0
  537. C RETURN
  538. C END IF
  539. C END
  540. C
  541. C DATTRV(*)
  542. C ---------
  543. C If the user chooses to use the provided subprogram DUSRMT( ) then
  544. C the array DATTRV(*) contains data for the matrix A as follows:
  545. C Each column (numbered J) requires (floating point) data con-
  546. C sisting of the value (-J) followed by pairs of values. Each pair
  547. C consists of the row index immediately followed by the value
  548. C of the matrix at that entry. A value of J=0 signals that there
  549. C are no more columns. (See "Example of DSPLP( ) Usage," below.)
  550. C The dimension of DATTRV(*) must be 2*no. of nonzeros
  551. C + NVARS + 1 in this usage. No checking of the array
  552. C length is done by the subprogram package.
  553. C
  554. C If the Save/Restore feature is in use (see options with
  555. C KEY=55,57 for details of checkpointing and restarting)
  556. C DUSRMT( ) can be used to redefine entries of the matrix.
  557. C The matrix entries are redefined or overwritten. No accum-
  558. C ulation is performed.
  559. C Any other nonzero entry of A, defined in a previous call to
  560. C DSPLP( ), remain intact.
  561. C
  562. C BL(*),BU(*),IND(*)
  563. C ------------------
  564. C The values of IND(*) are input parameters that define
  565. C the form of the bounds for the unknowns x and w. The values for
  566. C the bounds are found in the arrays BL(*) and BU(*) as follows.
  567. C
  568. C For values of J between 1 and NVARS,
  569. C if IND(J)=1, then X(J) .GE. BL(J); BU(J) is not used.
  570. C if IND(J)=2, then X(J) .LE. BU(J); BL(J) is not used.
  571. C if IND(J)=3, then BL(J) .LE. X(J) .LE. BU(J),(BL(J)=BU(J) ok)
  572. C if IND(J)=4, then X(J) is free to have any value,
  573. C and BL(J), BU(J) are not used.
  574. C
  575. C For values of I between NVARS+1 and NVARS+MRELAS,
  576. C if IND(I)=1, then W(I-NVARS) .GE. BL(I); BU(I) is not used.
  577. C if IND(I)=2, then W(I-NVARS) .LE. BU(I); BL(I) is not used.
  578. C if IND(I)=3, then BL(I) .LE. W(I-NVARS) .LE. BU(I),
  579. C (BL(I)=BU(I) is ok).
  580. C if IND(I)=4, then W(I-NVARS) is free to have any value,
  581. C and BL(I), BU(I) are not used.
  582. C
  583. C A value of IND(*) not equal to 1,2,3 or 4 is an error. When
  584. C IND(I)=3, BL(I) must be .LE. BU(I). The condition BL(I).GT.
  585. C BU(I) indicates infeasibility and is an error. These
  586. C arrays can be changed by the user between restarts. See
  587. C options with KEY=55,57 for details of checkpointing and
  588. C restarting.
  589. C
  590. C PRGOPT(*)
  591. C ---------
  592. C This array is used to redefine various parameters within DSPLP( ).
  593. C Frequently, perhaps most of the time, a user will be satisfied
  594. C and obtain the solutions with no changes to any of these
  595. C parameters. To try this, simply set PRGOPT(1)=1.D0.
  596. C
  597. C For users with more sophisticated needs, DSPLP( ) provides several
  598. C options that may be used to take advantage of more detailed
  599. C knowledge of the problem or satisfy other utilitarian needs.
  600. C The complete description of how to use this option array to
  601. C utilize additional subprogram features is found under the
  602. C heading "Usage of DSPLP( ) Subprogram Options."
  603. C
  604. C Briefly, the user should note the following value of the parameter
  605. C KEY and the corresponding task or feature desired before turning
  606. C to that section.
  607. C
  608. C Value Brief Statement of Purpose for Option
  609. C of KEY
  610. C ------ -------------------------------------
  611. C 50 Change from a minimization problem to a
  612. C maximization problem.
  613. C 51 Change the amount of printed output.
  614. C Normally, no printed output is obtained.
  615. C 52 Redefine the line length and precision used
  616. C for the printed output.
  617. C 53 Redefine the values of LAMAT and LBM that
  618. C were discussed above under the heading
  619. C Fortran Declarations Required.
  620. C 54 Redefine the unit number where pages of the sparse
  621. C data matrix A are stored. Normally, the unit
  622. C number is 1.
  623. C 55 A computation, partially completed, is
  624. C being continued. Read the up-to-date
  625. C partial results from unit number 2.
  626. C 56 Redefine the unit number where the partial results
  627. C are stored. Normally, the unit number is 2.
  628. C 57 Save partial results on unit 2 either after
  629. C maximum iterations or at the optimum.
  630. C 58 Redefine the value for the maximum number of
  631. C iterations. Normally, the maximum number of
  632. C iterations is 3*(NVARS+MRELAS).
  633. C 59 Provide DSPLP( ) with a starting (feasible)
  634. C nonsingular basis. Normally, DSPLP( ) starts
  635. C with the identity matrix columns corresponding
  636. C to the vector w.
  637. C 60 The user has provided scale factors for the
  638. C columns of A. Normally, DSPLP( ) computes scale
  639. C factors that are the reciprocals of the max. norm
  640. C of each column.
  641. C 61 The user has provided a scale factor
  642. C for the vector costs. Normally, DSPLP( ) computes
  643. C a scale factor equal to the reciprocal of the
  644. C max. norm of the vector costs after the column
  645. C scaling for the data matrix has been applied.
  646. C 62 Size parameters, namely the smallest and
  647. C largest magnitudes of nonzero entries in
  648. C the matrix A, are provided. Values noted
  649. C outside this range are to be considered errors.
  650. C 63 Redefine the tolerance required in
  651. C evaluating residuals for feasibility.
  652. C Normally, this value is set to the value RELPR,
  653. C where RELPR = relative precision of the arithmetic.
  654. C 64 Change the criterion for bringing new variables
  655. C into the basis from the steepest edge (best
  656. C local move) to the minimum reduced cost.
  657. C 65 Redefine the value for the number of iterations
  658. C between recalculating the error in the primal
  659. C solution. Normally, this value is equal to ten.
  660. C 66 Perform "partial pricing" on variable selection.
  661. C Redefine the value for the number of negative
  662. C reduced costs to compute (at most) when finding
  663. C a variable to enter the basis. Normally this
  664. C value is set to NVARS. This implies that no
  665. C "partial pricing" is used.
  666. C 67 Adjust the tuning factor (normally one) to apply
  667. C to the primal and dual error estimates.
  668. C 68 Pass information to the subprogram DFULMT(),
  669. C provided with the DSPLP() package, so that a Fortran
  670. C two-dimensional array can be used as the argument
  671. C DATTRV(*).
  672. C 69 Pass an absolute tolerance to use for the feasibility
  673. C test when the usual relative error test indicates
  674. C infeasibility. The nominal value of this tolerance,
  675. C TOLABS, is zero.
  676. C
  677. C
  678. C |---------------|
  679. C |Working Arrays:|
  680. C |---------------|
  681. C
  682. C WORK(*),LW,
  683. C IWORK(*),LIW
  684. C ------------
  685. C The arrays WORK(*) and IWORK(*) are respectively floating point
  686. C and type INTEGER working arrays for DSPLP( ) and its
  687. C subprograms. The lengths of these arrays are respectively
  688. C LW and LIW. These parameters must satisfy the inequalities
  689. C noted above under the heading "Fortran Declarations Required."
  690. C It is an error if either value is too small.
  691. C
  692. C |----------------------------|
  693. C |Input/Output files required:|
  694. C |----------------------------|
  695. C
  696. C Fortran unit 1 is used by DSPLP( ) to store the sparse matrix A
  697. C out of high-speed memory. This direct access file is opened
  698. C within the package under the following two conditions.
  699. C 1. When the Save/Restore feature is used. 2. When the
  700. C constraint matrix is so large that storage out of high-speed
  701. C memory is required. The user may need to close unit 1
  702. C (with deletion from the job step) in the main program unit
  703. C when several calls are made to DSPLP( ). A crude
  704. C upper bound for the amount of information written on unit 1
  705. C is 6*nz, where nz is the number of nonzero entries in A.
  706. C The unit number may be redefined to any other positive value
  707. C by means of input in the option array PRGOPT(*).
  708. C
  709. C Fortran unit 2 is used by DSPLP( ) only when the Save/Restore
  710. C feature is desired. Normally this feature is not used. It is
  711. C activated by means of input in the option array PRGOPT(*).
  712. C On some computer systems the user may need to open unit
  713. C 2 before executing a call to DSPLP( ). This file is type
  714. C sequential and is unformatted.
  715. C
  716. C Fortran unit=I1MACH(2) (check local setting) is used by DSPLP( )
  717. C when the printed output feature (KEY=51) is used. Normally
  718. C this feature is not used. It is activated by input in the
  719. C options array PRGOPT(*). For many computer systems I1MACH(2)=6.
  720. C
  721. C |-------|
  722. C |Output:|
  723. C |-------|
  724. C
  725. C INFO,PRIMAL(*),DUALS(*)
  726. C -----------------------
  727. C The integer flag INFO indicates why DSPLP( ) has returned to the
  728. C user. If INFO=1 the solution has been computed. In this case
  729. C X(J)=PRIMAL(J) and W(I)=PRIMAL(I+NVARS). The dual variables
  730. C for the equations A*x=w are in the array DUALS(I)=dual for
  731. C equation number I. The dual value for the component X(J) that
  732. C has an upper or lower bound (or both) is returned in
  733. C DUALS(J+MRELAS). The only other values for INFO are .LT. 0.
  734. C The meaning of these values can be found by reading
  735. C the diagnostic message in the output file, or by looking for
  736. C error number = (-INFO) under the heading "List of DSPLP( ) Error
  737. C and Diagnostic Messages."
  738. C The diagnostic messages are printed using the error processing
  739. C subprogram XERMSG( ) with error category LEVEL=1.
  740. C See the document "Brief Instr. for Using the Sandia Math.
  741. C Subroutine Library," SAND79-2382, Nov., 1980, for further inform-
  742. C ation about resetting the usual response to a diagnostic message.
  743. C
  744. C BL(*),BU(*),IND(*)
  745. C ------------------
  746. C These arrays are output parameters only under the (unusual)
  747. C circumstances where the stated problem is infeasible, has an
  748. C unbounded optimum value, or both. These respective conditions
  749. C correspond to INFO=-1,-2 or -3. For INFO=-1 or -3 certain comp-
  750. C onents of the vectors x or w will not satisfy the input bounds.
  751. C If component J of X or component I of W does not satisfy its input
  752. C bound because of infeasibility, then IND(J)=-4 or IND(I+NVARS)=-4,
  753. C respectively. For INFO=-2 or -3 certain
  754. C components of the vector x could not be used as basic variables
  755. C because the objective function would have become unbounded.
  756. C In particular if component J of x corresponds to such a variable,
  757. C then IND(J)=-3. Further, if the input value of IND(J)
  758. C =1, then BU(J)=BL(J);
  759. C =2, then BL(J)=BU(J);
  760. C =4, then BL(J)=0.,BU(J)=0.
  761. C
  762. C (The J-th variable in x has been restricted to an appropriate
  763. C feasible value.)
  764. C The negative output value for IND(*) allows the user to identify
  765. C those constraints that are not satisfied or those variables that
  766. C would cause unbounded values of the objective function. Note
  767. C that the absolute value of IND(*), together with BL(*) and BU(*),
  768. C are valid input to DSPLP( ). In the case of infeasibility the
  769. C sum of magnitudes of the infeasible values is minimized. Thus
  770. C one could reenter DSPLP( ) with these components of x or w now
  771. C fixed at their present values. This involves setting
  772. C the appropriate components of IND(*) = 3, and BL(*) = BU(*).
  773. C
  774. C IBASIS(I),I=1,...,MRELAS
  775. C ------------------------
  776. C This array contains the indices of the variables that are
  777. C in the active basis set at the solution (INFO=1). A value
  778. C of IBASIS(I) between 1 and NVARS corresponds to the variable
  779. C X(IBASIS(I)). A value of IBASIS(I) between NVARS+1 and NVARS+
  780. C MRELAS corresponds to the variable W(IBASIS(I)-NVARS).
  781. C
  782. C Computing with the Matrix A after Calling DSPLP( )
  783. C --------------------------------------------------
  784. C Following the return from DSPLP( ), nonzero entries of the MRELAS
  785. C by NVARS matrix A are available for usage by the user. The method
  786. C for obtaining the next nonzero in column J with a row index
  787. C strictly greater than I in value, is completed by executing
  788. C
  789. C CALL DPNNZR(I,AIJ,IPLACE,WORK,IWORK,J)
  790. C
  791. C The value of I is also an output parameter. If I.LE.0 on output,
  792. C then there are no more nonzeroes in column J. If I.GT.0, the
  793. C output value for component number I of column J is in AIJ. The
  794. C parameters WORK(*) and IWORK(*) are the same arguments as in the
  795. C call to DSPLP( ). The parameter IPLACE is a single INTEGER
  796. C working variable.
  797. C
  798. C The data structure used for storage of the matrix A within DSPLP()
  799. C corresponds to sequential storage by columns as defined in
  800. C SAND78-0785. Note that the names of the subprograms LNNZRS(),
  801. C LCHNGS(),LINITM(),LLOC(),LRWPGE(), and LRWVIR() have been
  802. C changed to DPNNZR(),DPCHNG(),PINITM(),IPLOC(),DPRWPG(), and
  803. C DPRWVR() respectively. The error processing subprogram LERROR()
  804. C is no longer used; XERMSG() is used instead.
  805. C
  806. C |--------------------------------|
  807. C |Subprograms Required by DSPLP( )|
  808. C |--------------------------------|
  809. C Called by DSPLP() are DPLPMN(),DPLPUP(),DPINIT(),DPOPT(),
  810. C DPLPDM(),DPLPCE(),DPINCW(),DPLPFL(),
  811. C DPLPFE(),DPLPMU().
  812. C
  813. C Error Processing Subprograms XERMSG(),I1MACH(),D1MACH()
  814. C
  815. C Sparse Matrix Subprograms DPNNZR(),DPCHNG(),DPRWPG(),DPRWVR(),
  816. C PINITM(),IPLOC()
  817. C
  818. C Mass Storage File Subprograms SOPENM(),SCLOSM(),DREADP(),DWRITP()
  819. C
  820. C Basic Linear Algebra Subprograms DCOPY(),DASUM(),DDOT()
  821. C
  822. C Sparse Matrix Basis Handling Subprograms LA05AD(),LA05BD(),
  823. C LA05CD(),LA05ED(),MC20AD()
  824. C
  825. C Vector Output Subprograms DVOUT(),IVOUT()
  826. C
  827. C Machine-sensitive Subprograms I1MACH( ),D1MACH( ),
  828. C SOPENM(),SCLOSM(),DREADP(),DWRITP().
  829. C COMMON Block Used
  830. C -----------------
  831. C /LA05DD/ SMALL,LP,LENL,LENU,NCP,LROW,LCOL
  832. C See the document AERE-R8269 for further details.
  833. C |-------------------------|
  834. C |Example of DSPLP( ) Usage|
  835. C |-------------------------|
  836. C PROGRAM LPEX
  837. C THE OPTIMIZATION PROBLEM IS TO FIND X1, X2, X3 THAT
  838. C MINIMIZE X1 + X2 + X3, X1.GE.0, X2.GE.0, X3 UNCONSTRAINED.
  839. C
  840. C THE UNKNOWNS X1,X2,X3 ARE TO SATISFY CONSTRAINTS
  841. C
  842. C X1 -3*X2 +4*X3 = 5
  843. C X1 -2*X2 .LE.3
  844. C 2*X2 - X3.GE.4
  845. C
  846. C WE FIRST DEFINE THE DEPENDENT VARIABLES
  847. C W1=X1 -3*X2 +4*X3
  848. C W2=X1- 2*X2
  849. C W3= 2*X2 -X3
  850. C
  851. C WE NOW SHOW HOW TO USE DSPLP( ) TO SOLVE THIS LINEAR OPTIMIZATION
  852. C PROBLEM. EACH REQUIRED STEP WILL BE SHOWN IN THIS EXAMPLE.
  853. C DIMENSION COSTS(03),PRGOPT(01),DATTRV(18),BL(06),BU(06),IND(06),
  854. C *PRIMAL(06),DUALS(06),IBASIS(06),WORK(079),IWORK(103)
  855. C
  856. C EXTERNAL DUSRMT
  857. C MRELAS=3
  858. C NVARS=3
  859. C
  860. C DEFINE THE ARRAY COSTS(*) FOR THE OBJECTIVE FUNCTION.
  861. C COSTS(01)=1.
  862. C COSTS(02)=1.
  863. C COSTS(03)=1.
  864. C
  865. C PLACE THE NONZERO INFORMATION ABOUT THE MATRIX IN DATTRV(*).
  866. C DEFINE COL. 1:
  867. C DATTRV(01)=-1
  868. C DATTRV(02)=1
  869. C DATTRV(03)=1.
  870. C DATTRV(04)=2
  871. C DATTRV(05)=1.
  872. C
  873. C DEFINE COL. 2:
  874. C DATTRV(06)=-2
  875. C DATTRV(07)=1
  876. C DATTRV(08)=-3.
  877. C DATTRV(09)=2
  878. C DATTRV(10)=-2.
  879. C DATTRV(11)=3
  880. C DATTRV(12)=2.
  881. C
  882. C DEFINE COL. 3:
  883. C DATTRV(13)=-3
  884. C DATTRV(14)=1
  885. C DATTRV(15)=4.
  886. C DATTRV(16)=3
  887. C DATTRV(17)=-1.
  888. C
  889. C DATTRV(18)=0
  890. C
  891. C CONSTRAIN X1,X2 TO BE NONNEGATIVE. LET X3 HAVE NO BOUNDS.
  892. C BL(1)=0.
  893. C IND(1)=1
  894. C BL(2)=0.
  895. C IND(2)=1
  896. C IND(3)=4
  897. C
  898. C CONSTRAIN W1=5,W2.LE.3, AND W3.GE.4.
  899. C BL(4)=5.
  900. C BU(4)=5.
  901. C IND(4)=3
  902. C BU(5)=3.
  903. C IND(5)=2
  904. C BL(6)=4.
  905. C IND(6)=1
  906. C
  907. C INDICATE THAT NO MODIFICATIONS TO OPTIONS ARE IN USE.
  908. C PRGOPT(01)=1
  909. C
  910. C DEFINE THE WORKING ARRAY LENGTHS.
  911. C LW=079
  912. C LIW=103
  913. C CALL DSPLP(DUSRMT,MRELAS,NVARS,COSTS,PRGOPT,DATTRV,
  914. C *BL,BU,IND,INFO,PRIMAL,DUALS,IBASIS,WORK,LW,IWORK,LIW)
  915. C
  916. C CALCULATE VAL, THE MINIMAL VALUE OF THE OBJECTIVE FUNCTION.
  917. C VAL=DDOT(NVARS,COSTS,1,PRIMAL,1)
  918. C
  919. C STOP
  920. C END
  921. C |------------------------|
  922. C |End of Example of Usage |
  923. C |------------------------|
  924. C
  925. C |-------------------------------------|
  926. C |Usage of DSPLP( ) Subprogram Options.|
  927. C |-------------------------------------|
  928. C
  929. C Users frequently have a large variety of requirements for linear
  930. C optimization software. Allowing for these varied requirements
  931. C is at cross purposes with the desire to keep the usage of DSPLP( )
  932. C as simple as possible. One solution to this dilemma is as follows.
  933. C (1) Provide a version of DSPLP( ) that solves a wide class of
  934. C problems and is easy to use. (2) Identify parameters within
  935. C DSPLP() that certain users may want to change. (3) Provide a
  936. C means of changing any selected number of these parameters that
  937. C does not require changing all of them.
  938. C
  939. C Changing selected parameters is done by requiring
  940. C that the user provide an option array, PRGOPT(*), to DSPLP( ).
  941. C The contents of PRGOPT(*) inform DSPLP( ) of just those options
  942. C that are going to be modified within the total set of possible
  943. C parameters that can be modified. The array PRGOPT(*) is a linked
  944. C list consisting of groups of data of the following form
  945. C
  946. C LINK
  947. C KEY
  948. C SWITCH
  949. C data set
  950. C
  951. C that describe the desired options. The parameters LINK, KEY and
  952. C switch are each one word and are always required. The data set
  953. C can be comprised of several words or can be empty. The number of
  954. C words in the data set for each option depends on the value of
  955. C the parameter KEY.
  956. C
  957. C The value of LINK points to the first entry of the next group
  958. C of data within PRGOPT(*). The exception is when there are no more
  959. C options to change. In that case, LINK=1 and the values for KEY,
  960. C SWITCH and data set are not referenced. The general layout of
  961. C PRGOPT(*) is as follows:
  962. C ...PRGOPT(1)=LINK1 (link to first entry of next group)
  963. C . PRGOPT(2)=KEY1 (KEY to the option change)
  964. C . PRGOPT(3)=SWITCH1 (on/off switch for the option)
  965. C . PRGOPT(4)=data value
  966. C . .
  967. C . .
  968. C . .
  969. C ...PRGOPT(LINK1)=LINK2 (link to first entry of next group)
  970. C . PRGOPT(LINK1+1)=KEY2 (KEY to option change)
  971. C . PRGOPT(LINK1+2)=SWITCH2 (on/off switch for the option)
  972. C . PRGOPT(LINK1+3)=data value
  973. C ... .
  974. C . .
  975. C . .
  976. C ...PRGOPT(LINK)=1 (no more options to change)
  977. C
  978. C A value of LINK that is .LE.0 or .GT. 10000 is an error.
  979. C In this case DSPLP( ) returns with an error message, INFO=-14.
  980. C This helps prevent using invalid but positive values of LINK that
  981. C will probably extend beyond the program limits of PRGOPT(*).
  982. C Unrecognized values of KEY are ignored. If the value of SWITCH is
  983. C zero then the option is turned off. For any other value of SWITCH
  984. C the option is turned on. This is used to allow easy changing of
  985. C options without rewriting PRGOPT(*). The order of the options is
  986. C arbitrary and any number of options can be changed with the
  987. C following restriction. To prevent cycling in processing of the
  988. C option array PRGOPT(*), a count of the number of options changed
  989. C is maintained. Whenever this count exceeds 1000 an error message
  990. C (INFO=-15) is printed and the subprogram returns.
  991. C
  992. C In the following description of the options, the value of
  993. C LATP indicates the amount of additional storage that a particular
  994. C option requires. The sum of all of these values (plus one) is
  995. C the minimum dimension for the array PRGOPT(*).
  996. C
  997. C If a user is satisfied with the nominal form of DSPLP( ),
  998. C set PRGOPT(1)=1 (or PRGOPT(1)=1.D0).
  999. C
  1000. C Options:
  1001. C
  1002. C -----KEY = 50. Change from a minimization problem to a maximization
  1003. C problem.
  1004. C If SWITCH=0 option is off; solve minimization problem.
  1005. C =1 option is on; solve maximization problem.
  1006. C data set =empty
  1007. C LATP=3
  1008. C
  1009. C -----KEY = 51. Change the amount of printed output. The nominal form
  1010. C of DSPLP( ) has no printed output.
  1011. C The first level of output (SWITCH=1) includes
  1012. C
  1013. C (1) Minimum dimensions for the arrays COSTS(*),BL(*),BU(*),IND(*),
  1014. C PRIMAL(*),DUALS(*),IBASIS(*), and PRGOPT(*).
  1015. C (2) Problem dimensions MRELAS,NVARS.
  1016. C (3) The types of and values for the bounds on x and w,
  1017. C and the values of the components of the vector costs.
  1018. C (4) Whether optimization problem is minimization or
  1019. C maximization.
  1020. C (5) Whether steepest edge or smallest reduced cost criteria used
  1021. C for exchanging variables in the revised simplex method.
  1022. C
  1023. C Whenever a solution has been found, (INFO=1),
  1024. C
  1025. C (6) the value of the objective function,
  1026. C (7) the values of the vectors x and w,
  1027. C (8) the dual variables for the constraints A*x=w and the
  1028. C bounded components of x,
  1029. C (9) the indices of the basic variables,
  1030. C (10) the number of revised simplex method iterations,
  1031. C (11) the number of full decompositions of the basis matrix.
  1032. C
  1033. C The second level of output (SWITCH=2) includes all for SWITCH=1
  1034. C plus
  1035. C
  1036. C (12) the iteration number,
  1037. C (13) the column number to enter the basis,
  1038. C (14) the column number to leave the basis,
  1039. C (15) the length of the step taken.
  1040. C
  1041. C The third level of output (SWITCH=3) includes all for SWITCH=2
  1042. C plus
  1043. C (16) critical quantities required in the revised simplex method.
  1044. C This output is rather voluminous. It is intended to be used
  1045. C as a diagnostic tool in case of a failure in DSPLP( ).
  1046. C
  1047. C If SWITCH=0 option is off; no printed output.
  1048. C =1 summary output.
  1049. C =2 lots of output.
  1050. C =3 even more output.
  1051. C data set =empty
  1052. C LATP=3
  1053. C
  1054. C -----KEY = 52. Redefine the parameter, IDIGIT, which determines the
  1055. C format and precision used for the printed output. In the printed
  1056. C output, at least ABS(IDIGIT) decimal digits per number is
  1057. C printed. If IDIGIT.LT.0, 72 printing columns are used. If
  1058. C IDIGIT.GT.0, 133 printing columns are used.
  1059. C If SWITCH=0 option is off; IDIGIT=-4.
  1060. C =1 option is on.
  1061. C data set =IDIGIT
  1062. C LATP=4
  1063. C
  1064. C -----KEY = 53. Redefine LAMAT and LBM, the lengths of the portions of
  1065. C WORK(*) and IWORK(*) that are allocated to the sparse matrix
  1066. C storage and the sparse linear equation solver, respectively.
  1067. C LAMAT must be .GE. NVARS+7 and LBM must be positive.
  1068. C If SWITCH=0 option is off; LAMAT=4*NVARS+7
  1069. C LBM =8*MRELAS.
  1070. C =1 option is on.
  1071. C data set =LAMAT
  1072. C LBM
  1073. C LATP=5
  1074. C
  1075. C -----KEY = 54. Redefine IPAGEF, the file number where the pages of the
  1076. C sparse data matrix are stored. IPAGEF must be positive and
  1077. C different from ISAVE (see option 56).
  1078. C If SWITCH=0 option is off; IPAGEF=1.
  1079. C =1 option is on.
  1080. C data set =IPAGEF
  1081. C LATP=4
  1082. C
  1083. C -----KEY = 55. Partial results have been computed and stored on unit
  1084. C number ISAVE (see option 56), during a previous run of
  1085. C DSPLP( ). This is a continuation from these partial results.
  1086. C The arrays COSTS(*),BL(*),BU(*),IND(*) do not have to have
  1087. C the same values as they did when the checkpointing occurred.
  1088. C This feature makes it possible for the user to do certain
  1089. C types of parameter studies such as changing costs and varying
  1090. C the constraints of the problem. This file is rewound both be-
  1091. C fore and after reading the partial results.
  1092. C If SWITCH=0 option is off; start a new problem.
  1093. C =1 option is on; continue from partial results
  1094. C that are stored in file ISAVE.
  1095. C data set = empty
  1096. C LATP=3
  1097. C
  1098. C -----KEY = 56. Redefine ISAVE, the file number where the partial
  1099. C results are stored (see option 57). ISAVE must be positive and
  1100. C different from IPAGEF (see option 54).
  1101. C If SWITCH=0 option is off; ISAVE=2.
  1102. C =1 option is on.
  1103. C data set =ISAVE
  1104. C LATP=4
  1105. C
  1106. C -----KEY = 57. Save the partial results after maximum number of
  1107. C iterations, MAXITR, or at the optimum. When this option is on,
  1108. C data essential to continuing the calculation is saved on a file
  1109. C using a Fortran binary write operation. The data saved includes
  1110. C all the information about the sparse data matrix A. Also saved
  1111. C is information about the current basis. Nominally the partial
  1112. C results are saved on Fortran unit 2. This unit number can be
  1113. C redefined (see option 56). If the save option is on,
  1114. C this file must be opened (or declared) by the user prior to the
  1115. C call to DSPLP( ). A crude upper bound for the number of words
  1116. C written to this file is 6*nz. Here nz= number of nonzeros in A.
  1117. C If SWITCH=0 option is off; do not save partial results.
  1118. C =1 option is on; save partial results.
  1119. C data set = empty
  1120. C LATP=3
  1121. C
  1122. C -----KEY = 58. Redefine the maximum number of iterations, MAXITR, to
  1123. C be taken before returning to the user.
  1124. C If SWITCH=0 option is off; MAXITR=3*(NVARS+MRELAS).
  1125. C =1 option is on.
  1126. C data set =MAXITR
  1127. C LATP=4
  1128. C
  1129. C -----KEY = 59. Provide DSPLP( ) with exactly MRELAS indices which
  1130. C comprise a feasible, nonsingular basis. The basis must define a
  1131. C feasible point: values for x and w such that A*x=w and all the
  1132. C stated bounds on x and w are satisfied. The basis must also be
  1133. C nonsingular. The failure of either condition will cause an error
  1134. C message (INFO=-23 or =-24, respectively). Normally, DSPLP( ) uses
  1135. C identity matrix columns which correspond to the components of w.
  1136. C This option would normally not be used when restarting from
  1137. C a previously saved run (KEY=57).
  1138. C In numbering the unknowns,
  1139. C the components of x are numbered (1-NVARS) and the components
  1140. C of w are numbered (NVARS+1)-(NVARS+MRELAS). A value for an
  1141. C index .LE. 0 or .GT. (NVARS+MRELAS) is an error (INFO=-16).
  1142. C If SWITCH=0 option is off; DSPLP( ) chooses the initial basis.
  1143. C =1 option is on; user provides the initial basis.
  1144. C data set =MRELAS indices of basis; order is arbitrary.
  1145. C LATP=MRELAS+3
  1146. C
  1147. C -----KEY = 60. Provide the scale factors for the columns of the data
  1148. C matrix A. Normally, DSPLP( ) computes the scale factors as the
  1149. C reciprocals of the max. norm of each column.
  1150. C If SWITCH=0 option is off; DSPLP( ) computes the scale factors.
  1151. C =1 option is on; user provides the scale factors.
  1152. C data set =scaling for column J, J=1,NVARS; order is sequential.
  1153. C LATP=NVARS+3
  1154. C
  1155. C -----KEY = 61. Provide a scale factor, COSTSC, for the vector of
  1156. C costs. Normally, DSPLP( ) computes this scale factor to be the
  1157. C reciprocal of the max. norm of the vector costs after the column
  1158. C scaling has been applied.
  1159. C If SWITCH=0 option is off; DSPLP( ) computes COSTSC.
  1160. C =1 option is on; user provides COSTSC.
  1161. C data set =COSTSC
  1162. C LATP=4
  1163. C
  1164. C -----KEY = 62. Provide size parameters, ASMALL and ABIG, the smallest
  1165. C and largest magnitudes of nonzero entries in the data matrix A,
  1166. C respectively. When this option is on, DSPLP( ) will check the
  1167. C nonzero entries of A to see if they are in the range of ASMALL and
  1168. C ABIG. If an entry of A is not within this range, DSPLP( ) returns
  1169. C an error message, INFO=-22. Both ASMALL and ABIG must be positive
  1170. C with ASMALL .LE. ABIG. Otherwise, an error message is returned,
  1171. C INFO=-17.
  1172. C If SWITCH=0 option is off; no checking of the data matrix is done
  1173. C =1 option is on; checking is done.
  1174. C data set =ASMALL
  1175. C ABIG
  1176. C LATP=5
  1177. C
  1178. C -----KEY = 63. Redefine the relative tolerance, TOLLS, used in
  1179. C checking if the residuals are feasible. Normally,
  1180. C TOLLS=RELPR, where RELPR is the machine precision.
  1181. C If SWITCH=0 option is off; TOLLS=RELPR.
  1182. C =1 option is on.
  1183. C data set =TOLLS
  1184. C LATP=4
  1185. C
  1186. C -----KEY = 64. Use the minimum reduced cost pricing strategy to choose
  1187. C columns to enter the basis. Normally, DSPLP( ) uses the steepest
  1188. C edge pricing strategy which is the best local move. The steepest
  1189. C edge pricing strategy generally uses fewer iterations than the
  1190. C minimum reduced cost pricing, but each iteration costs more in the
  1191. C number of calculations done. The steepest edge pricing is
  1192. C considered to be more efficient. However, this is very problem
  1193. C dependent. That is why DSPLP( ) provides the option of either
  1194. C pricing strategy.
  1195. C If SWITCH=0 option is off; steepest option edge pricing is used.
  1196. C =1 option is on; minimum reduced cost pricing is used.
  1197. C data set =empty
  1198. C LATP=3
  1199. C
  1200. C -----KEY = 65. Redefine MXITBR, the number of iterations between
  1201. C recalculating the error in the primal solution. Normally, MXITBR
  1202. C is set to 10. The error in the primal solution is used to monitor
  1203. C the error in solving the linear system. This is an expensive
  1204. C calculation and every tenth iteration is generally often enough.
  1205. C If SWITCH=0 option is off; MXITBR=10.
  1206. C =1 option is on.
  1207. C data set =MXITBR
  1208. C LATP=4
  1209. C
  1210. C -----KEY = 66. Redefine NPP, the number of negative reduced costs
  1211. C (at most) to be found at each iteration of choosing
  1212. C a variable to enter the basis. Normally NPP is set
  1213. C to NVARS which implies that all of the reduced costs
  1214. C are computed at each such step. This "partial
  1215. C pricing" may very well increase the total number
  1216. C of iterations required. However it decreases the
  1217. C number of calculations at each iteration.
  1218. C therefore the effect on overall efficiency is quite
  1219. C problem-dependent.
  1220. C
  1221. C if SWITCH=0 option is off; NPP=NVARS
  1222. C =1 option is on.
  1223. C data set =NPP
  1224. C LATP=4
  1225. C
  1226. C -----KEY = 67. Redefine the tuning factor (PHI) used to scale the
  1227. C error estimates for the primal and dual linear algebraic systems
  1228. C of equations. Normally, PHI = 1.D0, but in some environments it
  1229. C may be necessary to reset PHI to the range 0.001-0.01. This is
  1230. C particularly important for machines with short word lengths.
  1231. C
  1232. C if SWITCH = 0 option is off; PHI=1.D0.
  1233. C = 1 option is on.
  1234. C Data Set = PHI
  1235. C LATP=4
  1236. C
  1237. C -----KEY = 68. Used together with the subprogram DFULMT(), provided
  1238. C with the DSPLP() package, for passing a standard Fortran two-
  1239. C dimensional array containing the constraint matrix. Thus the sub-
  1240. C program DFULMT must be declared in a Fortran EXTERNAL statement.
  1241. C The two-dimensional array is passed as the argument DATTRV.
  1242. C The information about the array and problem dimensions are passed
  1243. C in the option array PRGOPT(*). It is an error if DFULMT() is
  1244. C used and this information is not passed in PRGOPT(*).
  1245. C
  1246. C if SWITCH = 0 option is off; this is an error is DFULMT() is
  1247. C used.
  1248. C = 1 option is on.
  1249. C Data Set = IA = row dimension of two-dimensional array.
  1250. C MRELAS = number of constraint equations.
  1251. C NVARS = number of dependent variables.
  1252. C LATP = 6
  1253. C -----KEY = 69. Normally a relative tolerance (TOLLS, see option 63)
  1254. C is used to decide if the problem is feasible. If this test fails
  1255. C an absolute test will be applied using the value TOLABS.
  1256. C Nominally TOLABS = zero.
  1257. C If SWITCH = 0 option is off; TOLABS = zero.
  1258. C = 1 option is on.
  1259. C Data set = TOLABS
  1260. C LATP = 4
  1261. C
  1262. C |-----------------------------|
  1263. C |Example of Option array Usage|
  1264. C |-----------------------------|
  1265. C To illustrate the usage of the option array, let us suppose that
  1266. C the user has the following nonstandard requirements:
  1267. C
  1268. C a) Wants to change from minimization to maximization problem.
  1269. C b) Wants to limit the number of simplex steps to 100.
  1270. C c) Wants to save the partial results after 100 steps on
  1271. C Fortran unit 2.
  1272. C
  1273. C After these 100 steps are completed the user wants to continue the
  1274. C problem (until completed) using the partial results saved on
  1275. C Fortran unit 2. Here are the entries of the array PRGOPT(*)
  1276. C that accomplish these tasks. (The definitions of the other
  1277. C required input parameters are not shown.)
  1278. C
  1279. C CHANGE TO A MAXIMIZATION PROBLEM; KEY=50.
  1280. C PRGOPT(01)=4
  1281. C PRGOPT(02)=50
  1282. C PRGOPT(03)=1
  1283. C
  1284. C LIMIT THE NUMBER OF SIMPLEX STEPS TO 100; KEY=58.
  1285. C PRGOPT(04)=8
  1286. C PRGOPT(05)=58
  1287. C PRGOPT(06)=1
  1288. C PRGOPT(07)=100
  1289. C
  1290. C SAVE THE PARTIAL RESULTS, AFTER 100 STEPS, ON FORTRAN
  1291. C UNIT 2; KEY=57.
  1292. C PRGOPT(08)=11
  1293. C PRGOPT(09)=57
  1294. C PRGOPT(10)=1
  1295. C
  1296. C NO MORE OPTIONS TO CHANGE.
  1297. C PRGOPT(11)=1
  1298. C The user makes the CALL statement for DSPLP( ) at this point.
  1299. C Now to restart, using the partial results after 100 steps, define
  1300. C new values for the array PRGOPT(*):
  1301. C
  1302. C AGAIN INFORM DSPLP( ) THAT THIS IS A MAXIMIZATION PROBLEM.
  1303. C PRGOPT(01)=4
  1304. C PRGOPT(02)=50
  1305. C PRGOPT(03)=1
  1306. C
  1307. C RESTART, USING SAVED PARTIAL RESULTS; KEY=55.
  1308. C PRGOPT(04)=7
  1309. C PRGOPT(05)=55
  1310. C PRGOPT(06)=1
  1311. C
  1312. C NO MORE OPTIONS TO CHANGE. THE SUBPROGRAM DSPLP( ) IS NO LONGER
  1313. C LIMITED TO 100 SIMPLEX STEPS BUT WILL RUN UNTIL COMPLETION OR
  1314. C MAX.=3*(MRELAS+NVARS) ITERATIONS.
  1315. C PRGOPT(07)=1
  1316. C The user now makes a CALL to subprogram DSPLP( ) to compute the
  1317. C solution.
  1318. C |--------------------------------------------|
  1319. C |End of Usage of DSPLP( ) Subprogram Options.|
  1320. C |--------------------------------------------|
  1321. C
  1322. C |-----------------------------------------------|
  1323. C |List of DSPLP( ) Error and Diagnostic Messages.|
  1324. C |-----------------------------------------------|
  1325. C This section may be required to understand the meanings of the
  1326. C error flag =-INFO that may be returned from DSPLP( ).
  1327. C
  1328. C -----1. There is no set of values for x and w that satisfy A*x=w and
  1329. C the stated bounds. The problem can be made feasible by ident-
  1330. C ifying components of w that are now infeasible and then rede-
  1331. C signating them as free variables. Subprogram DSPLP( ) only
  1332. C identifies an infeasible problem; it takes no other action to
  1333. C change this condition. Message:
  1334. C DSPLP( ). THE PROBLEM APPEARS TO BE INFEASIBLE.
  1335. C ERROR NUMBER = 1
  1336. C
  1337. C 2. One of the variables in either the vector x or w was con-
  1338. C strained at a bound. Otherwise the objective function value,
  1339. C (transpose of costs)*x, would not have a finite optimum.
  1340. C Message:
  1341. C DSPLP( ). THE PROBLEM APPEARS TO HAVE NO FINITE SOLN.
  1342. C ERROR NUMBER = 2
  1343. C
  1344. C 3. Both of the conditions of 1. and 2. above have occurred.
  1345. C Message:
  1346. C DSPLP( ). THE PROBLEM APPEARS TO BE INFEASIBLE AND TO
  1347. C HAVE NO FINITE SOLN.
  1348. C ERROR NUMBER = 3
  1349. C
  1350. C -----4. The REAL and INTEGER working arrays, WORK(*) and IWORK(*),
  1351. C are not long enough. The values (I1) and (I2) in the message
  1352. C below will give you the minimum length required. Also redefine
  1353. C LW and LIW, the lengths of these arrays. Message:
  1354. C DSPLP( ). WORK OR IWORK IS NOT LONG ENOUGH. LW MUST BE (I1)
  1355. C AND LIW MUST BE (I2).
  1356. C IN ABOVE MESSAGE, I1= 0
  1357. C IN ABOVE MESSAGE, I2= 0
  1358. C ERROR NUMBER = 4
  1359. C
  1360. C -----5. and 6. These error messages often mean that one or more
  1361. C arguments were left out of the call statement to DSPLP( ) or
  1362. C that the values of MRELAS and NVARS have been over-written
  1363. C by garbage. Messages:
  1364. C DSPLP( ). VALUE OF MRELAS MUST BE .GT.0. NOW=(I1).
  1365. C IN ABOVE MESSAGE, I1= 0
  1366. C ERROR NUMBER = 5
  1367. C
  1368. C DSPLP( ). VALUE OF NVARS MUST BE .GT.0. NOW=(I1).
  1369. C IN ABOVE MESSAGE, I1= 0
  1370. C ERROR NUMBER = 6
  1371. C
  1372. C -----7.,8., and 9. These error messages can occur as the data matrix
  1373. C is being defined by either DUSRMT( ) or the user-supplied sub-
  1374. C program, 'NAME'( ). They would indicate a mistake in the contents
  1375. C of DATTRV(*), the user-written subprogram or that data has been
  1376. C over-written.
  1377. C Messages:
  1378. C DSPLP( ). MORE THAN 2*NVARS*MRELAS ITERS. DEFINING OR UPDATING
  1379. C MATRIX DATA.
  1380. C ERROR NUMBER = 7
  1381. C
  1382. C DSPLP( ). ROW INDEX (I1) OR COLUMN INDEX (I2) IS OUT OF RANGE.
  1383. C IN ABOVE MESSAGE, I1= 1
  1384. C IN ABOVE MESSAGE, I2= 12
  1385. C ERROR NUMBER = 8
  1386. C
  1387. C DSPLP( ). INDICATION FLAG (I1) FOR MATRIX DATA MUST BE
  1388. C EITHER 0 OR 1.
  1389. C IN ABOVE MESSAGE, I1= 12
  1390. C ERROR NUMBER = 9
  1391. C
  1392. C -----10. and 11. The type of bound (even no bound) and the bounds
  1393. C must be specified for each independent variable. If an independent
  1394. C variable has both an upper and lower bound, the bounds must be
  1395. C consistent. The lower bound must be .LE. the upper bound.
  1396. C Messages:
  1397. C DSPLP( ). INDEPENDENT VARIABLE (I1) IS NOT DEFINED.
  1398. C IN ABOVE MESSAGE, I1= 1
  1399. C ERROR NUMBER = 10
  1400. C
  1401. C DSPLP( ). LOWER BOUND (R1) AND UPPER BOUND (R2) FOR INDEP.
  1402. C VARIABLE (I1) ARE NOT CONSISTENT.
  1403. C IN ABOVE MESSAGE, I1= 1
  1404. C IN ABOVE MESSAGE, R1= 0.
  1405. C IN ABOVE MESSAGE, R2= -.1000000000E+01
  1406. C ERROR NUMBER = 11
  1407. C
  1408. C -----12. and 13. The type of bound (even no bound) and the bounds
  1409. C must be specified for each dependent variable. If a dependent
  1410. C variable has both an upper and lower bound, the bounds must be
  1411. C consistent. The lower bound must be .LE. the upper bound.
  1412. C Messages:
  1413. C DSPLP( ). DEPENDENT VARIABLE (I1) IS NOT DEFINED.
  1414. C IN ABOVE MESSAGE, I1= 1
  1415. C ERROR NUMBER = 12
  1416. C
  1417. C DSPLP( ). LOWER BOUND (R1) AND UPPER BOUND (R2) FOR DEP.
  1418. C VARIABLE (I1) ARE NOT CONSISTENT.
  1419. C IN ABOVE MESSAGE, I1= 1
  1420. C IN ABOVE MESSAGE, R1= 0.
  1421. C IN ABOVE MESSAGE, R2= -.1000000000E+01
  1422. C ERROR NUMBER = 13
  1423. C
  1424. C -----14. - 21. These error messages can occur when processing the
  1425. C option array, PRGOPT(*), supplied by the user. They would
  1426. C indicate a mistake in defining PRGOPT(*) or that data has been
  1427. C over-written. See heading Usage of DSPLP( )
  1428. C Subprogram Options, for details on how to define PRGOPT(*).
  1429. C Messages:
  1430. C DSPLP( ). THE USER OPTION ARRAY HAS UNDEFINED DATA.
  1431. C ERROR NUMBER = 14
  1432. C
  1433. C DSPLP( ). OPTION ARRAY PROCESSING IS CYCLING.
  1434. C ERROR NUMBER = 15
  1435. C
  1436. C DSPLP( ). AN INDEX OF USER-SUPPLIED BASIS IS OUT OF RANGE.
  1437. C ERROR NUMBER = 16
  1438. C
  1439. C DSPLP( ). SIZE PARAMETERS FOR MATRIX MUST BE SMALLEST AND LARGEST
  1440. C MAGNITUDES OF NONZERO ENTRIES.
  1441. C ERROR NUMBER = 17
  1442. C
  1443. C DSPLP( ). THE NUMBER OF REVISED SIMPLEX STEPS BETWEEN CHECK-POINTS
  1444. C MUST BE POSITIVE.
  1445. C ERROR NUMBER = 18
  1446. C
  1447. C DSPLP( ). FILE NUMBERS FOR SAVED DATA AND MATRIX PAGES MUST BE
  1448. C POSITIVE AND NOT EQUAL.
  1449. C ERROR NUMBER = 19
  1450. C
  1451. C DSPLP( ). USER-DEFINED VALUE OF LAMAT (I1)
  1452. C MUST BE .GE. NVARS+7.
  1453. C IN ABOVE MESSAGE, I1= 1
  1454. C ERROR NUMBER = 20
  1455. C
  1456. C DSPLP( ). USER-DEFINED VALUE OF LBM MUST BE .GE. 0.
  1457. C ERROR NUMBER = 21
  1458. C
  1459. C -----22. The user-option, number 62, to check the size of the matrix
  1460. C data has been used. An element of the matrix does not lie within
  1461. C the range of ASMALL and ABIG, parameters provided by the user.
  1462. C (See the heading: Usage of DSPLP( ) Subprogram Options,
  1463. C for details about this feature.) Message:
  1464. C DSPLP( ). A MATRIX ELEMENT'S SIZE IS OUT OF THE SPECIFIED RANGE.
  1465. C ERROR NUMBER = 22
  1466. C
  1467. C -----23. The user has provided an initial basis that is singular.
  1468. C In this case, the user can remedy this problem by letting
  1469. C subprogram DSPLP( ) choose its own initial basis. Message:
  1470. C DSPLP( ). A SINGULAR INITIAL BASIS WAS ENCOUNTERED.
  1471. C ERROR NUMBER = 23
  1472. C
  1473. C -----24. The user has provided an initial basis which is infeasible.
  1474. C The x and w values it defines do not satisfy A*x=w and the stated
  1475. C bounds. In this case, the user can let subprogram DSPLP( )
  1476. C choose its own initial basis. Message:
  1477. C DSPLP( ). AN INFEASIBLE INITIAL BASIS WAS ENCOUNTERED.
  1478. C ERROR NUMBER = 24
  1479. C
  1480. C -----25.Subprogram DSPLP( ) has completed the maximum specified number
  1481. C of iterations. (The nominal maximum number is 3*(MRELAS+NVARS).)
  1482. C The results, necessary to continue on from
  1483. C this point, can be saved on Fortran unit 2 by activating option
  1484. C KEY=57. If the user anticipates continuing the calculation, then
  1485. C the contents of Fortran unit 2 must be retained intact. This
  1486. C is not done by subprogram DSPLP( ), so the user needs to save unit
  1487. C 2 by using the appropriate system commands. Message:
  1488. C DSPLP( ). MAX. ITERS. (I1) TAKEN. UP-TO-DATE RESULTS
  1489. C SAVED ON FILE (I2). IF(I2)=0, NO SAVE.
  1490. C IN ABOVE MESSAGE, I1= 500
  1491. C IN ABOVE MESSAGE, I2= 2
  1492. C ERROR NUMBER = 25
  1493. C
  1494. C -----26. This error should never happen. Message:
  1495. C DSPLP( ). MOVED TO A SINGULAR POINT. THIS SHOULD NOT HAPPEN.
  1496. C ERROR NUMBER = 26
  1497. C
  1498. C -----27. The subprogram LA05A( ), which decomposes the basis matrix,
  1499. C has returned with an error flag (R1). (See the document,
  1500. C "Fortran subprograms for handling sparse linear programming
  1501. C bases", AERE-R8269, J.K. Reid, Jan., 1976, H.M. Stationery Office,
  1502. C for an explanation of this error.) Message:
  1503. C DSPLP( ). LA05A( ) RETURNED ERROR FLAG (R1) BELOW.
  1504. C IN ABOVE MESSAGE, R1= -.5000000000E+01
  1505. C ERROR NUMBER = 27
  1506. C
  1507. C -----28. The sparse linear solver package, LA05*( ), requires more
  1508. C space. The value of LBM must be increased. See the companion
  1509. C document, Usage of DSPLP( ) Subprogram Options, for details on how
  1510. C to increase the value of LBM. Message:
  1511. C DSPLP( ). SHORT ON STORAGE FOR LA05*( ) PACKAGE. USE PRGOPT(*)
  1512. C TO GIVE MORE.
  1513. C ERROR NUMBER = 28
  1514. C
  1515. C -----29. The row dimension of the two-dimensional Fortran array,
  1516. C the number of constraint equations (MRELAS), and the number
  1517. C of variables (NVARS), were not passed to the subprogram
  1518. C DFULMT(). See KEY = 68 for details. Message:
  1519. C DFULMT() OF DSPLP() PACKAGE. ROW DIM., MRELAS, NVARS ARE
  1520. C MISSING FROM PRGOPT(*).
  1521. C ERROR NUMBER = 29
  1522. C
  1523. C |-------------------------------------------------------|
  1524. C |End of List of DSPLP( ) Error and Diagnostic Messages. |
  1525. C |-------------------------------------------------------|
  1526. C***REFERENCES R. J. Hanson and K. L. Hiebert, A sparse linear
  1527. C programming subprogram, Report SAND81-0297, Sandia
  1528. C National Laboratories, 1981.
  1529. C***ROUTINES CALLED DPLPMN, XERMSG
  1530. C***REVISION HISTORY (YYMMDD)
  1531. C 811215 DATE WRITTEN
  1532. C 890531 Changed all specific intrinsics to generic. (WRB)
  1533. C 890605 Corrected references to XERRWV. (WRB)
  1534. C 890605 Removed unreferenced labels. (WRB)
  1535. C 891006 Cosmetic changes to prologue. (WRB)
  1536. C 891006 REVISION DATE from Version 3.2
  1537. C 891214 Prologue converted to Version 4.0 format. (BAB)
  1538. C 900315 CALLs to XERROR changed to CALLs to XERMSG. (THJ)
  1539. C 900510 Convert XERRWV calls to XERMSG calls. (RWC)
  1540. C 920501 Reformatted the REFERENCES section. (WRB)
  1541. C***END PROLOGUE DSPLP
  1542. DOUBLE PRECISION BL(*),BU(*),COSTS(*),DATTRV(*),DUALS(*),
  1543. * PRGOPT(*),PRIMAL(*),WORK(*),ZERO
  1544. C
  1545. INTEGER IBASIS(*),IND(*),IWORK(*)
  1546. CHARACTER*8 XERN1, XERN2
  1547. C
  1548. EXTERNAL DUSRMT
  1549. C
  1550. C***FIRST EXECUTABLE STATEMENT DSPLP
  1551. ZERO=0.D0
  1552. IOPT=1
  1553. C
  1554. C VERIFY THAT MRELAS, NVARS .GT. 0.
  1555. C
  1556. IF (MRELAS.LE.0) THEN
  1557. WRITE (XERN1, '(I8)') MRELAS
  1558. CALL XERMSG ('SLATEC', 'DSPLP', 'VALUE OF MRELAS MUST BE ' //
  1559. * '.GT. 0. NOW = ' // XERN1, 5, 1)
  1560. INFO = -5
  1561. RETURN
  1562. ENDIF
  1563. C
  1564. IF (NVARS.LE.0) THEN
  1565. WRITE (XERN1, '(I8)') NVARS
  1566. CALL XERMSG ('SLATEC', 'DSPLP', 'VALUE OF NVARS MUST BE ' //
  1567. * '.GT. 0. NOW = ' // XERN1, 6, 1)
  1568. INFO = -6
  1569. RETURN
  1570. ENDIF
  1571. C
  1572. LMX=4*NVARS+7
  1573. LBM=8*MRELAS
  1574. LAST = 1
  1575. IADBIG=10000
  1576. ICTMAX=1000
  1577. ICTOPT= 0
  1578. C
  1579. C LOOK IN OPTION ARRAY FOR CHANGES TO WORK ARRAY LENGTHS.
  1580. 20008 NEXT=PRGOPT(LAST)
  1581. IF (.NOT.(NEXT.LE.0 .OR. NEXT.GT.IADBIG)) GO TO 20010
  1582. C
  1583. C THE CHECKS FOR SMALL OR LARGE VALUES OF NEXT ARE TO PREVENT
  1584. C WORKING WITH UNDEFINED DATA.
  1585. NERR=14
  1586. CALL XERMSG ('SLATEC', 'DSPLP',
  1587. + 'THE USER OPTION ARRAY HAS UNDEFINED DATA.', NERR, IOPT)
  1588. INFO=-NERR
  1589. RETURN
  1590. 20010 IF (.NOT.(NEXT.EQ.1)) GO TO 10001
  1591. GO TO 20009
  1592. 10001 IF (.NOT.(ICTOPT.GT.ICTMAX)) GO TO 10002
  1593. NERR=15
  1594. CALL XERMSG ('SLATEC', 'DSPLP',
  1595. + 'OPTION ARRAY PROCESSING IS CYCLING.', NERR, IOPT)
  1596. INFO=-NERR
  1597. RETURN
  1598. 10002 CONTINUE
  1599. KEY = PRGOPT(LAST+1)
  1600. C
  1601. C IF KEY = 53, USER MAY SPECIFY LENGTHS OF PORTIONS
  1602. C OF WORK(*) AND IWORK(*) THAT ARE ALLOCATED TO THE
  1603. C SPARSE MATRIX STORAGE AND SPARSE LINEAR EQUATION
  1604. C SOLVING.
  1605. IF (.NOT.(KEY.EQ.53)) GO TO 20013
  1606. IF (.NOT.(PRGOPT(LAST+2).NE.ZERO)) GO TO 20016
  1607. LMX=PRGOPT(LAST+3)
  1608. LBM=PRGOPT(LAST+4)
  1609. 20016 CONTINUE
  1610. 20013 ICTOPT = ICTOPT+1
  1611. LAST = NEXT
  1612. GO TO 20008
  1613. C
  1614. C CHECK LENGTH VALIDITY OF SPARSE MATRIX STAGING AREA.
  1615. C
  1616. 20009 IF (LMX.LT.NVARS+7) THEN
  1617. WRITE (XERN1, '(I8)') LMX
  1618. CALL XERMSG ('SLATEC', 'DSPLP', 'USER-DEFINED VALUE OF ' //
  1619. * 'LAMAT = ' // XERN1 // ' MUST BE .GE. NVARS+7.', 20, 1)
  1620. INFO = -20
  1621. RETURN
  1622. ENDIF
  1623. C
  1624. C TRIVIAL CHECK ON LENGTH OF LA05*() MATRIX AREA.
  1625. C
  1626. IF (.NOT.(LBM.LT.0)) GO TO 20022
  1627. NERR=21
  1628. CALL XERMSG ('SLATEC', 'DSPLP',
  1629. + 'USER-DEFINED VALUE OF LBM MUST BE .GE. 0.', NERR, IOPT)
  1630. INFO=-NERR
  1631. RETURN
  1632. 20022 CONTINUE
  1633. C
  1634. C DEFINE POINTERS FOR STARTS OF SUBARRAYS USED IN WORK(*)
  1635. C AND IWORK(*) IN OTHER SUBPROGRAMS OF THE PACKAGE.
  1636. LAMAT=1
  1637. LCSC=LAMAT+LMX
  1638. LCOLNR=LCSC+NVARS
  1639. LERD=LCOLNR+NVARS
  1640. LERP=LERD+MRELAS
  1641. LBASMA=LERP+MRELAS
  1642. LWR=LBASMA+LBM
  1643. LRZ=LWR+MRELAS
  1644. LRG=LRZ+NVARS+MRELAS
  1645. LRPRIM=LRG+NVARS+MRELAS
  1646. LRHS=LRPRIM+MRELAS
  1647. LWW=LRHS+MRELAS
  1648. LWORK=LWW+MRELAS-1
  1649. LIMAT=1
  1650. LIBB=LIMAT+LMX
  1651. LIBRC=LIBB+NVARS+MRELAS
  1652. LIPR=LIBRC+2*LBM
  1653. LIWR=LIPR+2*MRELAS
  1654. LIWORK=LIWR+8*MRELAS-1
  1655. C
  1656. C CHECK ARRAY LENGTH VALIDITY OF WORK(*), IWORK(*).
  1657. C
  1658. IF (LW.LT.LWORK .OR. LIW.LT.LIWORK) THEN
  1659. WRITE (XERN1, '(I8)') LWORK
  1660. WRITE (XERN2, '(I8)') LIWORK
  1661. CALL XERMSG ('SLATEC', 'DSPLP', 'WORK OR IWORK IS NOT LONG ' //
  1662. * 'ENOUGH. LW MUST BE = ' // XERN1 // ' AND LIW MUST BE = ' //
  1663. * XERN2, 4, 1)
  1664. INFO = -4
  1665. RETURN
  1666. ENDIF
  1667. C
  1668. CALL DPLPMN(DUSRMT,MRELAS,NVARS,COSTS,PRGOPT,DATTRV,
  1669. * BL,BU,IND,INFO,PRIMAL,DUALS,WORK(LAMAT),
  1670. * WORK(LCSC),WORK(LCOLNR),WORK(LERD),WORK(LERP),WORK(LBASMA),
  1671. * WORK(LWR),WORK(LRZ),WORK(LRG),WORK(LRPRIM),WORK(LRHS),
  1672. * WORK(LWW),LMX,LBM,IBASIS,IWORK(LIBB),IWORK(LIMAT),
  1673. * IWORK(LIBRC),IWORK(LIPR),IWORK(LIWR))
  1674. C
  1675. C CALL DPLPMN(DUSRMT,MRELAS,NVARS,COSTS,PRGOPT,DATTRV,
  1676. C 1 BL,BU,IND,INFO,PRIMAL,DUALS,AMAT,
  1677. C 2 CSC,COLNRM,ERD,ERP,BASMAT,
  1678. C 3 WR,RZ,RG,RPRIM,RHS,
  1679. C 4 WW,LMX,LBM,IBASIS,IBB,IMAT,
  1680. C 5 IBRC,IPR,IWR)
  1681. C
  1682. RETURN
  1683. END