You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

740 lines
26 KiB

2 months ago
  1. %* glpk08.tex *%
  2. \chapter{MPS Format}
  3. \label{champs}
  4. \section{Fixed MPS Format}
  5. \label{secmps}
  6. The MPS format\footnote{The MPS format was developed in 1960's by IBM
  7. as input format for their mathematical programming system MPS/360.
  8. Today the MPS format is a most widely used format understood by most
  9. mathematical programming packages. This appendix describes only the
  10. features of the MPS format, which are implemented in the GLPK package.}
  11. is intended for coding LP/MIP problem data. This format assumes the
  12. formulation of LP/MIP problem (1.1)---(1.3) (see Section \ref{seclp},
  13. page \pageref{seclp}).
  14. {\it MPS file} is a text file, which contains two types of
  15. cards\footnote{In 1960's MPS file was a deck of 80-column punched
  16. cards, so the author decided to keep the word ``card'', which may be
  17. understood as ``line of text file''.}: indicator cards and data cards.
  18. Indicator cards determine a kind of succeeding data. Each indicator
  19. card has one word in uppercase letters beginning in column 1.
  20. Data cards contain problem data. Each data card is divided into six
  21. fixed fields:
  22. \begin{center}
  23. \begin{tabular}{lcccccc}
  24. & Field 1 & Field 2 & Field 3 & Field 4 & Field 5 & Field 6 \\
  25. \hline
  26. Columns & 2---3 & 5---12 & 15---22 & 25---36 & 40---47 & 50---61 \\
  27. Contents & Code & Name & Name & Number & Name & Number \\
  28. \end{tabular}
  29. \end{center}
  30. On a particular data card some fields may be optional.
  31. Names are used to identify rows, columns, and some vectors (see below).
  32. Aligning the indicator code in the field 1 to the left margin is
  33. optional.
  34. All names specified in the fields 2, 3, and 5 should contain from 1 up
  35. to 8 arbitrary characters (except control characters). If a name is
  36. placed in the field 3 or 5, its first character should not be the dollar
  37. sign `\verb|$|'. If a name contains spaces, the spaces are ignored.
  38. All numerical values in the fields 4 and 6 should be coded in the form
  39. $sxx$\verb|E|$syy$, where $s$ is the plus `\verb|+|' or the minus
  40. `\verb|-|' sign, $xx$ is a real number with optional decimal point,
  41. $yy$ is an integer decimal exponent. Any number should contain up to 12
  42. characters. If the sign $s$ is omitted, the plus sign is assumed. The
  43. exponent part is optional. If a number contains spaces, the spaces are
  44. ignored.
  45. %\newpage
  46. If a card has the asterisk `\verb|*|' in the column 1, this card is
  47. considered as a comment and ignored. Besides, if the first character in
  48. the field 3 or 5 is the dollar sign `\verb|$|', all characters from the
  49. dollar sign to the end of card are considered as a comment and ignored.
  50. MPS file should contain cards in the following order:
  51. %\vspace*{-8pt}
  52. %\begin{itemize}
  53. \Item{---}NAME indicator card;
  54. \Item{---}ROWS indicator card;
  55. \Item{---}data cards specifying rows (constraints);
  56. \Item{---}COLUMNS indicator card;
  57. \Item{---}data cards specifying columns (structural variables) and
  58. constraint coefficients;
  59. \Item{---}RHS indicator card;
  60. \Item{---}data cards specifying right-hand sides of constraints;
  61. \Item{---}RANGES indicator card;
  62. \Item{---}data cards specifying ranges for double-bounded constraints;
  63. \Item{---}BOUNDS indicator card;
  64. \Item{---}data cards specifying types and bounds of structural
  65. variables;
  66. \Item{---}ENDATA indicator card.
  67. %\end{itemize}
  68. %\vspace*{-8pt}
  69. {\it Section} is a group of cards consisting of an indicator card and
  70. data cards succeeding this indicator card. For example, the ROWS section
  71. consists of the ROWS indicator card and data cards specifying rows.
  72. The sections RHS, RANGES, and BOUNDS are optional and may be omitted.
  73. \section{Free MPS Format}
  74. {\it Free MPS format} is an improved version of the standard (fixed)
  75. MPS format described above.\footnote{This format was developed in the
  76. beginning of 1990's by IBM as an alternative to the standard fixed MPS
  77. format for Optimization Subroutine Library (OSL).} Note that all
  78. changes in free MPS format concern only the coding of data while the
  79. structure of data is the same for both fixed and free versions of the
  80. MPS format.
  81. In free MPS format indicator and data records\footnote{{\it Record} in
  82. free MPS format has the same meaning as {\it card} in fixed MPS format.}
  83. may have arbitrary length not limited to 80 characters. Fields of data
  84. records have no predefined positions, i.e. the fields may begin in any
  85. position, except position 1, which must be blank, and must be separated
  86. from each other by one or more blanks. However, the fields must appear
  87. in the same order as in fixed MPS format.
  88. %\newpage
  89. Symbolic names in fields 2, 3, and 5 may be longer than 8
  90. characters\footnote{GLPK allows symbolic names having up to 255
  91. characters.} and must not contain embedded blanks.
  92. Numeric values in fields 4 and 6 are limited to 12 characters and must
  93. not contain embedded blanks.
  94. Only six fields on each data record are used. Any other fields are
  95. ignored.
  96. If the first character of any field (not necessarily fields 3 and 5)
  97. is the dollar sign (\$), all characters from the dollar sign to the end
  98. of record are considered as a comment and ignored.
  99. \newpage
  100. \section{NAME indicator card}
  101. The NAME indicator card should be the first card in the MPS file
  102. (except optional comment cards, which may precede the NAME card). This
  103. card should contain the word \verb|NAME| in the columns 1---4 and the
  104. problem name in the field 3. The problem name is optional and may be
  105. omitted.
  106. \section{ROWS section}
  107. \label{secrows}
  108. The ROWS section should start with the indicator card, which contains
  109. the word \verb|ROWS| in the columns 1---4.
  110. Each data card in the ROWS section specifies one row (constraint) of
  111. the problem. All these data cards have the following format.
  112. `\verb|N|' in the field 1 means that the row is free (unbounded):
  113. $$-\infty < x_i = a_{i1}x_{m+1} + a_{i2}x_{m+2} + \dots + a_{in}x_{m+n}
  114. < +\infty;$$
  115. `\verb|L|' in the field 1 means that the row is of ``less than or equal
  116. to'' type:
  117. $$-\infty < x_i = a_{i1}x_{m+1} + a_{i2}x_{m+2} + \dots + a_{in}x_{m+n}
  118. \leq b_i;$$
  119. `\verb|G|' in the field 1 means that the row is of ``greater than or
  120. equal to'' type:
  121. $$b_i \leq x_i = a_{i1}x_{m+1} + a_{i2}x_{m+2} + \dots + a_{in}x_{m+n}
  122. < +\infty;$$
  123. `\verb|E|' in the field 1 means that the row is of ``equal to'' type:
  124. $$x_i = a_{i1}x_{m+1} + a_{i2}x_{m+2} + \dots + a_{in}x_{m+n} \leq
  125. b_i,$$
  126. where $b_i$ is a right-hand side. Note that each constraint has a
  127. corresponding implictly defined auxiliary variable ($x_i$ above), whose
  128. value is a value of the corresponding linear form, therefore row bounds
  129. can be considered as bounds of such auxiliary variable.
  130. The filed 2 specifies a row name (which is considered as the name of
  131. the corresponding auxiliary variable).
  132. %\newpage
  133. The fields 3, 4, 5, and 6 are not used and should be empty.
  134. Numerical values of all non-zero right-hand sides $b_i$ should be
  135. specified in the RHS section (see below). All double-bounded (ranged)
  136. constraints should be specified in the RANGES section (see below).
  137. \section{COLUMNS section}
  138. The COLUMNS section should start with the indicator card, which
  139. contains the word \verb|COLUMNS| in the columns 1---7.
  140. Each data card in the COLUMNS section specifies one or two constraint
  141. coefficients $a_{ij}$ and also introduces names of columns, i.e. names
  142. of structural variables. All these data cards have the following
  143. format.
  144. The field 1 is not used and should be empty.
  145. The field 2 specifies a column name. If this field is empty, the column
  146. name from the immediately preceeding data card is assumed.
  147. The field 3 specifies a row name defined in the ROWS section.
  148. The field 4 specifies a numerical value of the constraint coefficient
  149. $a_{ij}$, which is placed in the corresponding row and column.
  150. The fields 5 and 6 are optional. If they are used, they should contain
  151. a second pair ``row name---constraint coefficient'' for the same column.
  152. Elements of the constraint matrix (i.e. constraint coefficients) should
  153. be enumerated in the column wise manner: all elements for the current
  154. column should be specified before elements for the next column. However,
  155. the order of rows in the COLUMNS section may differ from the order of
  156. rows in the ROWS section.
  157. Constraint coefficients not specified in the COLUMNS section are
  158. considered as zeros. Therefore zero coefficients may be omitted,
  159. although it is allowed to explicitly specify them.
  160. \section{RHS section}
  161. The RHS section should start with the indicator card, which contains the
  162. word \verb|RHS| in the columns 1---3.
  163. Each data card in the RHS section specifies one or two right-hand sides
  164. $b_i$ (see Section \ref{secrows}, page \pageref{secrows}). All these
  165. data cards have the following format.
  166. The field 1 is not used and should be empty.
  167. The field 2 specifies a name of the right-hand side (RHS)
  168. vector\footnote{This feature allows the user to specify several RHS
  169. vectors in the same MPS file. However, before solving the problem a
  170. particular RHS vector should be chosen.}. If this field is empty, the
  171. RHS vector name from the immediately preceeding data card is assumed.
  172. %\newpage
  173. The field 3 specifies a row name defined in the ROWS section.
  174. The field 4 specifies a right-hand side $b_i$ for the row, whose name is
  175. specified in the field 3. Depending on the row type $b_i$ is a lower
  176. bound (for the row of \verb|G| type), an upper bound (for the row of
  177. \verb|L| type), or a fixed value (for the row of \verb|E|
  178. type).\footnote{If the row is of {\tt N} type, $b_i$ is considered as
  179. a constant term of the corresponding linear form. Should note, however,
  180. this convention is non-standard.}
  181. The fields 5 and 6 are optional. If they are used, they should contain
  182. a second pair ``row name---right-hand side'' for the same RHS vector.
  183. All right-hand sides for the current RHS vector should be specified
  184. before right-hand sides for the next RHS vector. However, the order of
  185. rows in the RHS section may differ from the order of rows in the ROWS
  186. section.
  187. Right-hand sides not specified in the RHS section are considered as
  188. zeros. Therefore zero right-hand sides may be omitted, although it is
  189. allowed to explicitly specify them.
  190. \newpage
  191. \section{RANGES section}
  192. The RANGES section should start with the indicator card, which contains
  193. the word \verb|RANGES| in the columns 1---6.
  194. Each data card in the RANGES section specifies one or two ranges for
  195. double-side constraints, i.e. for constraints that are of the types
  196. \verb|L| and \verb|G| at the same time:
  197. $$l_i \leq x_i = a_{i1}x_{m+1} + a_{i2}x_{m+2} + \dots + a_{in}x_{m+n}
  198. \leq u_i,$$
  199. where $l_i$ is a lower bound, $u_i$ is an upper bound. All these data
  200. cards have the following format.
  201. The field 1 is not used and should be empty.
  202. The field 2 specifies a name of the range vector\footnote{This feature
  203. allows the user to specify several range vectors in the same MPS file.
  204. However, before solving the problem a particular range vector should be
  205. chosen.}. If this field is empty, the range vector name from the
  206. immediately preceeding data card is assumed.
  207. The field 3 specifies a row name defined in the ROWS section.
  208. The field 4 specifies a range value $r_i$ (see the table below) for the
  209. row, whose name is specified in the field 3.
  210. The fields 5 and 6 are optional. If they are used, they should contain
  211. a second pair ``row name---range value'' for the same range vector.
  212. All range values for the current range vector should be specified before
  213. range values for the next range vector. However, the order of rows in
  214. the RANGES section may differ from the order of rows in the ROWS
  215. section.
  216. For each double-side constraint specified in the RANGES section its
  217. lower and upper bounds are determined as follows:
  218. %\newpage
  219. \begin{center}
  220. \begin{tabular}{cccc}
  221. Row type & Sign of $r_i$ & Lower bound & Upper bound \\
  222. \hline
  223. {\tt G} & $+$ or $-$ & $b_i$ & $b_i + |r_i|$ \\
  224. {\tt L} & $+$ or $-$ & $b_i - |r_i|$ & $b_i$ \\
  225. {\tt E} & $+$ & $b_i$ & $b_i + |r_i|$ \\
  226. {\tt E} & $-$ & $b_i - |r_i|$ & $b_i$ \\
  227. \end{tabular}
  228. \end{center}
  229. \noindent
  230. where $b_i$ is a right-hand side specified in the RHS section (if $b_i$
  231. is not specified, it is considered as zero), $r_i$ is a range value
  232. specified in the RANGES section.
  233. \section{BOUNDS section}
  234. \label{secbounds}
  235. The BOUNDS section should start with the indicator card, which contains
  236. the word \verb|BOUNDS| in the columns 1---6.
  237. Each data card in the BOUNDS section specifies one (lower or upper)
  238. bound for one structural variable (column). All these data cards have
  239. the following format.
  240. The indicator in the field 1 specifies the bound type:
  241. \verb|LO| --- lower bound;
  242. \verb|UP| --- upper bound;
  243. \verb|FX| --- fixed variable (lower and upper bounds are equal);
  244. \verb|FR| --- free variable (no bounds);
  245. \verb|MI| --- no lower bound (lower bound is ``minus infinity'');
  246. \verb|PL| --- no upper bound (upper bound is ``plus infinity'').
  247. The field 2 specifies a name of the bound vector\footnote{This feature
  248. allows the user to specify several bound vectors in the same MPS file.
  249. However, before solving the problem a particular bound vector should be
  250. chosen.}. If this field is empty, the bound vector name from the
  251. immediately preceeding data card is assumed.
  252. The field 3 specifies a column name defined in the COLUMNS section.
  253. The field 4 specifies a bound value. If the bound type in the field 1
  254. differs from \verb|LO|, \verb|UP|, and \verb|FX|, the value in the field
  255. 4 is ignored and may be omitted.
  256. The fields 5 and 6 are not used and should be empty.
  257. All bound values for the current bound vector should be specified before
  258. bound values for the next bound vector. However, the order of columns in
  259. the BOUNDS section may differ from the order of columns in the COLUMNS
  260. section. Specification of a lower bound should precede specification of
  261. an upper bound for the same column (if both the lower and upper bounds
  262. are explicitly specified).
  263. By default, all columns (structural variables) are non-negative, i.e.
  264. have zero lower bound and no upper bound. Lower ($l_j$) and upper
  265. ($u_j$) bounds of some column (structural variable $x_j$) are set in the
  266. following way, where $s_j$ is a corresponding bound value explicitly
  267. specified in the BOUNDS section:
  268. %\newpage
  269. \verb|LO| sets $l_j$ to $s_j$;
  270. \verb|UP| sets $u_j$ to $s_j$;
  271. \verb|FX| sets both $l_j$ and $u_j$ to $s_j$;
  272. \verb|FR| sets $l_j$ to $-\infty$ and $u_j$ to $+\infty$;
  273. \verb|MI| sets $l_j$ to $-\infty$;
  274. \verb|PL| sets $u_j$ to $+\infty$.
  275. \section{ENDATA indicator card}
  276. The ENDATA indicator card should be the last card of MPS file (except
  277. optional comment cards, which may follow the ENDATA card). This card
  278. should contain the word \verb|ENDATA| in the columns 1---6.
  279. \section{Specifying objective function}
  280. It is impossible to explicitly specify the objective function and
  281. optimization direction in the MPS file. However, the following implicit
  282. rule is used by default: the first row of \verb|N| type is considered
  283. as a row of the objective function (i.e. the objective function is the
  284. corresponding auxiliary variable), which should be {\it minimized}.
  285. GLPK also allows specifying a constant term of the objective function
  286. as a right-hand side of the corresponding row in the RHS section.
  287. \section{Example of MPS file}
  288. \label{secmpsex}
  289. To illustrate what the MPS format is, consider the following example of
  290. LP problem:
  291. \def\arraystretch{1.2}
  292. \noindent\hspace{.5in}minimize
  293. $$
  294. value = .03\ bin_1 + .08\ bin_2 + .17\ bin_3 + .12\ bin_4 + .15\ bin_5
  295. + .21\ al + .38\ si
  296. $$
  297. \noindent\hspace{.5in}subject to linear constraints
  298. $$
  299. \begin{array}{@{}l@{\:}l@{}}
  300. yield &= \ \ \ \ \;bin_1 + \ \ \ \ \;bin_2 + \ \ \ \ \;bin_3 +
  301. \ \ \ \ \;bin_4 + \ \ \ \ \;bin_5 + \ \ \ \ \;al +
  302. \ \ \ \ \;si \\
  303. FE &= .15\ bin_1 + .04\ bin_2 + .02\ bin_3 + .04\ bin_4 + .02\ bin_5
  304. + .01\ al + .03\ si \\
  305. CU &= .03\ bin_1 + .05\ bin_2 + .08\ bin_3 + .02\ bin_4 + .06\ bin_5
  306. + .01\ al \\
  307. MN &= .02\ bin_1 + .04\ bin_2 + .01\ bin_3 + .02\ bin_4 + .02\ bin_5
  308. \\
  309. MG &= .02\ bin_1 + .03\ bin_2
  310. \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ + .01\ bin_5 \\
  311. AL &= .70\ bin_1 + .75\ bin_2 + .80\ bin_3 + .75\ bin_4 + .80\ bin_5
  312. + .97\ al \\
  313. SI &= .02\ bin_1 + .06\ bin_2 + .08\ bin_3 + .12\ bin_4 + .02\ bin_5
  314. + .01\ al + .97\ si \\
  315. \end{array}
  316. $$
  317. \noindent\hspace{.5in}and bounds of (auxiliary and structural)
  318. variables
  319. $$
  320. \begin{array}{r@{\ }l@{\ }l@{\ }l@{\ }rcr@{\ }l@{\ }l@{\ }l@{\ }r}
  321. &&yield&=&2000&&0&\leq&bin_1&\leq&200\\
  322. -\infty&<&FE&\leq&60&&0&\leq&bin_2&\leq&2500\\
  323. -\infty&<&CU&\leq&100&&400&\leq&bin_3&\leq&800\\
  324. -\infty&<&MN&\leq&40&&100&\leq&bin_4&\leq&700\\
  325. -\infty&<&MG&\leq&30&&0&\leq&bin_5&\leq&1500\\
  326. 1500&\leq&AL&<&+\infty&&0&\leq&al&<&+\infty\\
  327. 250&\leq&SI&\leq&300&&0&\leq&si&<&+\infty\\
  328. \end{array}
  329. $$
  330. \def\arraystretch{1}
  331. A complete MPS file which specifies data for this example is shown
  332. below (the first two comment lines show card positions).
  333. \newpage
  334. \begin{footnotesize}
  335. \begin{verbatim}
  336. *000000001111111111222222222233333333334444444444555555555566
  337. *234567890123456789012345678901234567890123456789012345678901
  338. NAME PLAN
  339. ROWS
  340. N VALUE
  341. E YIELD
  342. L FE
  343. L CU
  344. L MN
  345. L MG
  346. G AL
  347. L SI
  348. COLUMNS
  349. BIN1 VALUE .03000 YIELD 1.00000
  350. FE .15000 CU .03000
  351. MN .02000 MG .02000
  352. AL .70000 SI .02000
  353. BIN2 VALUE .08000 YIELD 1.00000
  354. FE .04000 CU .05000
  355. MN .04000 MG .03000
  356. AL .75000 SI .06000
  357. BIN3 VALUE .17000 YIELD 1.00000
  358. FE .02000 CU .08000
  359. MN .01000 AL .80000
  360. SI .08000
  361. BIN4 VALUE .12000 YIELD 1.00000
  362. FE .04000 CU .02000
  363. MN .02000 AL .75000
  364. SI .12000
  365. BIN5 VALUE .15000 YIELD 1.00000
  366. FE .02000 CU .06000
  367. MN .02000 MG .01000
  368. AL .80000 SI .02000
  369. ALUM VALUE .21000 YIELD 1.00000
  370. FE .01000 CU .01000
  371. AL .97000 SI .01000
  372. SILICON VALUE .38000 YIELD 1.00000
  373. FE .03000 SI .97000
  374. RHS
  375. RHS1 YIELD 2000.00000 FE 60.00000
  376. CU 100.00000 MN 40.00000
  377. SI 300.00000
  378. MG 30.00000 AL 1500.00000
  379. RANGES
  380. RNG1 SI 50.00000
  381. BOUNDS
  382. UP BND1 BIN1 200.00000
  383. UP BIN2 2500.00000
  384. LO BIN3 400.00000
  385. UP BIN3 800.00000
  386. LO BIN4 100.00000
  387. UP BIN4 700.00000
  388. UP BIN5 1500.00000
  389. ENDATA
  390. \end{verbatim}
  391. \end{footnotesize}
  392. %\vspace*{-6pt}
  393. \section{MIP features}
  394. %\vspace*{-4pt}
  395. The MPS format provides two ways for introducing integer variables into
  396. the problem.
  397. The first way is most general and based on using special marker cards
  398. INTORG and INTEND. These marker cards are placed in the COLUMNS section.
  399. The INTORG card indicates the start of a group of integer variables
  400. (columns), and the card INTEND indicates the end of the group. The MPS
  401. file may contain arbitrary number of the marker cards.
  402. The marker cards have the same format as the data cards (see Section
  403. \ref{secmps}, page \pageref{secmps}).
  404. The fields 1, 2, and 6 are not used and should be empty.
  405. The field 2 should contain a marker name. This name may be arbitrary.
  406. The field 3 should contain the word \verb|'MARKER'| (including
  407. apostrophes).
  408. The field 5 should contain either the word \verb|'INTORG'| (including
  409. apostrophes) for the marker card, which begins a group of integer
  410. columns, or the word \verb|'INTEND'| (including apostrophes) for the
  411. marker card, which ends the group.
  412. The second way is less general but more convenient in some cases. It
  413. allows the user declaring integer columns using three additional types
  414. of bounds, which are specified in the field 1 of data cards in the
  415. BOUNDS section (see Section \ref{secbounds}, page \pageref{secbounds}):
  416. \verb|LI| --- lower integer. This bound type specifies that the
  417. corresponding column (structural variable), whose name is specified in
  418. field 3, is of integer kind. In this case an lower bound of the
  419. column should be specified in field 4 (like in the case of \verb|LO|
  420. bound type).
  421. \verb|UI| --- upper integer. This bound type specifies that the
  422. corresponding column (structural variable), whose name is specified in
  423. field 3, is of integer kind. In this case an upper bound of the
  424. column should be specified in field 4 (like in the case of \verb|UP|
  425. bound type).
  426. \verb|BV| --- binary variable. This bound type specifies that the
  427. corresponding column (structural variable), whose name is specified in
  428. the field 3, is of integer kind, its lower bound is zero, and its upper
  429. bound is one (thus, such variable being of integer kind can have only
  430. two values zero and one). In this case a numeric value specified in the
  431. field 4 is ignored and may be omitted.
  432. Consider the following example of MIP problem:
  433. \noindent
  434. \hspace{1in} minimize
  435. $$Z = 3 x_1 + 7 x_2 - x_3 + x4$$
  436. \hspace{1in} subject to linear constraints
  437. $$
  438. \begin{array}{c}
  439. \nonumber r_1 = 2 x_1 - \ \ x_2 + \ \ x_3 - \ \;x_4 \\
  440. \nonumber r_2 = \ \;x_1 - \ \;x_2 - 6 x_3 + 4 x_4 \\
  441. \nonumber r_3 = 5 x_1 + 3 x_2 \ \ \ \ \ \ \ \ \ + \ \ x_4 \\
  442. \end{array}
  443. $$
  444. \hspace{1in} and bound of variables
  445. $$
  446. \begin{array}{cccl}
  447. \nonumber 1 \leq r_1 < +\infty && 0 \leq x_1 \leq 4 &{\rm(continuous)}\\
  448. \nonumber 8 \leq r_2 < +\infty && 2 \leq x_2 \leq 5 &{\rm(integer)} \\
  449. \nonumber 5 \leq r_3 < +\infty && 0 \leq x_3 \leq 1 &{\rm(integer)} \\
  450. \nonumber && 3 \leq x_4 \leq 8 &{\rm(continuous)}\\
  451. \end{array}
  452. $$
  453. The corresponding MPS file may look like follows:
  454. \newpage
  455. \begin{footnotesize}
  456. \begin{verbatim}
  457. NAME SAMP1
  458. ROWS
  459. N Z
  460. G R1
  461. G R2
  462. G R3
  463. COLUMNS
  464. X1 R1 2.0 R2 1.0
  465. X1 R3 5.0 Z 3.0
  466. MARK0001 'MARKER' 'INTORG'
  467. X2 R1 -1.0 R2 -1.0
  468. X2 R3 3.0 Z 7.0
  469. X3 R1 1.0 R2 -6.0
  470. X3 Z -1.0
  471. MARK0002 'MARKER' 'INTEND'
  472. X4 R1 -1.0 R2 4.0
  473. X4 R3 1.0 Z 1.0
  474. RHS
  475. RHS1 R1 1.0
  476. RHS1 R2 8.0
  477. RHS1 R3 5.0
  478. BOUNDS
  479. UP BND1 X1 4.0
  480. LO BND1 X2 2.0
  481. UP BND1 X2 5.0
  482. UP BND1 X3 1.0
  483. LO BND1 X4 3.0
  484. UP BND1 X4 8.0
  485. ENDATA
  486. \end{verbatim}
  487. \end{footnotesize}
  488. %\newpage
  489. \vspace{-3pt}
  490. The same example may be coded without INTORG/INTEND markers using the
  491. bound type UI for the variable $x_2$ and the bound type BV for the
  492. variable $x_3$:
  493. %\medskip
  494. \begin{footnotesize}
  495. \begin{verbatim}
  496. NAME SAMP2
  497. ROWS
  498. N Z
  499. G R1
  500. G R2
  501. G R3
  502. COLUMNS
  503. X1 R1 2.0 R2 1.0
  504. X1 R3 5.0 Z 3.0
  505. X2 R1 -1.0 R2 -1.0
  506. X2 R3 3.0 Z 7.0
  507. X3 R1 1.0 R2 -6.0
  508. X3 Z -1.0
  509. X4 R1 -1.0 R2 4.0
  510. X4 R3 1.0 Z 1.0
  511. RHS
  512. RHS1 R1 1.0
  513. RHS1 R2 8.0
  514. RHS1 R3 5.0
  515. BOUNDS
  516. UP BND1 X1 4.0
  517. LO BND1 X2 2.0
  518. UI BND1 X2 5.0
  519. BV BND1 X3
  520. LO BND1 X4 3.0
  521. UP BND1 X4 8.0
  522. ENDATA
  523. \end{verbatim}
  524. \end{footnotesize}
  525. %\section{Specifying predefined basis}
  526. %\label{secbas}
  527. %
  528. %The MPS format can also be used to specify some predefined basis for an
  529. %LP problem, i.e. to specify which rows and columns are basic and which
  530. %are non-basic.
  531. %
  532. %The order of a basis file in the MPS format is:
  533. %
  534. %$\bullet$ NAME indicator card;
  535. %
  536. %$\bullet$ data cards (can appear in arbitrary order);
  537. %
  538. %$\bullet$ ENDATA indicator card.
  539. %
  540. %Each data card specifies either a pair "basic column---non-basic row"
  541. %or a non-basic column. All the data cards have the following format.
  542. %
  543. %`\verb|XL|' in the field 1 means that a column, whose name is given in
  544. %the field 2, is basic, and a row, whose name is given in the field 3,
  545. %is non-basic and placed on its lower bound.
  546. %
  547. %`\verb|XU|' in the field 1 means that a column, whose name is given in
  548. %the field 2, is basic, and a row, whose name is given in the field 3,
  549. %is non-basic and placed on its upper bound.
  550. %
  551. %`\verb|LL|' in the field 1 means that a column, whose name is given in
  552. %the field 3, is non-basic and placed on its lower bound.
  553. %
  554. %`\verb|UL|' in the field 1 means that a column, whose name is given in
  555. %the field 3, is non-basic and placed on its upper bound.
  556. %
  557. %The field 2 contains a column name.
  558. %
  559. %If the indicator given in the field 1 is `\verb|XL|' or `\verb|XU|',
  560. %the field 3 contains a row name. Otherwise, if the indicator is
  561. %`\verb|LL|' or `\verb|UL|', the field 3 is not used and should be
  562. %empty.
  563. %
  564. %The field 4, 5, and 6 are not used and should be empty.
  565. %
  566. %A basis file in the MPS format acts like a patch: it doesn't specify
  567. %a basis completely, instead that it is just shows in what a given basis
  568. %differs from the "standard" basis, where all rows (auxiliary variables)
  569. %are assumed to be basic and all columns (structural variables) are
  570. %assumed to be non-basic.
  571. %
  572. %As an example here is a basis file that specifies an optimal basis
  573. %for the example LP problem given in Section \ref{secmpsex},
  574. %Page \pageref{secmpsex}:
  575. %
  576. %\pagebreak
  577. %
  578. %\begin{verbatim}
  579. %*000000001111111111222222222233333333334444444444555555555566
  580. %*234567890123456789012345678901234567890123456789012345678901
  581. %NAME PLAN
  582. % XL BIN2 YIELD
  583. % XL BIN3 FE
  584. % XL BIN4 MN
  585. % XL ALUM AL
  586. % XL SILICON SI
  587. % LL BIN1
  588. % LL BIN5
  589. %ENDATA
  590. %\end{verbatim}
  591. %* eof *%